zig/lib/compiler_rt
Andrew Kelley 2a96209c40
Merge pull request #12574 from Vexu/remove-bit-op-type-param
stage2+stage1: remove type parameter from bit builtins
2022-08-24 15:57:44 -04:00
..
absv.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
absvdi2_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
absvdi2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
absvsi2_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
absvsi2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
absvti2_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
absvti2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
adddf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
addf3_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
addf3.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
addo.zig compiler_rt: compile each unit separately for improved archiving 2022-06-17 16:38:59 -07:00
addodi4_test.zig
addosi4_test.zig
addoti4_test.zig
addsf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
addtf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
addxf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
arm.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
ashldi3_test.zig
ashlti3_test.zig
ashrdi3_test.zig
ashrti3_test.zig
atomics.zig compiler_rt: compile each unit separately for improved archiving 2022-06-17 16:38:59 -07:00
aulldiv.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
aullrem.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
bswap.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
bswapdi2_test.zig
bswapsi2_test.zig
bswapti2_test.zig
ceil.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
clear_cache.zig compiler_rt: enable __clear_cache for stage2 2022-07-07 20:47:43 -07:00
clzdi2_test.zig
clzsi2_test.zig
clzti2_test.zig
cmp.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
cmpdf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
cmpdi2_test.zig
cmpsf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
cmpsi2_test.zig
cmptf2.zig compiler-rt: move SPARC functions into appropriate compilation units 2022-06-17 16:38:59 -07:00
cmpti2_test.zig
cmpxf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
common.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
comparedf2_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
comparef.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
comparesf2_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
cos.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
count0bits.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
ctzdi2_test.zig
ctzsi2_test.zig
ctzti2_test.zig
divdf3_test.zig
divdf3.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
divsf3_test.zig
divsf3.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
divtf3_test.zig
divtf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
divti3_test.zig
divti3.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
divxf3_test.zig
divxf3.zig skip failing compiler-rt divxf3 tests on Windows 2022-08-23 22:59:11 +02:00
emutls.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
exp.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
exp2.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
extenddftf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
extenddfxf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
extendf_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
extendf.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
extendhfsf2.zig compiler-rt: fix logic for choosing __gnu_{f2h,h2f}_ieee 2022-06-17 20:25:17 -07:00
extendhftf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
extendhfxf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
extendsfdf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
extendsftf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
extendsfxf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
extendxftf2.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
fabs.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
ffsdi2_test.zig
ffssi2_test.zig
ffsti2_test.zig
fixdfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixdfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixdfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixhfdi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixhfsi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixhfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixint_test.zig
fixsfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixsfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixsfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixtfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixtfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixtfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixunsdfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunsdfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunsdfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixunshfdi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixunshfsi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixunshfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixunssfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunssfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunssfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixunstfdi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunstfsi.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
fixunstfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixunsxfdi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixunsxfsi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixunsxfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
fixxfdi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixxfsi.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
fixxfti.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
float_to_int_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
float_to_int.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatdidf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatdihf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatdisf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatditf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatdixf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatsidf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatsihf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatsisf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatsitf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatsixf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floattidf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floattihf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floattisf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floattitf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floattixf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floatundidf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatundihf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatundisf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatunditf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatundixf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatunsidf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatunsihf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatunsisf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatunsitf.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
floatunsixf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
floatuntidf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floatuntihf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floatuntisf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floatuntitf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floatuntixf.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
floor.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
fma.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
fmax.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
fmin.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
fmod.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
fmodq_test.zig
fmodx_test.zig
gedf2.zig compiler-rt: gedf2 and gesf2 2022-06-17 16:40:25 -07:00
gesf2.zig compiler-rt: gedf2 and gesf2 2022-06-17 16:40:25 -07:00
getf2.zig compiler-rt: move SPARC functions into appropriate compilation units 2022-06-17 16:38:59 -07:00
gexf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
int_to_float_test.zig stage2: implement @setFloatMode 2022-07-23 15:40:12 +03:00
int_to_float.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
int.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
log.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
log2.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
log10.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
lshrdi3_test.zig
lshrti3_test.zig
modti3_test.zig
modti3.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
muldf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
muldi3_test.zig
muldi3.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
mulf3_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
mulf3.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
mulo.zig compiler_rt: work around LLVM optimizing __muloti4 to call itself 2022-07-05 21:28:39 -07:00
mulodi4_test.zig
mulosi4_test.zig
muloti4_test.zig
mulsf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
multf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
multi3_test.zig
multi3.zig Sema: allow void as an extern union field & fix invalid extern unions 2022-07-11 20:30:16 +03:00
mulxf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
negdf2.zig stage2: lower float negation explicitly 2022-06-30 00:02:00 -07:00
negdi2_test.zig
negsf2.zig stage2: lower float negation explicitly 2022-06-30 00:02:00 -07:00
negsi2_test.zig
negtf2.zig stage2: lower float negation explicitly 2022-06-30 00:02:00 -07:00
negti2_test.zig
negv.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
negvdi2_test.zig
negvsi2_test.zig
negvti2_test.zig
negxf2.zig stage2: lower float negation explicitly 2022-06-30 00:02:00 -07:00
negXi2.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
os_version_check.zig compiler_rt: use single cache for libcompiler_rt.a static lib 2022-06-17 16:38:59 -07:00
parity.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
paritydi2_test.zig
paritysi2_test.zig
parityti2_test.zig
popcount.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
popcountdi2_test.zig
popcountsi2_test.zig
popcountti2_test.zig
README.md
rem_pio2_large.zig
rem_pio2.zig
rem_pio2f.zig
round.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
shift.zig Sema: allow void as an extern union field & fix invalid extern unions 2022-07-11 20:30:16 +03:00
sin.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
sincos.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
sqrt.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
stack_probe.zig compiler_rt: compile each unit separately for improved archiving 2022-06-17 16:38:59 -07:00
subdf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
subo.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
subodi4_test.zig
subosi4_test.zig
suboti4_test.zig
subsf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
subtf3.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
subxf3.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
tan.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
trig.zig
trunc.zig compiler-rt: finish cleanups 2022-06-17 18:10:00 -07:00
truncdfhf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
truncdfsf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
truncf_test.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
truncf.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
truncsfhf2.zig compiler-rt: fix logic for choosing __gnu_{f2h,h2f}_ieee 2022-06-17 20:25:17 -07:00
trunctfdf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
trunctfhf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
trunctfsf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
trunctfxf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
truncxfdf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
truncxfhf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
truncxfsf2.zig compiler-rt: break up functions even more 2022-06-17 16:38:59 -07:00
ucmpdi2_test.zig
ucmpsi2_test.zig
ucmpti2_test.zig
udivmod.zig stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
udivmoddi4_test.zig
udivmodti4_test.zig
udivmodti4.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
udivti3.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
umodti3.zig compiler_rt: Slightly re-factor exports for Windows x86-64 2022-07-10 20:51:34 -07:00
unorddf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
unordsf2.zig compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
unordtf2.zig compiler-rt: move SPARC functions into appropriate compilation units 2022-06-17 16:38:59 -07:00

