Commit Graph

561 Commits

Author SHA1 Message Date
Rika Ichinose
524589231f Improved CompareByte for i386 and x86_64. 2023-02-05 15:09:01 +00:00
florian
3e6d4bf1cc * new cpu feature tests 2022-11-09 23:09:07 +01:00
florian
12aa48602b + CMOVSupport function 2022-11-08 21:15:11 +01:00
Jonas Maebe
0758aa1143 FPU exception mask: generlised system unit interface 2022-10-17 19:43:01 +00:00
florian
6bbefcae9e * check more cpuid flags in the cpu units 2022-04-04 22:55:05 +02:00
florian
0d03cad279 * i386: make use of *fence instructions 2022-03-07 23:10:31 +01:00
florian
39627cbdfb + AVX512VBMISupport and AVX512VBMI2Support 2022-03-05 20:35:25 +01:00
florian
39836e2d37 - removed superfluous comment 2022-02-12 23:18:53 +01:00
florian
79cf1dd9cf + store also ecx and edx after cpuid call with eax=7
+ test VNNI and BIGALG instructions
2022-02-07 21:22:16 +01:00
florian
2e8321e0fa + routines to test for AVX512VNNI and AVX512BITALG support 2022-01-21 18:23:04 +01:00
Florian Klämpfl
4aebfe97a9 + x86: ADXSupport
+ x86: RDSEEDSupport
2022-01-03 22:51:00 +01:00
Florian Klämpfl
dde8f54ee7 + LZCNTSupport
+ test extended
2021-12-28 17:05:56 +01:00
florian
bff09e8e9e + CPU units: check for SHA support 2021-10-09 16:23:11 +02:00
florian
6c0b79c258 + AVX512*Support functions
* call cpuid with eax=7 only if it is supported by the CPU

git-svn-id: trunk@49601 -
2021-07-11 20:09:57 +00:00
florian
5ca73c61f4 + CPU.BMI1Support and CPU.BMI2Support
git-svn-id: trunk@49582 -
2021-07-07 20:26:59 +00:00
florian
de62cb8b02 * do not execute xend twice which was introduced in r48430
git-svn-id: trunk@48456 -
2021-01-30 18:46:58 +00:00
pierre
5dbd9eb2e0 Introduce USE_REAL_INSTRUCTIONS to handle expressions not accepted by old assemblers
git-svn-id: trunk@48430 -
2021-01-26 14:50:58 +00:00
pierre
3362abb30c * Set softfloat_rounding_mode indise SetRoundMode function for all CPUs.
* SetRoundMode returns previous rounding mode value for all CPUs.

git-svn-id: trunk@48018 -
2021-01-03 21:44:18 +00:00
florian
b5725ac3ed * while not official supported, bootstrapping with 3.0.4 fixed
git-svn-id: trunk@47901 -
2020-12-30 09:34:22 +00:00
florian
98d3473a1a * i386: disable InterlockedCompareExchange128 implementation if PIC is enabled
git-svn-id: trunk@47852 -
2020-12-26 21:11:12 +00:00
florian
4f05523db9 + RTMSupport function
+ if available use RTM to support InterlockedCompareExchange128 on i386

git-svn-id: trunk@47833 -
2020-12-22 22:00:08 +00:00
svenbarth
48cc5250f9 * fpc_geteipasebx and fpc_geteipasecx are used as procedures, not functions, so declare them as such
git-svn-id: trunk@45980 -
2020-08-01 17:26:34 +00:00
florian
769a8fa248 + patch by fanjinke: Hygon support for the mmx unit, resolves #37391
git-svn-id: trunk@45848 -
2020-07-24 20:53:54 +00:00
florian
e26e824700 + more helper routine to check for CPU features added
git-svn-id: trunk@45835 -
2020-07-23 20:57:45 +00:00
florian
c01db96df4 + functions to check for Popcnt support
git-svn-id: trunk@45827 -
2020-07-22 20:47:11 +00:00
florian
ac5407268c * regenerated
git-svn-id: trunk@45778 -
2020-07-12 20:46:54 +00:00
Jeppe Johansen
c20b27ede9 Add most SSE instructions as intrinsics.
git-svn-id: trunk@44274 -
2020-03-06 21:34:22 +00:00
florian
22ab6dd329 * disabled mm procs again, they are not usable yet neither supposed to be
used

git-svn-id: trunk@43968 -
2020-01-18 11:37:57 +00:00
svenbarth
8184815780 * ensure that the new mm related procs are only used for 3.3.1 and newer as 3.2 and older don't support the corresponding SSE types
git-svn-id: trunk@43967 -
2020-01-18 11:22:24 +00:00
florian
70a836c4a2 * first part of merging parts of Jeppe's intrinsics patch, mainly r31135
is merged by this commit with a lot of adaptions

