ARM: switch armv7em triple to hard-float defaults and libcalls.

We were emitting incorrect calls to libm functions that LLVM had decided it
knew about because the default is soft-float.

llvm-svn: 337385
This commit is contained in:
Tim Northover 2018-07-18 12:37:04 +00:00
parent 097a3e3d95
commit d4abd14c1b
3 changed files with 38 additions and 1 deletions

View File

@ -66,6 +66,7 @@ public:
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == Triple::EABIHF ||
TargetTriple.getSubArch() == Triple::ARMSubArch_v7em ||
TargetTriple.isOSWindows() ||
TargetABI == ARMBaseTargetMachine::ARM_ABI_AAPCS16;
}

View File

@ -20,5 +20,5 @@ define double @double_op(double %lhs, double %rhs) {
; CHECK-M3: bl ___adddf3
; CHECK-M4-LABEL: double_op:
; CHECK-M4: {{(blx|b.w)}} ___adddf3
; CHECK-M4: {{(bl|blx|b.w)}} ___adddf3
}

View File

@ -0,0 +1,36 @@
; RUN: llc -mtriple=thumbv7em-none-macho %s -o - -mcpu=cortex-m4 | FileCheck --check-prefix=CHECK-HARD %s
; RUN: llc -mtriple=thumbv7m-none-macho %s -o - -mcpu=cortex-m4 | FileCheck --check-prefix=CHECK-SOFT %s
define float @test_default_cc(float %a, float %b) {
; CHECK-HARD-LABEL: test_default_cc:
; CHECK-HARD-NOT: vmov
; CHECK-HARD: vadd.f32 s0, s0, s1
; CHECK-HARD-NOT: vmov
; CHECK-SOFT-LABEL: test_default_cc:
; CHECK-SOFT-DAG: vmov [[A:s[0-9]+]], r0
; CHECK-SOFT-DAG: vmov [[B:s[0-9]+]], r1
; CHECK-SOFT: vadd.f32 [[RES:s[0-9]+]], [[A]], [[B]]
; CEHCK-SOFT: vmov r0, [[RES]]
%res = fadd float %a, %b
ret float %res
}
define arm_aapcs_vfpcc float @test_libcall(float %in) {
; CHECK-HARD-LABEL: test_libcall:
; CHECK-HARD-NOT: vmov
; CHECK-HARD: b.w _sinf
; CHECK-SOFT-LABEL: test_libcall:
; CHECK-SOFT: vmov r0, s0
; CHECK-SOFT: bl _sinf
; CHECK-SOFT: vmov s0, r0
%res = call float @llvm.sin.f32(float %in)
ret float %res
}
declare float @llvm.sin.f32(float)