-
Notifications
You must be signed in to change notification settings - Fork 15.1k
ARM: Move half convert libcall config to tablegen #153389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/arm/move-half-convert-config-tablegen
Aug 14, 2025
Merged
ARM: Move half convert libcall config to tablegen #153389
arsenm
merged 1 commit into
main
from
users/arsenm/arm/move-half-convert-config-tablegen
Aug 14, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
@llvm/pr-subscribers-backend-arm @llvm/pr-subscribers-tablegen Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/153389.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index ba0d61e190c64..e8eb6a310c2d0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1321,6 +1321,9 @@ def AMDGPUSystemLibrary : SystemRuntimeLibrary<isAMDGPU, (add)>;
// ARM Runtime Libcalls
//===----------------------------------------------------------------------===//
+def isTargetAEABIAndAAPCS_ABI : RuntimeLibcallPredicate<
+ [{TT.isTargetAEABI() && isAAPCS_ABI(TT, ABIName)}]>;
+
// if (isTargetMachO()) {
// if (Subtarget->isThumb() && Subtarget->hasVFP2Base() &&
// Subtarget->hasARMOps() && !Subtarget->useSoftFloat()) {
@@ -1514,13 +1517,23 @@ def __udivmodsi4 : RuntimeLibcallImpl<UDIVREM_I32>;
// a __gnu_ prefix (which is the default).
// isTargetAEABI()
def __aeabi_f2h : RuntimeLibcallImpl<FPROUND_F32_F16>; // CallingConv::ARM_AAPCS
-//def __aeabi_d2h : RuntimeLibcallImpl<FPROUND_F64_F16>; // CallingConv::ARM_AAPCS
def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
// !isTargetMachO()
def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
+def GNUEABIHalfConvertCalls :
+ LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
+ RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
+ !TT.isTargetAEABI()}]>>;
+
+// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
+// they have a __gnu_ prefix (which is the default).
+def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
+ isTargetAEABIAndAAPCS_ABI> {
+ let CallingConv = ARM_AAPCS;
+}
def WindowARMDivRemCalls : LibcallImpls<
(add __rt_sdiv, __rt_sdiv64, __rt_udiv, __rt_udiv64),
@@ -1594,8 +1607,8 @@ def AEABICalls : LibcallImpls<
// RTABI chapter 4.1.2, Table 7
__aeabi_d2f,
__aeabi_f2d,
- __aeabi_h2f,
- __aeabi_f2h,
+ //__aeabi_h2f added separately
+ //__aeabi_f2h added separately
__aeabi_d2h,
// Integer to floating-point conversions.
@@ -1655,6 +1668,8 @@ def ARMSystemLibrary
AEABICalls,
AEABI45MemCalls,
+ EABIHalfConvertCalls,
+ GNUEABIHalfConvertCalls,
// Use divmod compiler-rt calls for iOS 5.0 and later.
LibcallImpls<(add __divmodsi4, __udivmodsi4),
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index ea2df4f04c585..34708e99e23ca 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -587,28 +587,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
}
}
- // In EABI, these functions have an __aeabi_ prefix, but in GNUEABI they have
- // a __gnu_ prefix (which is the default).
- if (TT.isTargetAEABI()) {
- // FIXME: This does not depend on the subtarget and should go directly into
- // RuntimeLibcalls. This is only here because of missing support for setting
- // the calling convention of an implementation.
- static const struct {
- const RTLIB::Libcall Op;
- const RTLIB::LibcallImpl Impl;
- } LibraryCalls[] = {
- {RTLIB::FPROUND_F32_F16, RTLIB::__aeabi_f2h},
- {RTLIB::FPEXT_F16_F32, RTLIB::__aeabi_h2f},
- };
-
- for (const auto &LC : LibraryCalls) {
- setLibcallImpl(LC.Op, LC.Impl);
- }
- } else if (!TT.isOSBinFormatMachO()) {
- setLibcallImpl(RTLIB::FPROUND_F32_F16, RTLIB::__gnu_f2h_ieee);
- setLibcallImpl(RTLIB::FPEXT_F16_F32, RTLIB::__gnu_h2f_ieee);
- }
-
if (Subtarget->isThumb1Only())
addRegisterClass(MVT::i32, &ARM::tGPRRegClass);
else
|
This was referenced Aug 13, 2025
efriedma-quic
approved these changes
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cdacf6e to
377c292
Compare
3c5064e to
0656a0d
Compare
Base automatically changed from
users/arsenm/arm/move-aeabi-call-config-tablegen
to
main
August 14, 2025 06:43
377c292 to
16d5b2b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.