git-svn-id: trunk@43949 -
2020-01-14 21:52:39 +00:00
florian
3e6e72118b * keep stack aligned to 16 byte boundaries in assembler subroutines calling other subroutines
git-svn-id: trunk@43012 -
2019-09-15 17:17:31 +00:00
florian
62f890efa3 * improved floating point signal handling on x86/linux
git-svn-id: branches/debug_eh@41451 -
2019-02-24 20:03:02 +00:00
nickysn
9272bf59b2 + added x86 (i8086, i386 and x86_64) intrinsics fpc_x86_get_cs/ss/ds/es/fs/gs
for getting the value of x86 segment registers

git-svn-id: trunk@39433 -
2018-07-11 14:19:40 +00:00
nickysn
8e6205aca6 * changed the visibility of the writeport and readport methods in the ports unit
objects to private (since they should be accessed only through the default
  indexed property)

git-svn-id: trunk@39421 -
2018-07-09 14:55:20 +00:00
nickysn
3673f03841 * set the stdcall calling convention explicitly for each method, that requires
it, instead of using {$calling stdcall} in the go32v2 ports unit

git-svn-id: trunk@39402 -
2018-07-06 15:59:26 +00:00
nickysn
0ea3570b96 * moved the interface and implementation parts of the go32v2 ports unit to
include files portsh.inc and ports.inc in the i386 rtl directory

git-svn-id: trunk@39397 -
2018-07-06 15:52:18 +00:00
nickysn
ff2fff365f + added x86 compiler intrinsics fpc_x86_sti and fpc_x86_cli, which generate the
'sti' and 'cli' instructions

git-svn-id: trunk@39388 -
2018-07-04 16:48:34 +00:00
nickysn
a1bf5e2f07 + also added the fpc_x86_*port* intrinsics to the i386 system unit
git-svn-id: trunk@39369 -
2018-07-03 22:42:03 +00:00
nickysn
26a3ac3fd4 * moved the fpc_in_x86_*port* constants to the system unit in cpuinnr.inc in the
i8086, i386 and x86_64 rtl directories. This is done for consistency with
  other compiler internal function numbers (which are declared in innr.inc).

git-svn-id: trunk@39367 -
2018-07-03 21:30:43 +00:00
nickysn
39dc58de09 - removed one asm instruction from i386's StrEnd() implementation
git-svn-id: trunk@37615 -
2017-11-23 16:43:51 +00:00
nickysn
3d108d5e51 + enabled the i386 asm optimized strcomp (was previously disabled due to wrong ifndef)
git-svn-id: trunk@37614 -
2017-11-23 16:16:05 +00:00
florian
ff86c80176 * cpu specific header file for the system unit: cpuh.inc, moved several declarations into it
git-svn-id: trunk@37542 -
2017-11-01 16:33:30 +00:00
pierre
efafecbf9f Also use .byte version of emms instruction
git-svn-id: trunk@37011 -
2017-08-21 13:47:47 +00:00
pierre
239b623027 Fix typo in last commit
git-svn-id: trunk@37010 -
2017-08-21 13:37:54 +00:00
pierre
d1e091d5a3 Use .byte substitutes for ldmxcsr and stmxcsr instructions
if OLD_ASSEMBLER macro is defined.

  Do not use PIC code for fpc_exp_real if OLD_ASSEMBLER is defined
  (this generates unsupported relocations for GNU assembler 2.6 used by EMX)

git-svn-id: trunk@37009 -
2017-08-21 13:29:29 +00:00
pierre
df7946a9cc * Do not use fastmove.inc if OLD_ASSEMBLER is defined,
as older assembler do not support 64-bit instructions use in there.
    * Use .byte substitutes for ldmxcsr and movaps instructions

