summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2018-07-25 11:11:12 +0000
committerThomas Preud'homme <thomas.preudhomme@arm.com>2018-07-25 11:11:12 +0000
commit768d6ce4a3af1c32d73e139499300579c27b6b35 (patch)
tree1d62c0671de01ceccbccd3c4b07d292786a5fa46 /llvm/test/CodeGen
parent0913dcd7471bc98672139df38d436a64d10ecfeb (diff)
downloadbcm5719-llvm-768d6ce4a3af1c32d73e139499300579c27b6b35.tar.gz
bcm5719-llvm-768d6ce4a3af1c32d73e139499300579c27b6b35.zip
Fix PR34170: Crash on inline asm with 64bit output in 32bit GPR
Add support for inline assembly with output operand that do not naturally go in the register class it is constrained to (eg. double in a 32-bit GPR as in the PR). llvm-svn: 337903
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/ARM/inline-asm-operand-implicit-cast.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/inline-asm-operand-implicit-cast.ll b/llvm/test/CodeGen/ARM/inline-asm-operand-implicit-cast.ll
new file mode 100644
index 00000000000..8bb671e10fb
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/inline-asm-operand-implicit-cast.ll
@@ -0,0 +1,42 @@
+; RUN: llc -mtriple armv7-arm-linux-gnueabihf -O2 -mcpu=cortex-a7 < %s | FileCheck %s
+
+; Check support for returning a float in GPR with soft float ABI
+define arm_aapcscc float @zerobits_float_soft() #0 {
+; CHECK-LABEL: zerobits_float_soft
+; CHECK: mov r0, #0
+ %1 = tail call float asm "mov ${0}, #0", "=&r"()
+ ret float %1
+}
+
+; Check support for returning a double in GPR with soft float ABI
+define arm_aapcscc double @zerobits_double_soft() #0 {
+; CHECK-LABEL: zerobits_double_soft
+; CHECK: mov r0, #0
+; CHECK-NEXT: mov r1, #0
+ %1 = tail call double asm "mov ${0:Q}, #0\0Amov ${0:R}, #0", "=&r"()
+ ret double %1
+}
+
+attributes #0 = { nounwind "target-features"="+d16,+vfp2,+vfp3,-fp-only-sp" "use-soft-float"="true" }
+
+
+; Check support for returning a float in GPR with hard float ABI
+define float @zerobits_float_hard() #1 {
+; CHECK-LABEL: zerobits_float_hard
+; CHECK: mov r0, #0
+; CHECK: vmov s0, r0
+ %1 = tail call float asm "mov ${0}, #0", "=&r"()
+ ret float %1
+}
+
+; Check support for returning a double in GPR with hard float ABI
+define double @zerobits_double_hard() #1 {
+; CHECK-LABEL: zerobits_double_hard
+; CHECK: mov r0, #0
+; CHECK-NEXT: mov r1, #0
+; CHECK: vmov d0, r0, r1
+ %1 = tail call double asm "mov ${0:Q}, #0\0Amov ${0:R}, #0", "=&r"()
+ ret double %1
+}
+
+attributes #1 = { nounwind "target-features"="+d16,+vfp2,+vfp3,-fp-only-sp" "use-soft-float"="false" }
OpenPOWER on IntegriCloud