Skip to content

Commit b549ea7

Browse files
authored
ARM: Avoid adding default libcalls overridden by AEABI functions (#164983)
Avoids adding alternative libcall impls for the same libcall. I'm not sure if the default names exist or not, or are just not preferred. compiler-rt appears to define aliases for all of these, so I'm not sure why we bother distinguishing these in the first place.
1 parent bbf5c41 commit b549ea7

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,41 @@ def __aeabi_ddiv : RuntimeLibcallImpl<DIV_F64>; // CallingConv::ARM_AAPCS
15081508
def __aeabi_dmul : RuntimeLibcallImpl<MUL_F64>; // CallingConv::ARM_AAPCS
15091509
def __aeabi_dsub : RuntimeLibcallImpl<SUB_F64>; // CallingConv::ARM_AAPCS
15101510

1511+
defvar AEABIOverrides = [
1512+
__eqsf2, __eqdf2,
1513+
__nesf2, __nedf2,
1514+
__ltsf2, __ltdf2,
1515+
__lesf2, __ledf2,
1516+
__gesf2, __gedf2,
1517+
__gtsf2, __gtdf2,
1518+
__unordsf2, __unorddf2,
1519+
1520+
__addsf3, __adddf3,
1521+
__divsf3, __divdf3,
1522+
__mulsf3, __muldf3,
1523+
__subsf3, __subdf3,
1524+
1525+
__fixdfsi, __fixunsdfsi,
1526+
__fixdfdi, __fixunsdfdi,
1527+
__fixsfsi, __fixunssfsi,
1528+
__fixsfdi, __fixunssfdi,
1529+
1530+
__floatsidf, __floatunsidf,
1531+
__floatdidf, __floatundidf,
1532+
__floatsisf, __floatunsisf,
1533+
__floatdisf, __floatundisf,
1534+
1535+
__muldi3, __ashldi3,
1536+
__lshrdi3, __ashrdi3,
1537+
1538+
__divsi3, __udivsi3
1539+
1540+
// Half conversion cases are a mess and handled separately.
1541+
// __truncdfsf2, __truncdfhf2,
1542+
// __extendsfdf2,
1543+
// __truncsfhf2, __extendhfsf2
1544+
];
1545+
15111546
// Double-precision floating-point comparison helper functions
15121547
// RTABI chapter 4.1.2, Table 3
15131548
def __aeabi_dcmpeq__oeq : RuntimeLibcallImpl<OEQ_F64, "__aeabi_dcmpeq">; // CallingConv::ARM_AAPCS, CmpInst::ICMP_NE
@@ -1793,7 +1828,8 @@ def ARMSystemLibrary
17931828
: SystemRuntimeLibrary<isARMOrThumb,
17941829
(add (sub WinDefaultLibcallImpls, ARMLibgccHalfConvertCalls,
17951830
GNUEABIHalfConvertCalls,
1796-
ARMDoubleToHalfCalls),
1831+
ARMDoubleToHalfCalls,
1832+
AEABIOverrides),
17971833
LibcallImpls<(add __powisf2, __powidf2), isNotOSMSVCRT>,
17981834
LibmHasFrexpF32, LibmHasLdexpF32,
17991835
LibmHasFrexpF128, LibmHasLdexpF128,
@@ -1812,6 +1848,11 @@ def ARMSystemLibrary
18121848
GNUEABIHalfConvertCalls,
18131849
ARMDoubleToHalfCalls,
18141850

1851+
LibcallImpls<(add AEABIOverrides),
1852+
RuntimeLibcallPredicate<[{
1853+
(!hasAEABILibcalls(TT) || !isAAPCS_ABI(TT, ABIName)) &&
1854+
!TT.isOSWindows()
1855+
}]>>,
18151856
// Use divmod compiler-rt calls for iOS 5.0 and later.
18161857
LibcallImpls<(add __divmodsi4, __udivmodsi4),
18171858
RuntimeLibcallPredicate<[{TT.isOSBinFormatMachO() &&

0 commit comments

Comments
 (0)