git-svn-id: trunk@37008 -
2017-08-21 13:26:44 +00:00
pierre
82aa8c4d2f Use REPE prefix instead of REP before CMPS{B,W,L} instruction (wasm generates an error for REP)
git-svn-id: trunk@36854 -
2017-08-05 19:50:18 +00:00
pierre
f4ecf87a50 Add conditional FASTMOVE_DISABLE_SSE3 to be able to discard SSE specific code, needed for Watcom Assembler support
git-svn-id: trunk@36848 -
2017-08-04 20:51:58 +00:00
florian
7213a13081 * split fpc_mul_<64 bit> into separate procedures with and without overflow checking
git-svn-id: trunk@35454 -
2017-02-19 19:15:14 +00:00
Károly Balogh
0e54f616b5 merged i386 int64 mod helper fix by Max Nazhalov (Mantis 30240)
git-svn-id: trunk@34059 -
2016-07-03 21:20:07 +00:00
svenbarth
535621faaa Rename FPC_HAS_INDIRECT_MAIN_INFORMATION to FPC_HAS_INDIRECT_ENTRY_INFORMATION which is more logical considering the record's name
git-svn-id: trunk@33950 -
2016-06-11 20:38:22 +00:00
Károly Balogh
963c4aa1f8 * fixed the sign handling of i386 fpc_div_int64 helper (Mantis 30166)
git-svn-id: trunk@33753 -
2016-05-22 16:57:30 +00:00
florian
9b1e6e1976 - removed i386 specific fpc_pchar_length implementation as it is much slower than the generic one which takes advantage of IndexByte
git-svn-id: trunk@33491 -
2016-04-12 18:13:24 +00:00
sergei
17256e8387 * fpc_exp_real: replaced pushing immediate values on stack with Darwin-style PIC. This change increases performance on Intel E7200 almost twice. On AMD CPUs performance increase is not that large, but still noticeable.
git-svn-id: trunk@33131 -
2016-02-28 16:03:02 +00:00
florian
77cf67b59a o unified interface of i386 and x86-64 cpu unit:
+ InterlockedCompareExchange128Support for i386 always returning false
  + AESSupport for i386
  + dummy InterlockedCompareExchange128 for i386 throwing an rte 217

git-svn-id: trunk@32857 -
2016-01-05 15:23:26 +00:00
Jonas Maebe
12030f904a - removed FPC_HAS_VALGRINDBOOL-related checks, FPC 2.6.4 has it
git-svn-id: trunk@31691 -
2015-09-15 11:51:45 +00:00
nickysn
d39bfec4d2 + added missing i386 system unit includes fastmove.inc and int64p.inc to makefile.cpu
git-svn-id: trunk@30131 -
2015-03-07 22:35:23 +00:00
Károly Balogh
88b58c3580 i386: added signed 64bit div/mod helpers in assembly. we have some 64bit heavy code where a direct helper results in about 8-10% of performance advantage compared to going through the generic wrapper + the unsigned function
git-svn-id: trunk@28261 -
2014-07-24 21:06:23 +00:00
sergei
a8bc2085e8 - Delete strpas.inc files, no longer used, their contents has been merged into corresponding $(CPU).inc.
git-svn-id: trunk@27833 -
2014-05-31 00:49:40 +00:00
sergei
fc5f45f65c * sqr(real) and sqrt(real): remove typeconv node inserted by initial call processing (see explanation in comments), allowing these functions to be evaluated using precision of argument. In particular, sqrt(single) and sqrt(double) now emit 'sqrtss' and 'sqrtsd' instructions on x86 targets with -Cfsse3. Non-x86 targets already have the necessary support in code generators.
* abs(real): handle the same way as sqrt and sqr, i.e. without casting to bestreal and back.

git-svn-id: trunk@27808 -
2014-05-21 14:53:47 +00:00
sergei
b16c6f8ced * i386 and x86_64 changes for Delphi compatibility:
* 'mxcsr' variable made public and renamed to DefaultMXCSR.
  * GetSSECSR and SetSSECSR renamed to GetMXCSR and SetMXCSR, respectively. Previous names continue to exist as deprecated aliases.