If hardware lacks basic or specialized functionality, compiler-rt adds such functionality for basic arithmetic(s). One such example is 64-bit integer multiplication on 32-bit x86.

Goals:

  1. zig as linker for object files produced by other compilers => function compatibility to compiler-rt and libgcc for same-named functions
    • compatibility conflict between compiler-rt and libgcc: prefer compiler-rt
  2. symbol-level compatibility low-priority compared to emitted calls by llvm
    • symbol-level compatibility: libgcc even lower priority
  3. add zig-specific language runtime features, see #7265
    • example: arbitrary bit width integer arithmetic
    • lower to call those functions for e.g. multiplying two i12345 numbers together
    • proper naming + documention for standardizing (allow languages to follow our exmaple)

Current status (tracking libgcc documentation):

  • Integer library routines => almost implemented
  • Soft float library routines => only f80 routines missing
  • Decimal float library routines => unimplemented (~120 functions)
  • Fixed-point fractional library routines => unimplemented (~300 functions)
  • Exception handling routines => unclear, if supported (~32+x undocumented functions)
  • Miscellaneous routines => unclear, if supported (cache control and stack function)
  • No zig-specific language runtime features in compiler-rt yet

This library is automatically built as-needed for the compilation target and then statically linked and therefore is a transparent dependency for the programmer. For details see ../compiler_rt.zig.

