[PATCH] D38299: [ARM] Honor -mfloat-abi for libcall calling convention
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 16:27:40 PDT 2017
efriedma created this revision.
As far as I can tell, this matches gcc: -mfloat-abi determines the calling convention for all functions except those explicitly defined as soft-float in the ARM RTABI.
This change only affects cases where the user specifies -mfloat-abi to override the default calling convention derived from the target triple.
Fixes https://bugs.llvm.org//show_bug.cgi?id=34530.
(This obsoletes https://reviews.llvm.org/D38050 if it's accepted.)
Repository:
rL LLVM
https://reviews.llvm.org/D38299
Files:
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/Thumb2/intrinsics-cc.ll
Index: test/CodeGen/Thumb2/intrinsics-cc.ll
===================================================================
--- test/CodeGen/Thumb2/intrinsics-cc.ll
+++ test/CodeGen/Thumb2/intrinsics-cc.ll
@@ -15,27 +15,44 @@
declare float @llvm.powi.f32(float, i32)
-define float @f(float %f, i32 %i) {
+define float @powi_f32(float %f, i32 %i) {
entry:
%0 = call float @llvm.powi.f32(float %f, i32 %i)
ret float %0
}
; CHECK-MATCH: b __powisf2
-; CHECK-MISMATCH: bl __powisf2
-; CHECK-TO-SOFT: vmov s0, r0
-; CHECK-TO-HARD: vmov r0, s0
+; CHECK-MISMATCH: b __powisf2
declare double @llvm.powi.f64(double, i32)
-define double @g(double %d, i32 %i) {
+define double @powi_f64(double %d, i32 %i) {
entry:
%0 = call double @llvm.powi.f64(double %d, i32 %i)
ret double %0
}
; CHECK-MATCH: b __powidf2
-; CHECK-MISMATCH: bl __powidf2
-; CHECK-TO-SOFT: vmov d0, r0, r1
-; CHECK-TO-HARD: vmov r0, r1, d0
+; CHECK-MISMATCH: b __powidf2
+declare float @llvm.floor.f32(float)
+
+define float @floor_f32(float %f) {
+entry:
+ %0 = call float @llvm.floor.f32(float %f)
+ ret float %0
+}
+
+; CHECK-MATCH: b floorf
+; CHECK-MISMATCH: b floorf
+
+declare double @llvm.floor.f64(double)
+
+define double @floor_f64(double %d) {
+entry:
+ %0 = call double @llvm.floor.f64(double %d)
+ ret double %0
+}
+
+; CHECK-MATCH: b floor
+; CHECK-MISMATCH: b floor
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -231,15 +231,7 @@
if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetIOS() &&
!Subtarget->isTargetWatchOS()) {
- const auto &E = Subtarget->getTargetTriple().getEnvironment();
-
- bool IsHFTarget = E == Triple::EABIHF || E == Triple::GNUEABIHF ||
- E == Triple::MuslEABIHF;
- // Windows is a special case. Technically, we will replace all of the "GNU"
- // calls with calls to MSVCRT if appropriate and adjust the calling
- // convention then.
- IsHFTarget = IsHFTarget || Subtarget->isTargetWindows();
-
+ bool IsHFTarget = TM.Options.FloatABIType == FloatABI::Hard;
for (int LCID = 0; LCID < RTLIB::UNKNOWN_LIBCALL; ++LCID)
setLibcallCallingConv(static_cast<RTLIB::Libcall>(LCID),
IsHFTarget ? CallingConv::ARM_AAPCS_VFP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38299.116737.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170926/1161f84f/attachment.bin>
More information about the llvm-commits
mailing list