git-svn-id: trunk@27656 -
2014-04-25 15:10:12 +00:00
sergei
6810d643c4 * Fixed exp() result for +-Inf input, must be +Inf or 0, not NaN. This is mathematically correct and consistent with generic implementation of this function.
git-svn-id: trunk@27553 -
2014-04-12 21:18:57 +00:00
sergei
57c762c8d2 + Inserted license header for AMath routines.
git-svn-id: trunk@27552 -
2014-04-12 20:45:44 +00:00
sergei
bd58adfcc9 + Added credits for functions reused from AMath/DAMath libraries.
git-svn-id: trunk@27518 -
2014-04-10 20:29:49 +00:00
sergei
217bac7a0b - Removed fpc_pi_real compilerproc, it is no longer used. At least two releases (2.6.2 and 2.6.4) emit Pi directly as a constant.
git-svn-id: trunk@27500 -
2014-04-07 09:16:24 +00:00
sergei
2981f73aaa - Removed redundant functions "power", they were neither used nor accessible through interface. The actual function "power" is located in Math unit.
git-svn-id: trunk@27499 -
2014-04-07 09:04:13 +00:00
sergei
d251c131a5 * i386: replaced fpc_exp_real with a port from AMath library. It has better accuracy and is faster on CPUs that suffer penalties from changing x87 control word.
git-svn-id: trunk@27367 -
2014-03-30 09:41:06 +00:00
sergei
d1348d3f9b - i386 and x86_64: Once softfloat stuff has been cleaned up, SysResetFPU and SysInitFPU end up doing exactly the same. Removed one of them.
git-svn-id: trunk@27280 -
2014-03-25 10:52:07 +00:00
sergei
8ad5e6fb26 - RTL: cleaned out FPC_FREEMEM_X. We now have a dedicated compilerproc 'fpc_freemem' for this purpose.
git-svn-id: trunk@27232 -
2014-03-23 02:11:38 +00:00
florian
5d57f38619 + functions for FMA and AVX2 detection
git-svn-id: trunk@27202 -
2014-03-20 15:47:51 +00:00
sergei
4952754184 - i386 and x86_64 no longer use any softfloat stuff.
git-svn-id: trunk@27182 -
2014-03-19 12:14:44 +00:00
sergei
0255eb880e - Removed mathuh.inc files which are identical for all targets (except m68k, see below), their contents moved into math.pp.
+ m68k/mathu.inc: added stub implementations for missing functions.

git-svn-id: trunk@27180 -
2014-03-18 20:01:15 +00:00
sergei
6baba5065c * i386: Perform all CPU-related initialization in fpc_cpucodeinit, instead of having it scattered between fpc_cpuinit,fpc_cpucodeinit and check_sse_support. Simplifies things quite a bit.
- check_sse_support and mmx_support are no longer needed, removed.

git-svn-id: trunk@27169 -
2014-03-16 22:20:39 +00:00
sergei
a9b0a92873 * cpuid_support: translated to ATT syntax and optimized a bit.
git-svn-id: trunk@27168 -
2014-03-16 22:05:04 +00:00
sergei
78e726b34f * i386: Somewhat optimized fpc_mul_qword routine, got rid from variable 'r', registers esi and edi. Also ignore overflow checking when both operands have their high dwords equal to zero, because in such case multiplication cannot overflow.
git-svn-id: trunk@26511 -
2014-01-18 19:28:00 +00:00
nickysn
4eb9043ac7 * x87 optimized version of math.log2() for i8086, i386 and x86_64
git-svn-id: trunk@26266 -
2013-12-22 23:21:41 +00:00
sergei
74f9d719f1 * i386-win32 setjmp and longjmp: if SEH support is enabled, save/restore head of exception registration chain. Without this, a longjmp out of a function with exception frame(s) will leave these exception frames below ESP, which will fail integrity checks in OS and cause process termination if an exception occurs later on (or they may be overwritten by subsequent operations on stack and, again, cause undesired results).
* Additionally, use a branchless sequence to fix up result of longjmp.

git-svn-id: trunk@26238 -
2013-12-16 10:12:36 +00:00
nickysn
4b3bf874df * Added CLDs in the RTL i386 inline asm routines, wrapped in {$ifdef
FPC_ENABLED_CLD}.

git-svn-id: trunk@25606 -
2013-09-29 10:53:49 +00:00
nickysn
e4b05477e1 * put the cld instructions behind {$ifdef FPC_ENABLED_CLD} in i386/strings*.inc
* strupper and strlower were missing a cld, so it was added to them as well.

git-svn-id: trunk@25591 -
2013-09-28 12:06:47 +00:00
florian
bb397e2b2f + has_sse2_support for i386
+ has_sse3_support for i386

git-svn-id: trunk@25287 -
2013-08-18 18:54:56 +00:00
sergei
30a6432a17 + Assembler implementation of SarInt64 for i386.
git-svn-id: trunk@25037 -
2013-07-04 09:43:30 +00:00
sergei
97152cc41b * Fixed overflow handling in i386 assembler implementations of fpc_div_qword and fpc_mod_qword.
Resolves #23963.

git-svn-id: trunk@24362 -
2013-04-29 01:12:45 +00:00
sergei
c0f49951b1 * Fixed i386 longjmp, it must not return 0 if 'value' argument happens to be 0.
git-svn-id: trunk@22781 -
2012-10-19 19:49:33 +00:00
florian
c57f463ede + AVXSupport function to detect if the CPU and OS support AVX
git-svn-id: trunk@22641 -
2012-10-14 14:04:27 +00:00
florian
8818b58e5d * Bsf/Bsr on x86 handle now correctly 0 as argument, resolves #22783
* generic Bsf implementations handle now correctly 0 as argument
* test extended

