llvm-project/compiler-rt/lib/builtins
Carlo Marcelo Arenas Belón 81f5c6270c [compiler-rt] Implement __clear_cache on FreeBSD/powerpc
dd9173420f (Add clear_cache implementation for ppc64. Fix buffer to
meet ppc64 alignment., 2017-07-28), adds an implementation for
__builtin___clear_cache on powerpc64, which was promptly ammended to
also be used with big endian mode in f67036b62c (This ppc64 implementation
of clear_cache works for both big and little endian., 2017-08-02)

clang will use this implementation for it's builtin on FreeBSD and result
in an abort() in the cases where 32-bit generation was requested (ex in
macppc or when the big endian powerpc64 build was done with "-m32") and as
reported[1] recently with pcre2, but there is no reason why the same code
couldn't be used in those cases, so use instead the more generic identifier
for the PowerPC architecture.

While at it, update the comment to reflect that POWER8/9 have a 128 byte
wide cache line and so the code could instead use 64 byte windows instead
but that possible optimization has been punted for now.

[1] https://github.com/PhilipHazel/pcre2/issues/92

Reviewed By: jhibbits, #powerpc, MaskRay

Differential Revision: https://reviews.llvm.org/D122640
2022-03-31 14:19:26 +00:00
..
Darwin-excludes [macOS] stop generating the libclang_rt.10.4.a library for macOS 10.4 2018-08-08 17:29:55 +00:00
aarch64 [builtins] Avoid enum name conflicts with fenv.h 2021-04-09 18:48:49 +01:00
arm [builtins] Do not force thumb mode directive in arm/sync-ops.h 2022-03-11 16:25:49 -08:00
hexagon [compiler-rt][Hexagon] Remove fma/fmin/max code 2020-07-07 19:50:04 -05:00
i386 [builtins] Avoid enum name conflicts with fenv.h 2021-04-09 18:48:49 +01:00
macho_embedded Compiler-rt: build fp_mode.c for macho_embedded variants too. 2022-02-16 13:37:24 +00:00
ppc [AIX][compiler-rt] Build and install standalone libatomic 2021-05-16 05:04:08 +00:00
riscv [RISCV][compiler-rt] Fix an incorrect comment for RV64 __riscv_restore_12 2021-09-15 15:25:59 +01:00
ve [VE] Dynamic stack allocation 2020-05-27 10:11:06 +02:00
x86_64 [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
CMakeLists.txt [AIX][cmake][NFC] Customize name of output atomic library 2022-02-28 02:31:56 +00:00
README.txt [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
absvdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
absvsi2.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
absvti2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
adddf3.c Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3"" 2019-09-05 01:05:05 +00:00
addsf3.c Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3"" 2019-09-05 01:05:05 +00:00
addtf3.c compiler-rt: use fp_t instead of long double, for consistency 2019-09-09 13:50:20 +00:00
addvdi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
addvsi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
addvti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
apple_versioning.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
ashldi3.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
ashlti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
ashrdi3.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
ashrti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
assembly.h [builtins] Use mcr for dmb instruction on armv6 2022-03-10 19:30:00 -08:00
atomic.c [clang][compiler-rt][atomics] Add `__c11_atomic_fetch_nand` builtin and support `__atomic_fetch_nand` libcall 2021-10-28 02:18:43 +00:00
atomic_flag_clear.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
atomic_flag_clear_explicit.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
atomic_flag_test_and_set.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
atomic_flag_test_and_set_explicit.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
atomic_signal_fence.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
atomic_thread_fence.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
bswapdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
bswapsi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
clear_cache.c [compiler-rt] Implement __clear_cache on FreeBSD/powerpc 2022-03-31 14:19:26 +00:00
clzdi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
clzsi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
clzti2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
cmpdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
cmpti2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
comparedf2.c [builtins] Fix ABI-incompatibility with GCC for floating-point compare 2021-04-28 12:19:19 +01:00
comparesf2.c [builtins] Fix ABI-incompatibility with GCC for floating-point compare 2021-04-28 12:19:19 +01:00
comparetf2.c [builtins] Fix ABI-incompatibility with GCC for floating-point compare 2021-04-28 12:19:19 +01:00
cpu_model.c [compiler-rt][AArch64] Initialize __aarch64_have_lse_atomics for Fuchsia 2022-03-28 11:49:31 -07:00
ctzdi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
ctzsi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
ctzti2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
divdc3.c Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
divdf3.c [builtins] Unify the softfloat division implementation 2020-09-01 19:05:50 +03:00
divdi3.c [NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations 2020-08-30 16:14:08 +03:00
divmoddi4.c [builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and multiply. 2020-09-10 08:08:55 -07:00
divmodsi4.c [builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and multiply. 2020-09-10 08:08:55 -07:00
divmodti4.c Add __divmodti4 to match libgcc. 2020-09-16 21:56:01 -07:00
divsc3.c Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
divsf3.c [builtins] Unify the softfloat division implementation 2020-09-01 19:05:50 +03:00
divsi3.c [NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations 2020-08-30 16:14:08 +03:00
divtc3.c Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
divtf3.c [builtins] Unify the softfloat division implementation 2020-09-01 19:05:50 +03:00
divti3.c [NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations 2020-08-30 16:14:08 +03:00
divxc3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
emutls.c [compiler-rt] Silence warnings when building with MSVC 2022-01-11 10:36:57 -05:00
enable_execute_stack.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
eprintf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
extenddftf2.c compiler-rt: use fp_t instead of long double, for consistency 2019-09-09 13:50:20 +00:00
extendhfsf2.c [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available 2020-12-03 16:08:55 -03:00
extendhftf2.c [compiler-rt] [builtins] Support conversion between fp16 and fp128 2020-12-08 11:51:55 -03:00
extendsfdf2.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
extendsftf2.c compiler-rt: use fp_t instead of long double, for consistency 2019-09-09 13:50:20 +00:00
ffsdi2.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
ffssi2.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
ffsti2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
fixdfdi.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
fixdfsi.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
fixdfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixsfdi.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
fixsfsi.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
fixsfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixtfdi.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixtfsi.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixtfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunsdfdi.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
fixunsdfsi.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
fixunsdfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunssfdi.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
fixunssfsi.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
fixunssfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunstfdi.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunstfsi.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunstfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixunsxfdi.c [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
fixunsxfsi.c [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
fixunsxfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fixxfdi.c [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
fixxfti.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatdidf.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
floatdisf.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
floatditf.c [builtins] Reformat builtins with clang-format 2019-04-28 21:53:32 +00:00
floatdixf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatsidf.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
floatsisf.c [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
floatsitf.c [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
floattidf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floattisf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floattitf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floattixf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatundidf.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
floatundisf.c [builtins] Move Windows/ARM frontends for fix/float functions into the individual source files 2021-08-20 09:13:32 +03:00
floatunditf.c [builtins] Reformat builtins with clang-format 2019-04-28 21:53:32 +00:00
floatundixf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatunsidf.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
floatunsisf.c [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
floatunsitf.c [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
floatuntidf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatuntisf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatuntitf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
floatuntixf.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
fp_add_impl.inc [builtins] Avoid enum name conflicts with fenv.h 2021-04-09 18:48:49 +01:00
fp_compare_impl.inc [builtins] Fix ABI-incompatibility with GCC for floating-point compare 2021-04-28 12:19:19 +01:00
fp_div_impl.inc [builtins] Make __div[sdt]f3 handle denormal results 2020-09-01 21:52:34 +03:00
fp_extend.h [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
fp_extend_impl.inc [NFC][compiler-rt][builtins] Tidy and match comments for floating point operations 2019-05-09 22:48:30 +00:00
fp_fixint_impl.inc [NFC][compiler-rt][builtins] Tidy and match comments for floating point operations 2019-05-09 22:48:30 +00:00
fp_fixuint_impl.inc [NFC][compiler-rt][builtins] Tidy and match comments for floating point operations 2019-05-09 22:48:30 +00:00
fp_lib.h Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
fp_mode.c [builtins] Avoid enum name conflicts with fenv.h 2021-04-09 18:48:49 +01:00
fp_mode.h [NFC] Fix endif comments to match with include guard 2022-01-07 15:52:59 +08:00
fp_mul_impl.inc [NFC][compiler-rt][builtins] Tidy and match comments for floating point operations 2019-05-09 22:48:30 +00:00
fp_trunc.h [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available 2020-12-03 16:08:55 -03:00
fp_trunc_impl.inc Fix int to bool errors exposed due to r372612. 2019-09-24 02:59:02 +00:00
gcc_personality_v0.c [compiler-rt] [builtins] Provide a SEH specific __gcc_personality_seh0 2021-05-18 23:52:33 +03:00
int_div_impl.inc Fix PR47973: Addressing integer division edge case with INT_MIN 2020-11-10 15:57:06 +00:00
int_endianness.h [compiler-rt] Remove mentions of AuroraUX in code comments and docs. 2022-03-21 22:05:58 +01:00
int_lib.h Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
int_math.h Reland "[builtins] Define fmax and scalbn inline" 2021-02-26 16:20:14 -08:00
int_mulo_impl.inc [NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file 2020-08-27 14:33:48 +03:00
int_mulv_impl.inc [NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file 2020-08-27 14:33:48 +03:00
int_types.h [compiler-rt] Support FreeBSD standalone (boot) environment 2021-01-27 15:29:39 +00:00
int_util.c Fix Windows builders after 244601f472 2021-06-15 09:47:29 +01:00
int_util.h [builtins] Unify the softfloat division implementation 2020-09-01 19:05:50 +03:00
lshrdi3.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
lshrti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
moddi3.c [NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations 2020-08-30 16:14:08 +03:00
modsi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
modti3.c [NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations 2020-08-30 16:14:08 +03:00
muldc3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
muldf3.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
muldi3.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
mulodi4.c [NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file 2020-08-27 14:33:48 +03:00
mulosi4.c [NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file 2020-08-27 14:33:48 +03:00
muloti4.c [NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file 2020-08-27 14:33:48 +03:00
mulsc3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
mulsf3.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
multc3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
multf3.c [builtins] Reformat builtins with clang-format 2019-04-28 21:53:32 +00:00
multi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
mulvdi3.c [NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file 2020-08-27 14:33:48 +03:00
mulvsi3.c [NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file 2020-08-27 14:33:48 +03:00
mulvti3.c [NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file 2020-08-27 14:33:48 +03:00
mulxc3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
negdf2.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
negdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
negsf2.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
negti2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
negvdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
negvsi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
negvti2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
os_version_check.c [darwin] add support for __isPlatformVersionAtLeast check for if (@available) 2020-11-02 16:28:09 -08:00
paritydi2.c [builtins] Inline __paritysi2 into __paritydi2 and inline __paritydi2 into __parityti2. 2020-09-07 17:57:39 -07:00
paritysi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
parityti2.c [builtins] Inline __paritysi2 into __paritydi2 and inline __paritydi2 into __parityti2. 2020-09-07 17:57:39 -07:00
popcountdi2.c [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
popcountsi2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
popcountti2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
powidf2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
powisf2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
powitf2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
powixf2.c [builtins] Change si_int to int in some helper declarations 2020-06-30 11:07:02 +03:00
subdf3.c Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3"" 2019-09-05 01:05:05 +00:00
subsf3.c Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3"" 2019-09-05 01:05:05 +00:00
subtf3.c Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3"" 2019-09-05 01:05:05 +00:00
subvdi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
subvsi3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
subvti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
trampoline_setup.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
truncdfhf2.c [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available 2020-12-03 16:08:55 -03:00
truncdfsf2.c [builtins] Use aliases for function redirects 2019-04-29 00:46:23 +00:00
truncsfhf2.c [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available 2020-12-03 16:08:55 -03:00
trunctfdf2.c [builtins] Reformat builtins with clang-format 2019-04-28 21:53:32 +00:00
trunctfhf2.c [compiler-rt] [builtins] Support conversion between fp16 and fp128 2020-12-08 11:51:55 -03:00
trunctfsf2.c [builtins] Reformat builtins with clang-format 2019-04-28 21:53:32 +00:00
ucmpdi2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
ucmpti2.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
udivdi3.c [builtins] Make __umodsi3/__udivdi3/__umoddi3 standalone (shift and subtract) 2020-04-14 10:38:37 -07:00
udivmoddi4.c [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z 2022-01-30 23:04:07 +03:00
udivmodsi4.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
udivmodti4.c [builtins] Optimize udivmodti4 for many platforms. 2020-07-10 09:59:16 +02:00
udivsi3.c [builtins] Make __umodsi3/__udivdi3/__umoddi3 standalone (shift and subtract) 2020-04-14 10:38:37 -07:00
udivti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
umoddi3.c [builtins] Make __umodsi3/__udivdi3/__umoddi3 standalone (shift and subtract) 2020-04-14 10:38:37 -07:00
umodsi3.c [builtins] Make __umodsi3/__udivdi3/__umoddi3 standalone (shift and subtract) 2020-04-14 10:38:37 -07:00
umodti3.c [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00
unwind-ehabi-helpers.h [builtins] Use single line C++/C99 comment style 2019-04-28 22:47:49 +00:00

README.txt

Compiler-RT
================================

This directory and its subdirectories contain source code for the compiler
support routines.

Compiler-RT is open source software. You may freely distribute it under the
terms of the license agreement found in LICENSE.txt.

================================

This is a replacement library for libgcc.  Each function is contained
in its own file.  Each function has a corresponding unit test under
test/Unit.

A rudimentary script to test each file is in the file called
test/Unit/test.

Here is the specification for this library:

http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc

Please note that the libgcc specification explicitly mentions actual types of
arguments and returned values being expressed with machine modes.
In some cases particular types such as "int", "unsigned", "long long", etc.
may be specified just as examples there.

Here is a synopsis of the contents of this library:

typedef  int32_t si_int;
typedef uint32_t su_int;

typedef  int64_t di_int;
typedef uint64_t du_int;

// Integral bit manipulation

di_int __ashldi3(di_int a, si_int b);      // a << b
ti_int __ashlti3(ti_int a, si_int b);      // a << b

di_int __ashrdi3(di_int a, si_int b);      // a >> b  arithmetic (sign fill)
ti_int __ashrti3(ti_int a, si_int b);      // a >> b  arithmetic (sign fill)
di_int __lshrdi3(di_int a, si_int b);      // a >> b  logical    (zero fill)
ti_int __lshrti3(ti_int a, si_int b);      // a >> b  logical    (zero fill)

int __clzsi2(si_int a);  // count leading zeros
int __clzdi2(di_int a);  // count leading zeros
int __clzti2(ti_int a);  // count leading zeros
int __ctzsi2(si_int a);  // count trailing zeros
int __ctzdi2(di_int a);  // count trailing zeros
int __ctzti2(ti_int a);  // count trailing zeros

int __ffssi2(si_int a);  // find least significant 1 bit
int __ffsdi2(di_int a);  // find least significant 1 bit
int __ffsti2(ti_int a);  // find least significant 1 bit

int __paritysi2(si_int a);  // bit parity
int __paritydi2(di_int a);  // bit parity
int __parityti2(ti_int a);  // bit parity

int __popcountsi2(si_int a);  // bit population
int __popcountdi2(di_int a);  // bit population
int __popcountti2(ti_int a);  // bit population

uint32_t __bswapsi2(uint32_t a);   // a byteswapped
uint64_t __bswapdi2(uint64_t a);   // a byteswapped

// Integral arithmetic

di_int __negdi2    (di_int a);                         // -a
ti_int __negti2    (ti_int a);                         // -a
di_int __muldi3    (di_int a, di_int b);               // a * b
ti_int __multi3    (ti_int a, ti_int b);               // a * b
si_int __divsi3    (si_int a, si_int b);               // a / b   signed
di_int __divdi3    (di_int a, di_int b);               // a / b   signed
ti_int __divti3    (ti_int a, ti_int b);               // a / b   signed
su_int __udivsi3   (su_int n, su_int d);               // a / b   unsigned
du_int __udivdi3   (du_int a, du_int b);               // a / b   unsigned
tu_int __udivti3   (tu_int a, tu_int b);               // a / b   unsigned
si_int __modsi3    (si_int a, si_int b);               // a % b   signed
di_int __moddi3    (di_int a, di_int b);               // a % b   signed
ti_int __modti3    (ti_int a, ti_int b);               // a % b   signed
su_int __umodsi3   (su_int a, su_int b);               // a % b   unsigned
du_int __umoddi3   (du_int a, du_int b);               // a % b   unsigned
tu_int __umodti3   (tu_int a, tu_int b);               // a % b   unsigned
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);  // a / b, *rem = a % b  unsigned
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);  // a / b, *rem = a % b  unsigned
su_int __udivmodsi4(su_int a, su_int b, su_int* rem);  // a / b, *rem = a % b  unsigned
si_int __divmodsi4(si_int a, si_int b, si_int* rem);   // a / b, *rem = a % b  signed
di_int __divmoddi4(di_int a, di_int b, di_int* rem);   // a / b, *rem = a % b  signed
ti_int __divmodti4(ti_int a, ti_int b, ti_int* rem);   // a / b, *rem = a % b  signed



//  Integral arithmetic with trapping overflow

si_int __absvsi2(si_int a);           // abs(a)
di_int __absvdi2(di_int a);           // abs(a)
ti_int __absvti2(ti_int a);           // abs(a)

si_int __negvsi2(si_int a);           // -a
di_int __negvdi2(di_int a);           // -a
ti_int __negvti2(ti_int a);           // -a

si_int __addvsi3(si_int a, si_int b);  // a + b
di_int __addvdi3(di_int a, di_int b);  // a + b
ti_int __addvti3(ti_int a, ti_int b);  // a + b

si_int __subvsi3(si_int a, si_int b);  // a - b
di_int __subvdi3(di_int a, di_int b);  // a - b
ti_int __subvti3(ti_int a, ti_int b);  // a - b

si_int __mulvsi3(si_int a, si_int b);  // a * b
di_int __mulvdi3(di_int a, di_int b);  // a * b
ti_int __mulvti3(ti_int a, ti_int b);  // a * b


// Integral arithmetic which returns if overflow

si_int __mulosi4(si_int a, si_int b, int* overflow);  // a * b, overflow set to one if result not in signed range
di_int __mulodi4(di_int a, di_int b, int* overflow);  // a * b, overflow set to one if result not in signed range
ti_int __muloti4(ti_int a, ti_int b, int* overflow);  // a * b, overflow set to
 one if result not in signed range


//  Integral comparison: a  < b -> 0
//                       a == b -> 1
//                       a  > b -> 2

si_int __cmpdi2 (di_int a, di_int b);
si_int __cmpti2 (ti_int a, ti_int b);
si_int __ucmpdi2(du_int a, du_int b);
si_int __ucmpti2(tu_int a, tu_int b);

//  Integral / floating point conversion

di_int __fixsfdi(      float a);
di_int __fixdfdi(     double a);
di_int __fixxfdi(long double a);

ti_int __fixsfti(      float a);
ti_int __fixdfti(     double a);
ti_int __fixxfti(long double a);
uint64_t __fixtfdi(long double input);  // ppc only, doesn't match documentation

su_int __fixunssfsi(      float a);
su_int __fixunsdfsi(     double a);
su_int __fixunsxfsi(long double a);

du_int __fixunssfdi(      float a);
du_int __fixunsdfdi(     double a);
du_int __fixunsxfdi(long double a);

tu_int __fixunssfti(      float a);
tu_int __fixunsdfti(     double a);
tu_int __fixunsxfti(long double a);
uint64_t __fixunstfdi(long double input);  // ppc only

float       __floatdisf(di_int a);
double      __floatdidf(di_int a);
long double __floatdixf(di_int a);
long double __floatditf(int64_t a);        // ppc only

float       __floattisf(ti_int a);
double      __floattidf(ti_int a);
long double __floattixf(ti_int a);

float       __floatundisf(du_int a);
double      __floatundidf(du_int a);
long double __floatundixf(du_int a);
long double __floatunditf(uint64_t a);     // ppc only

float       __floatuntisf(tu_int a);
double      __floatuntidf(tu_int a);
long double __floatuntixf(tu_int a);

//  Floating point raised to integer power

float       __powisf2(      float a, int b);  // a ^ b
double      __powidf2(     double a, int b);  // a ^ b
long double __powixf2(long double a, int b);  // a ^ b
long double __powitf2(long double a, int b);  // ppc only, a ^ b

//  Complex arithmetic

//  (a + ib) * (c + id)

      float _Complex __mulsc3( float a,  float b,  float c,  float d);
     double _Complex __muldc3(double a, double b, double c, double d);
long double _Complex __mulxc3(long double a, long double b,
                              long double c, long double d);
long double _Complex __multc3(long double a, long double b,
                              long double c, long double d); // ppc only

//  (a + ib) / (c + id)

      float _Complex __divsc3( float a,  float b,  float c,  float d);
     double _Complex __divdc3(double a, double b, double c, double d);
long double _Complex __divxc3(long double a, long double b,
                              long double c, long double d);
long double _Complex __divtc3(long double a, long double b,
                              long double c, long double d);  // ppc only


//         Runtime support

// __clear_cache() is used to tell process that new instructions have been
// written to an address range.  Necessary on processors that do not have
// a unified instruction and data cache.
void __clear_cache(void* start, void* end);

// __enable_execute_stack() is used with nested functions when a trampoline
// function is written onto the stack and that page range needs to be made
// executable.
void __enable_execute_stack(void* addr);

// __gcc_personality_v0() is normally only called by the system unwinder.
// C code (as opposed to C++) normally does not need a personality function
// because there are no catch clauses or destructors to be run.  But there
// is a C language extension __attribute__((cleanup(func))) which marks local
// variables as needing the cleanup function "func" to be run when the
// variable goes out of scope.  That includes when an exception is thrown,
// so a personality handler is needed.  
_Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
         uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
         _Unwind_Context_t context);

// for use with some implementations of assert() in <assert.h>
void __eprintf(const char* format, const char* assertion_expression,
				const char* line, const char* file);

// for systems with emulated thread local storage
void* __emutls_get_address(struct __emutls_control*);


//   Power PC specific functions

// There is no C interface to the saveFP/restFP functions.  They are helper
// functions called by the prolog and epilog of functions that need to save
// a number of non-volatile float point registers.  
saveFP
restFP

// PowerPC has a standard template for trampoline functions.  This function
// generates a custom trampoline function with the specific realFunc
// and localsPtr values.
void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated, 
                                const void* realFunc, void* localsPtr);

// adds two 128-bit double-double precision values ( x + y )
long double __gcc_qadd(long double x, long double y);  

// subtracts two 128-bit double-double precision values ( x - y )
long double __gcc_qsub(long double x, long double y); 

// multiples two 128-bit double-double precision values ( x * y )
long double __gcc_qmul(long double x, long double y);  

// divides two 128-bit double-double precision values ( x / y )
long double __gcc_qdiv(long double a, long double b);  


//    ARM specific functions

// There is no C interface to the switch* functions.  These helper functions
// are only needed by Thumb1 code for efficient switch table generation.
switch16
switch32
switch8
switchu8

// There is no C interface to the *_vfp_d8_d15_regs functions.  There are
// called in the prolog and epilog of Thumb1 functions.  When the C++ ABI use
// SJLJ for exceptions, each function with a catch clause or destructors needs
// to save and restore all registers in it prolog and epilog.  But there is
// no way to access vector and high float registers from thumb1 code, so the 
// compiler must add call outs to these helper functions in the prolog and 
// epilog.
restore_vfp_d8_d15_regs
save_vfp_d8_d15_regs


// Note: long ago ARM processors did not have floating point hardware support.
// Floating point was done in software and floating point parameters were 
// passed in integer registers.  When hardware support was added for floating
// point, new *vfp functions were added to do the same operations but with 
// floating point parameters in floating point registers.

// Undocumented functions

float  __addsf3vfp(float a, float b);   // Appears to return a + b
double __adddf3vfp(double a, double b); // Appears to return a + b
float  __divsf3vfp(float a, float b);   // Appears to return a / b
double __divdf3vfp(double a, double b); // Appears to return a / b
int    __eqsf2vfp(float a, float b);    // Appears to return  one
                                        //     iff a == b and neither is NaN.
int    __eqdf2vfp(double a, double b);  // Appears to return  one
                                        //     iff a == b and neither is NaN.
double __extendsfdf2vfp(float a);       // Appears to convert from
                                        //     float to double.
int    __fixdfsivfp(double a);          // Appears to convert from
                                        //     double to int.
int    __fixsfsivfp(float a);           // Appears to convert from
                                        //     float to int.
unsigned int __fixunssfsivfp(float a);  // Appears to convert from
                                        //     float to unsigned int.
unsigned int __fixunsdfsivfp(double a); // Appears to convert from
                                        //     double to unsigned int.
double __floatsidfvfp(int a);           // Appears to convert from
                                        //     int to double.
float __floatsisfvfp(int a);            // Appears to convert from
                                        //     int to float.
double __floatunssidfvfp(unsigned int a); // Appears to convert from
                                        //     unsigned int to double.
float __floatunssisfvfp(unsigned int a); // Appears to convert from
                                        //     unsigned int to float.
int __gedf2vfp(double a, double b);     // Appears to return __gedf2
                                        //     (a >= b)
int __gesf2vfp(float a, float b);       // Appears to return __gesf2
                                        //     (a >= b)
int __gtdf2vfp(double a, double b);     // Appears to return __gtdf2
                                        //     (a > b)
int __gtsf2vfp(float a, float b);       // Appears to return __gtsf2
                                        //     (a > b)
int __ledf2vfp(double a, double b);     // Appears to return __ledf2
                                        //     (a <= b)
int __lesf2vfp(float a, float b);       // Appears to return __lesf2
                                        //     (a <= b)
int __ltdf2vfp(double a, double b);     // Appears to return __ltdf2
                                        //     (a < b)
int __ltsf2vfp(float a, float b);       // Appears to return __ltsf2
                                        //     (a < b)
double __muldf3vfp(double a, double b); // Appears to return a * b
float __mulsf3vfp(float a, float b);    // Appears to return a * b
int __nedf2vfp(double a, double b);     // Appears to return __nedf2
                                        //     (a != b)
double __negdf2vfp(double a);           // Appears to return -a
float __negsf2vfp(float a);             // Appears to return -a
float __negsf2vfp(float a);             // Appears to return -a
double __subdf3vfp(double a, double b); // Appears to return a - b
float __subsf3vfp(float a, float b);    // Appears to return a - b
float __truncdfsf2vfp(double a);        // Appears to convert from
                                        //     double to float.
int __unorddf2vfp(double a, double b);  // Appears to return __unorddf2
int __unordsf2vfp(float a, float b);    // Appears to return __unordsf2


Preconditions are listed for each function at the definition when there are any.
Any preconditions reflect the specification at
http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc.

Assumptions are listed in "int_lib.h", and in individual files.  Where possible
assumptions are checked at compile time.