Skip to content

Commit 651ca0c

Browse files
committed
Fix 64-bit float libcalls which use standard library functions
1 parent c74f71c commit 651ca0c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

llvm/lib/Target/Z80/Z80ISelLowering.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,34 @@ Z80TargetLowering::Z80TargetLowering(const Z80TargetMachine &TM,
207207
setLibcall(RTLIB::SINTTOFP_I64_F64, "_lltod", CallingConv::Z80_LibCall );
208208
setLibcall(RTLIB::UINTTOFP_I32_F64, "_ultod", CallingConv::Z80_LibCall );
209209
setLibcall(RTLIB::UINTTOFP_I64_F64, "_ulltod", CallingConv::Z80_LibCall );
210+
211+
// Override standard C libcalls to use long double for 64-bit
212+
setLibcall(RTLIB::FMA_F64, "fmal", CallingConv::C );
213+
setLibcall(RTLIB::SQRT_F64, "sqrtl", CallingConv::C );
214+
setLibcall(RTLIB::CBRT_F64, "cbrtl", CallingConv::C );
215+
setLibcall(RTLIB::LOG_F64, "logl", CallingConv::C );
216+
setLibcall(RTLIB::LOG2_F64, "log2l", CallingConv::C );
217+
setLibcall(RTLIB::LOG10_F64, "log10l", CallingConv::C );
218+
setLibcall(RTLIB::EXP_F64, "expl", CallingConv::C );
219+
setLibcall(RTLIB::EXP2_F64, "exp2l", CallingConv::C );
220+
setLibcall(RTLIB::SIN_F64, "sinl", CallingConv::C );
221+
setLibcall(RTLIB::COS_F64, "cosl", CallingConv::C );
222+
setLibcall(RTLIB::POW_F64, "powl", CallingConv::C );
223+
setLibcall(RTLIB::CEIL_F64, "ceill", CallingConv::C );
224+
setLibcall(RTLIB::TRUNC_F64, "truncl", CallingConv::C );
225+
setLibcall(RTLIB::RINT_F64, "rintl", CallingConv::C );
226+
setLibcall(RTLIB::NEARBYINT_F64, "nearbyintl", CallingConv::C );
227+
setLibcall(RTLIB::ROUND_F64, "roundl", CallingConv::C );
228+
setLibcall(RTLIB::ROUNDEVEN_F64, "roundevenl", CallingConv::C );
229+
setLibcall(RTLIB::FLOOR_F64, "floorl", CallingConv::C );
230+
setLibcall(RTLIB::COPYSIGN_F64, "copysignl", CallingConv::C );
231+
setLibcall(RTLIB::FMIN_F64, "fminl", CallingConv::C );
232+
setLibcall(RTLIB::FMAX_F64, "fmaxl", CallingConv::C );
233+
setLibcall(RTLIB::LROUND_F64, "lroundl", CallingConv::C );
234+
setLibcall(RTLIB::LLROUND_F64, "llroundl", CallingConv::C );
235+
setLibcall(RTLIB::LRINT_F64, "lrintl", CallingConv::C );
236+
setLibcall(RTLIB::LLRINT_F64, "llrintl", CallingConv::C );
237+
setLibcall(RTLIB::ABS_F64, "fabsl", CallingConv::C );
210238
}
211239

212240
unsigned Z80TargetLowering::getJumpTableEncoding() const {

0 commit comments

Comments
 (0)