git-svn-id: trunk@22327 -
2012-09-05 13:51:45 +00:00
florian
9be3ca04ad * split FPC_HAS_INTERNAL_BSX_* defines into FPC_HAS_INTERNAL_BSF_* and FPC_HAS_INTERNAL_BSR_*
git-svn-id: trunk@22308 -
2012-09-04 12:56:18 +00:00
florian
1da4c0c3ce * SinCos overloads added, resolves #22663
git-svn-id: trunk@22139 -
2012-08-19 22:09:03 +00:00
florian
a5754ed02b * more robust get_caller_frame and get_caller_addr for win32 which has always a valid StackTop value
git-svn-id: trunk@21919 -
2012-07-15 21:36:06 +00:00
pierre
f340ef87e3 * get_addr function renamed to get_pc_addr
+ get_caller_stackinfo procedure added.

git-svn-id: trunk@21707 -
2012-06-25 22:17:49 +00:00
pierre
8469741700 + Added additional addr pointer parameter to
get_caller_frame, get_caller_addr and dump_stack
  with default NIL value to systemh.inc.
  + Added new get_addr function.
  system.inc: Use get_addr and get_frame to call
  HandleErrorAddrFrame instead of HandleErrorFrame
  in several error functions.
  Modify dump_stack to use frame and addr parameters.
  Provide a dummy get_addr function returning nil.
  i386/i386.inc, x86_64./x86_64.inc: Provide real
  implementation of get_addr function.

git-svn-id: trunk@21697 -
2012-06-24 21:22:09 +00:00
sergei
6874aa9676 * Replaced i386 assembler IndexByte by more sophisticated implementation, larger in size but faster by factor from 2 (on Athlon X2 L310) to 5 (on Core2Duo E7200) for 512 byte buffers.
git-svn-id: trunk@20188 -
2012-01-28 17:54:36 +00:00
sergei
b9b960ebcf * fpc_pchar_length: fixed exit without restoring EDI register if argument is nil, bug #21135.
git-svn-id: trunk@20156 -
2012-01-22 23:52:46 +00:00
sergei
06192a8137 Values of managed variables are never ever used after decrementing reference on the variable, so there is no point of having a 'decrement reference' as a separate operation. We can always do 'finalize', i.e. clear the contents after decref.
* Modified fpc_ansistr_decr_ref and fpc_widestr_decr_ref so they always zero the pointer passed by reference. Other _decr_ref helpers already do it.
- Removed tcg.g_decrrefcount, calling cg.g_finalize instead.
- finalize_data_node and tcg.g_finalize: removed code generation for zeroing locations, because it is now done by RTL helpers. This further reduces code size.

As a total result of this change and r20118, the size of Lazarus executable is reduced by about 12%.

git-svn-id: trunk@20119 -
2012-01-19 23:11:09 +00:00
sergei
009ee271ec - Cleaned out STR_CONCAT_PROCS define
- i386-specific fpc_shortstr_append_shortstr removed too, because a) it was anyway disabled with STR_CONCAT_PROCS, b) the generic implementation is smaller and probably faster due to optimized Move().

git-svn-id: trunk@19867 -
2011-12-17 17:22:18 +00:00
sergei
724f41a9af - Cleaned out FPC_STRTOSHORTSTRPROC and FPC_STRTOCHARARRAYPROC defines. Somebody had to do it one day.
git-svn-id: trunk@19851 -
2011-12-14 22:40:08 +00:00
Jonas Maebe
c7b83717cb - removed stray "overload" modifiers in the implementation for strcopy and
strlcopy (only existed for generic and i386 versions)

git-svn-id: trunk@19488 -
2011-10-15 11:40:16 +00:00
sergei
b36a930f26 - Cleaned out REGCALL defines
git-svn-id: trunk@19482 -
2011-10-13 17:02:23 +00:00
florian
77c3477b91 * modified patch by LacaK2 to add overloaded versions of string handling routines, which works with WideChar null terminated strings, resolves #19989
git-svn-id: trunk@19337 -
2011-10-03 16:11:46 +00:00
paul
27538f21a4 merge r13489 from cpstrnew branch by florian:
* made tcpstr1 work

git-svn-id: trunk@19086 -
2011-09-17 11:21:00 +00:00
florian
88c2c77319 + is_sse3_cpu, put into cpu unit, so x86-64 and i386 can share source code
git-svn-id: trunk@18785 -
2011-08-20 12:01:48 +00:00