[llvm] r193327 - ARM: Use non-VFP softcalls on embedded Darwinish targets

Tim Northover tnorthover at apple.com
Thu Oct 24 03:37:10 PDT 2013


Author: tnorthover
Date: Thu Oct 24 05:37:09 2013
New Revision: 193327

URL: http://llvm.org/viewvc/llvm-project?rev=193327&view=rev
Log:
ARM: Use non-VFP softcalls on embedded Darwinish targets

The compiler-rt functions __adddf3vfp and so on exist purely to allow Thumb1
code to make use of VFP instructions by switching back to ARM mode, they make
no sense for M-class processors which don't even have an ARM mode.

Given that justification, in practice this is a platform ABI decision so the
actual check is based on that rather than CPU features.

rdar://problem/15302004

Added:
    llvm/trunk/test/CodeGen/ARM/darwin-eabi.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=193327&r1=193326&r2=193327&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Oct 24 05:37:09 2013
@@ -175,7 +175,7 @@ ARMTargetLowering::ARMTargetLowering(Tar
 
   setBooleanVectorContents(ZeroOrNegativeOneBooleanContent);
 
-  if (Subtarget->isTargetDarwin()) {
+  if (Subtarget->isTargetIOS()) {
     // Uses VFP for Thumb libfuncs if available.
     if (Subtarget->isThumb() && Subtarget->hasVFP2()) {
       // Single-precision floating-point arithmetic.

Added: llvm/trunk/test/CodeGen/ARM/darwin-eabi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/darwin-eabi.ll?rev=193327&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/darwin-eabi.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/darwin-eabi.ll Thu Oct 24 05:37:09 2013
@@ -0,0 +1,22 @@
+; RUN: llc -mtriple=thumbv7m-apple-darwin-eabi -mcpu=cortex-m3 < %s | FileCheck %s --check-prefix=CHECK-M3
+; RUN: llc -mtriple=thumbv7em-apple-darwin-eabi -mcpu=cortex-m4 < %s | FileCheck %s --check-prefix=CHECK-M4
+
+define float @float_op(float %lhs, float %rhs) {
+  %sum = fadd float %lhs, %rhs
+  ret float %sum
+; CHECK-M3-LABEL: float_op:
+; CHECK-M3: blx ___addsf3
+
+; CHECK-M4-LABEL: float_op:
+; CHECK-M4: vadd.f32
+}
+
+define double @double_op(double %lhs, double %rhs) {
+  %sum = fadd double %lhs, %rhs
+  ret double %sum
+; CHECK-M3-LABEL: double_op:
+; CHECK-M3: blx ___adddf3
+
+; CHECK-M4-LABEL: double_op:
+; CHECK-M4: blx ___adddf3
+}





More information about the llvm-commits mailing list