The routines in this folder are listed below. Routines are annotated as type source routine // description, with routine being the name used in aforementioned compiler_rt.zig. dev means deviating from compiler_rt, port ported, source is the information source for the implementation, none means unimplemented. Some examples for the naming convention are:

  • dev source name_routine, name_routine2 various implementations for performance, simplicity etc
  • port llvm compiler-rt library routines from LLVM
    • LLVM emits library calls to compiler-rt, if the hardware lacks functionality
  • port musl libc routines from musl If the library or information source is uncommon, use the entry other for source. Please do not break the search by inserting entries in another format than impl space source.

Bugs should be solved by trying to duplicate the bug upstream, if possible.

  • If the bug exists upstream, get it fixed upstream and port the fix downstream to Zig.
  • If the bug only exists in Zig, use the corresponding C code and debug both implementations side by side to figure out what is wrong.

Integer library routines

Integer Bit operations

  • dev HackersDelight __clzsi2 // count leading zeros
  • dev HackersDelight __clzdi2 // count leading zeros
  • dev HackersDelight __clzti2 // count leading zeros
  • dev HackersDelight __ctzsi2 // count trailing zeros
  • dev HackersDelight __ctzdi2 // count trailing zeros
  • dev HackersDelight __ctzti2 // count trailing zeros
  • dev __ctzsi2 __ffssi2 // find least significant 1 bit
  • dev __ctzsi2 __ffsdi2 // find least significant 1 bit
  • dev __ctzsi2 __ffsti2 // find least significant 1 bit
  • dev BitTwiddlingHacks __paritysi2 // bit parity
  • dev BitTwiddlingHacks __paritydi2 // bit parity
  • dev BitTwiddlingHacks __parityti2 // bit parity
  • dev TAOCP __popcountsi2 // bit population
  • dev TAOCP __popcountdi2 // bit population
  • dev TAOCP __popcountti2 // bit population
  • dev other __bswapsi2 // a byteswapped
  • dev other __bswapdi2 // a byteswapped
  • dev other __bswapti2 // a byteswapped

Integer Comparison

  • port llvm __cmpsi2 // (a<b)=>output=0, (a==b)=>output=1, (a>b)=>output=2
  • port llvm __cmpdi2
  • port llvm __cmpti2
  • port llvm __ucmpsi2 // (a<b)=>output=0, (a==b)=>output=1, (a>b)=>output=2
  • port llvm __ucmpdi2
  • port llvm __ucmpti2

