Skip to content

Commit 29bb6c9

Browse files
committed
SPARC: Start moving runtime libcall config to tablegen
1 parent df54961 commit 29bb6c9

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,23 @@ def _Q_qtoull : RuntimeLibcallImpl<FPTOUINT_F128_I64>;
19801980
def _Q_lltoq : RuntimeLibcallImpl<SINTTOFP_I64_F128>;
19811981
def _Q_ulltoq : RuntimeLibcallImpl<UINTTOFP_I64_F128>;
19821982

1983+
def isSPARC : RuntimeLibcallPredicate<"TT.isSPARC()">;
1984+
def isSPARC32 : RuntimeLibcallPredicate<"TT.isSPARC32()">;
1985+
def isSPARC64 : RuntimeLibcallPredicate<"TT.isSPARC64()">;
1986+
1987+
defvar SPARC64_MulDivCalls = [
1988+
__mulsi3, __divsi3, __modsi3, __udivsi3, __umodsi3
1989+
];
1990+
1991+
def SPARCSystemLibrary
1992+
: SystemRuntimeLibrary<isSPARC,
1993+
(add (sub DefaultLibcallImpls32, SPARC64_MulDivCalls),
1994+
sparc_umul, sparc_div, sparc_udiv, sparc_rem, sparc_urem,
1995+
LibcallImpls<(add _Q_qtoll, _Q_qtoull, _Q_lltoq, _Q_ulltoq), isSPARC32>,
1996+
LibcallImpls<(add SPARC64_MulDivCalls, Int128RTLibcalls), isSPARC64>,
1997+
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128)
1998+
>;
1999+
19832000
//===----------------------------------------------------------------------===//
19842001
// Windows Runtime Libcalls
19852002
//===----------------------------------------------------------------------===//

llvm/lib/Target/Sparc/SparcISelLowering.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,12 +1824,6 @@ SparcTargetLowering::SparcTargetLowering(const TargetMachine &TM,
18241824
setOperationAction(ISD::MULHS, MVT::i32, Expand);
18251825
setOperationAction(ISD::MUL, MVT::i32, Expand);
18261826

1827-
setLibcallImpl(RTLIB::MUL_I32, RTLIB::sparc_umul);
1828-
setLibcallImpl(RTLIB::SDIV_I32, RTLIB::sparc_div);
1829-
setLibcallImpl(RTLIB::UDIV_I32, RTLIB::sparc_udiv);
1830-
setLibcallImpl(RTLIB::SREM_I32, RTLIB::sparc_rem);
1831-
setLibcallImpl(RTLIB::UREM_I32, RTLIB::sparc_urem);
1832-
18331827
if (Subtarget->useSoftMulDiv()) {
18341828
// .umul works for both signed and unsigned
18351829
setOperationAction(ISD::SMUL_LOHI, MVT::i32, Expand);
@@ -1879,13 +1873,6 @@ SparcTargetLowering::SparcTargetLowering(const TargetMachine &TM,
18791873
setOperationAction(ISD::STORE, MVT::f128, Custom);
18801874
}
18811875

1882-
if (!Subtarget->is64Bit()) {
1883-
setLibcallImpl(RTLIB::FPTOSINT_F128_I64, RTLIB::_Q_qtoll);
1884-
setLibcallImpl(RTLIB::FPTOUINT_F128_I64, RTLIB::_Q_qtoull);
1885-
setLibcallImpl(RTLIB::SINTTOFP_I64_F128, RTLIB::_Q_lltoq);
1886-
setLibcallImpl(RTLIB::UINTTOFP_I64_F128, RTLIB::_Q_ulltoq);
1887-
}
1888-
18891876
if (Subtarget->hasHardQuad()) {
18901877
setOperationAction(ISD::FADD, MVT::f128, Legal);
18911878
setOperationAction(ISD::FSUB, MVT::f128, Legal);

0 commit comments

Comments
 (0)