summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/macho-embedded-float.ll
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2018-07-19 12:44:51 +0000
committerTim Northover <tnorthover@apple.com>2018-07-19 12:44:51 +0000
commita7c18ee8c4a0b0540963c2fe0b7b0a688de9c636 (patch)
tree023afff9ed70873e3a9470b790d21314e9715e1f /llvm/test/CodeGen/ARM/macho-embedded-float.ll
parent1ac56bd33f0305cdfc8df9595409070a0d2ebb52 (diff)
downloadbcm5719-llvm-a7c18ee8c4a0b0540963c2fe0b7b0a688de9c636.tar.gz
bcm5719-llvm-a7c18ee8c4a0b0540963c2fe0b7b0a688de9c636.zip
ARM: switch armv7em MachO 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. Recommitted without breaking ELF this time. llvm-svn: 337450
Diffstat (limited to 'llvm/test/CodeGen/ARM/macho-embedded-float.ll')
-rw-r--r--llvm/test/CodeGen/ARM/macho-embedded-float.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/macho-embedded-float.ll b/llvm/test/CodeGen/ARM/macho-embedded-float.ll
new file mode 100644
index 00000000000..c66324c08c2
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/macho-embedded-float.ll
@@ -0,0 +1,37 @@
+; 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
+; RUN: llc -mtriple=thumbv7em-linux-gnueabi %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)
OpenPOWER on IntegriCloud