Integer Arithmetic

  • none none __ashlsi3 // a << b unused in llvm, missing (e.g. used by rl78)
  • port llvm __ashldi3 // a << b
  • port llvm __ashlti3 // a << b
  • none none __ashrsi3 // a >> b arithmetic (sign fill) missing (e.g. used by rl78)
  • port llvm __ashrdi3 // a >> b arithmetic (sign fill)
  • port llvm __ashrti3 // a >> b arithmetic (sign fill)
  • none none __lshrsi3 // a >> b logical (zero fill) missing (e.g. used by rl78)
  • port llvm __lshrdi3 // a >> b logical (zero fill)
  • port llvm __lshrti3 // a >> b logical (zero fill)
  • port llvm __negdi2 // -a symbol-level compatibility: libgcc
  • port llvm __negti2 // -a unnecessary: unused in backends
  • port llvm __mulsi3 // a * b signed
  • port llvm __muldi3 // a * b signed
  • port llvm __multi3 // a * b signed
  • port llvm __divsi3 // a / b signed
  • port llvm __divdi3 // a / b signed
  • port llvm __divti3 // a / b signed
  • port llvm __udivsi3 // a / b unsigned
  • port llvm __udivdi3 // a / b unsigned
  • port llvm __udivti3 // a / b unsigned
  • port llvm __modsi3 // a % b signed
  • port llvm __moddi3 // a % b signed
  • port llvm __modti3 // a % b signed
  • port llvm __umodsi3 // a % b unsigned
  • port llvm __umoddi3 // a % b unsigned
  • port llvm __umodti3 // a % b unsigned
  • port llvm __udivmoddi4 // a / b, rem.* = a % b unsigned
  • port llvm __udivmodti4 // a / b, rem.* = a % b unsigned
  • port llvm __udivmodsi4 // a / b, rem.* = a % b unsigned
  • port llvm __divmodsi4 // a / b, rem.* = a % b signed, ARM

Integer Arithmetic with trapping overflow

  • dev BitTwiddlingHacks __absvsi2 // abs(a)
  • dev BitTwiddlingHacks __absvdi2 // abs(a)
  • dev BitTwiddlingHacks __absvti2 // abs(a)
  • port llvm __negvsi2 // -a symbol-level compatibility: libgcc
  • port llvm __negvdi2 // -a unnecessary: unused in backends
  • port llvm __negvti2 // -a
  • TODO upstreaming __addvsi3..__mulvti3 after testing panics works
  • dev HackersDelight __addvsi3 // a + b
  • dev HackersDelight __addvdi3 // a + b
  • dev HackersDelight __addvti3 // a + b
  • dev HackersDelight __subvsi3 // a - b
  • dev HackersDelight __subvdi3 // a - b
  • dev HackersDelight __subvti3 // a - b
  • dev HackersDelight __mulvsi3 // a * b
  • dev HackersDelight __mulvdi3 // a * b
  • dev HackersDelight __mulvti3 // a * b

Integer Arithmetic which returns if overflow (would be faster without pointer)

  • dev HackersDelight __addosi4 // a + b, overflow=>ov.*=1 else 0
  • dev HackersDelight __addodi4 // (completeness + performance, llvm does not use them)
  • dev HackersDelight __addoti4 //
  • dev HackersDelight __subosi4 // a - b, overflow=>ov.*=1 else 0
  • dev HackersDelight __subodi4 // (completeness + performance, llvm does not use them)
  • dev HackersDelight __suboti4 //
  • dev HackersDelight __mulosi4 // a * b, overflow=>ov.*=1 else 0
  • dev HackersDelight __mulodi4 // (required by llvm)
  • dev HackersDelight __muloti4 //

Float library routines

Float Conversion

  • todo todo __extendsfdf2 // extend a f32 => f64

  • todo todo __extendsftf2 // extend a f32 => f128

  • dev llvm __extendsfxf2 // extend a f32 => f80

  • todo todo __extenddftf2 // extend a f64 => f128

  • dev llvm __extenddfxf2 // extend a f64 => f80

  • todo todo __truncdfsf2 // truncate a to narrower mode of return type, rounding towards zero

  • todo todo __trunctfdf2 //

  • todo todo __trunctfsf2 //

  • dev llvm __truncxfsf2 //

  • dev llvm __truncxfdf2 //

  • todo todo __fixsfsi // convert a to i32, rounding towards zero

  • todo todo __fixdfsi //

  • todo todo __fixtfsi //

  • todo todo __fixxfsi //

  • todo todo __fixsfdi // convert a to i64, rounding towards zero

  • todo todo __fixdfdi //

  • todo todo __fixtfdi //

  • todo todo __fixxfdi //

  • todo todo __fixsfti // convert a to i128, rounding towards zero

  • todo todo __fixdfti //

  • todo todo __fixtfdi //

  • todo todo __fixxfti //

  • __fixunssfsi // convert to u32, rounding towards zero. negative values become 0.

  • __fixunsdfsi //

  • __fixunstfsi //

  • __fixunsxfsi //

  • __fixunssfdi // convert to u64, rounding towards zero. negative values become 0.

  • __fixunsdfdi //

  • __fixunstfdi //

  • __fixunsxfdi //

  • __fixunssfti // convert to u128, rounding towards zero. negative values become 0.

  • __fixunsdfti //

  • __fixunstfdi //

  • __fixunsxfti //

  • __floatsisf // convert i32 to floating point

  • __floatsidf //

  • __floatsitf //

  • __floatsixf //

  • __floatdisf // convert i64 to floating point

  • __floatdidf //

  • __floatditf //

  • __floatdixf //

  • __floattisf // convert i128 to floating point

  • __floattidf //

  • __floattixf //

  • __floatunsisf // convert u32 to floating point

  • __floatunsidf //

  • __floatunsitf //

  • __floatunsixf //

  • __floatundisf // convert u64 to floating point

  • __floatundidf //

  • __floatunditf //

  • __floatundixf //

  • __floatuntisf // convert u128 to floating point

  • __floatuntidf //

  • __floatuntitf //

  • __floatuntixf //

