https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/153394
>From 2b09c7b64a96e11e1805b08e509e2ba2519bce38 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <matthew.arsena...@amd.com> Date: Wed, 13 Aug 2025 20:20:53 +0900 Subject: [PATCH] ARM: Move gnu half convert calling conv config into tablegen --- llvm/include/llvm/IR/RuntimeLibcalls.td | 13 ++++++++++++- llvm/lib/IR/RuntimeLibcalls.cpp | 6 ------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td index b6664fb2ba908..04de19e257c9b 100644 --- a/llvm/include/llvm/IR/RuntimeLibcalls.td +++ b/llvm/include/llvm/IR/RuntimeLibcalls.td @@ -1482,10 +1482,21 @@ def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>; def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>; + +// The half <-> float conversion functions are always soft-float on +// non-watchos platforms, but are needed for some targets which use a +// hard-float calling convention by default. +def ARMHalfConvertLibcallCallingConv : LibcallCallingConv< + [{TT.isWatchABI() ? DefaultCC : + (isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS)}] +>; + def GNUEABIHalfConvertCalls : LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee), RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() && - !TT.isTargetAEABI()}]>>; + !TT.isTargetAEABI()}]>> { + let CallingConv = ARMHalfConvertLibcallCallingConv; +} // In EABI, these functions have an __aeabi_ prefix, but in GNUEABI // they have a __gnu_ prefix (which is the default). diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp index ff54d2da4ea2f..ac845c4998783 100644 --- a/llvm/lib/IR/RuntimeLibcalls.cpp +++ b/llvm/lib/IR/RuntimeLibcalls.cpp @@ -42,16 +42,10 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT, setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_AAPCS); setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_AAPCS); setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_AAPCS); - setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee, - CallingConv::ARM_AAPCS); - setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee, - CallingConv::ARM_AAPCS); } else { setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_APCS); setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_APCS); setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_APCS); - setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee, CallingConv::ARM_APCS); - setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee, CallingConv::ARM_APCS); } } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits