summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC/i32-to-float.ll
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-03-31 01:58:02 +0000
committerHal Finkel <hfinkel@anl.gov>2013-03-31 01:58:02 +0000
commite53429a13e46f347021525b75579981d1890f1a0 (patch)
tree085c16b69b998349e669e83ae30669e948b53815 /llvm/test/CodeGen/PowerPC/i32-to-float.ll
parentb49ec5d0aad2e40b5c4522ae0a3e9be0535a00d5 (diff)
downloadbcm5719-llvm-e53429a13e46f347021525b75579981d1890f1a0.tar.gz
bcm5719-llvm-e53429a13e46f347021525b75579981d1890f1a0.zip
Cleanup PPC(64) i32 -> float/double conversion
The existing SINT_TO_FP code for i32 -> float/double conversion was disabled because it relied on broken EXTSW_32/STD_32 instruction definitions. The original intent had been to enable these 64-bit instructions to be used on CPUs that support them even in 32-bit mode. Unfortunately, this form of lying to the infrastructure was buggy (as explained in the FIXME comment) and had therefore been disabled. This re-enables this functionality, using regular DAG nodes, but only when compiling in 64-bit mode. The old STD_32/EXTSW_32 definitions (which were dead) are removed. llvm-svn: 178438
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/i32-to-float.ll')
-rw-r--r--llvm/test/CodeGen/PowerPC/i32-to-float.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/i32-to-float.ll b/llvm/test/CodeGen/PowerPC/i32-to-float.ll
new file mode 100644
index 00000000000..0807717e50d
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/i32-to-float.ll
@@ -0,0 +1,31 @@
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g5 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define float @foo(i32 %a) nounwind {
+entry:
+ %x = sitofp i32 %a to float
+ ret float %x
+
+; CHECK: @foo
+; CHECK: extsw [[REG:[0-9]+]], 3
+; CHECK: std [[REG]],
+; CHECK: lfd [[REG2:[0-9]+]],
+; CHECK: fcfid [[REG3:[0-9]+]], [[REG2]]
+; CHECK: frsp 1, [[REG3]]
+; CHECK: blr
+}
+
+define double @goo(i32 %a) nounwind {
+entry:
+ %x = sitofp i32 %a to double
+ ret double %x
+
+; CHECK: @goo
+; CHECK: extsw [[REG:[0-9]+]], 3
+; CHECK: std [[REG]],
+; CHECK: lfd [[REG2:[0-9]+]],
+; CHECK: fcfid 1, [[REG2]]
+; CHECK: blr
+}
+
OpenPOWER on IntegriCloud