Float Comparison

  • __cmpsf2 // return (a<b)=>-1,(a==b)=>0,(a>b)=>1,Nan=>1 dont rely on this
  • __cmpdf2 // exported from __lesf2, __ledf2, __letf2 (below)
  • __cmptf2 //
  • __unordsf2 // (input==NaN) => out!=0 else out=0,
  • __unorddf2 // only reliable for (input!=Nan)
  • __unordtf2 //
  • __eqsf2 // (a!=NaN) and (b!=Nan) and (a==b) => output=0
  • __eqdf2 //
  • __eqtf2 //
  • __nesf2 // (a==NaN) or (b==Nan) or (a!=b) => output!=0
  • __nedf2 //
  • __netf2 //
  • __gesf2 // (a!=Nan) and (b!=Nan) and (a>=b) => output>=0
  • __gedf2 //
  • __getf2 //
  • __ltsf2 // (a!=Nan) and (b!=Nan) and (a<b) => output<0
  • __ltdf2 //
  • __lttf2 //
  • __lesf2 // (a!=Nan) and (b!=Nan) and (a<=b) => output<=0
  • __ledf2 //
  • __letf2 //
  • __gtsf2 // (a!=Nan) and (b!=Nan) and (a>b) => output>0
  • __gtdf2 //
  • __gttf2 //

Float Arithmetic

  • __addsf3 // a + b f32
  • __adddf3 // a + b f64
  • __addtf3 // a + b f128
  • __addxf3 // a + b f80
  • __aeabi_fadd // a + b f64 ARM: AAPCS
  • __aeabi_dadd // a + b f64 ARM: AAPCS
  • __subsf3 // a - b
  • __subdf3 // a - b
  • __subtf3 // a - b
  • __subxf3 // a - b f80
  • __aeabi_fsub // a - b f64 ARM: AAPCS
  • __aeabi_dsub // a - b f64 ARM: AAPCS
  • __mulsf3 // a * b
  • __muldf3 // a * b
  • __multf3 // a * b
  • __mulxf3 // a * b
  • __divsf3 // a / b
  • __divdf3 // a / b
  • __divtf3 // a / b
  • __divxf3 // a / b
  • __negsf2 // -a symbol-level compatibility: libgcc uses this for the rl78
  • __negdf2 // -a unnecessary: can be lowered directly to a xor
  • __negtf2 // -a
  • __negxf2 // -a

Floating point raised to integer power

  • __powisf2 // unclear, if supported a ^ b
  • __powidf2 //
  • __powitf2 //
  • __powixf2 //
  • __mulsc3 // unsupported (a+ib) * (c+id)
  • __muldc3 //
  • __multc3 //
  • __mulxc3 //
  • __divsc3 // unsupported (a+ib) * / (c+id)
  • __divdc3 //
  • __divtc3 //
  • __divxc3 //