summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>2015-05-07 18:24:05 +0000
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>2015-05-07 18:24:05 +0000
commitf3c94b1e3cf53ae635e6901ded8a7b52c03e7645 (patch)
treec37189a47f425104efc1c770b008e179d5c2332c /llvm/test/CodeGen/PowerPC
parente4bcfbf5dc9396545640ec1d4755bdf87ce8fb1a (diff)
downloadbcm5719-llvm-f3c94b1e3cf53ae635e6901ded8a7b52c03e7645.tar.gz
bcm5719-llvm-f3c94b1e3cf53ae635e6901ded8a7b52c03e7645.zip
Add VSX Scalar loads and stores to the PPC back end
This patch corresponds to review: http://reviews.llvm.org/D9440 It adds a new register class to the PPC back end to contain single precision values in VSX registers. Additionally, it adds scalar loads and stores for VSX registers. llvm-svn: 236755
Diffstat (limited to 'llvm/test/CodeGen/PowerPC')
-rw-r--r--llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll6
-rw-r--r--llvm/test/CodeGen/PowerPC/vsx_scalar_ld_st.ll139
2 files changed, 143 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll b/llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll
index 77d066363cd..070a617ffe4 100644
--- a/llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll
+++ b/llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll
@@ -42,7 +42,8 @@ entry:
ret float %x
}
; CHECK: @callee2
-; CHECK: lfs {{[0-9]+}}, 136(1)
+; CHECK: addi [[TOCREG:[0-9]+]], 1, 136
+; CHECK: lxsspx {{[0-9]+}}, {{[0-9]+}}, [[TOCREG]]
; CHECK: blr
define void @caller2() {
@@ -52,7 +53,8 @@ entry:
ret void
}
; CHECK: @caller2
-; CHECK: stfs {{[0-9]+}}, 136(1)
+; CHECK: li [[TOCOFF:[0-9]+]], 136
+; CHECK: stxsspx {{[0-9]+}}, 1, [[TOCOFF]]
; CHECK: bl test2
declare float @test2(float, float, float, float, float, float, float, float, float, float, float, float, float, float)
diff --git a/llvm/test/CodeGen/PowerPC/vsx_scalar_ld_st.ll b/llvm/test/CodeGen/PowerPC/vsx_scalar_ld_st.ll
new file mode 100644
index 00000000000..10297088596
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/vsx_scalar_ld_st.ll
@@ -0,0 +1,139 @@
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -mattr=-direct-move | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=-direct-move | FileCheck %s
+
+@d = common global double 0.000000e+00, align 8
+@f = common global float 0.000000e+00, align 4
+@i = common global i32 0, align 4
+@ui = common global i32 0, align 4
+
+; Function Attrs: nounwind
+define void @dblToInt() #0 {
+entry:
+ %ii = alloca i32, align 4
+ %0 = load double, double* @d, align 8
+ %conv = fptosi double %0 to i32
+ store volatile i32 %conv, i32* %ii, align 4
+ ret void
+; CHECK-LABEL: @dblToInt
+; CHECK: xscvdpsxws [[REGCONV1:[0-9]+]],
+; CHECK: stxsiwx [[REGCONV1]],
+}
+
+; Function Attrs: nounwind
+define void @fltToInt() #0 {
+entry:
+ %ii = alloca i32, align 4
+ %0 = load float, float* @f, align 4
+ %conv = fptosi float %0 to i32
+ store volatile i32 %conv, i32* %ii, align 4
+ ret void
+; CHECK-LABEL: @fltToInt
+; CHECK: xscvdpsxws [[REGCONV2:[0-9]+]],
+; CHECK: stxsiwx [[REGCONV2]],
+}
+
+; Function Attrs: nounwind
+define void @intToDbl() #0 {
+entry:
+ %dd = alloca double, align 8
+ %0 = load i32, i32* @i, align 4
+ %conv = sitofp i32 %0 to double
+ store volatile double %conv, double* %dd, align 8
+ ret void
+; CHECK-LABEL: @intToDbl
+; CHECK: lxsiwax [[REGLD1:[0-9]+]],
+; CHECK: xscvsxddp {{[0-9]+}}, [[REGLD1]]
+}
+
+; Function Attrs: nounwind
+define void @intToFlt() #0 {
+entry:
+ %ff = alloca float, align 4
+ %0 = load i32, i32* @i, align 4
+ %conv = sitofp i32 %0 to float
+ store volatile float %conv, float* %ff, align 4
+ ret void
+; CHECK-LABEL: @intToFlt
+; CHECK: lxsiwax [[REGLD2:[0-9]+]],
+; FIXME: the below will change when the VSX form is implemented
+; CHECK: fcfids {{[0-9]}}, [[REGLD2]]
+}
+
+; Function Attrs: nounwind
+define void @dblToUInt() #0 {
+entry:
+ %uiui = alloca i32, align 4
+ %0 = load double, double* @d, align 8
+ %conv = fptoui double %0 to i32
+ store volatile i32 %conv, i32* %uiui, align 4
+ ret void
+; CHECK-LABEL: @dblToUInt
+; CHECK: xscvdpuxws [[REGCONV3:[0-9]+]],
+; CHECK: stxsiwx [[REGCONV3]],
+}
+
+; Function Attrs: nounwind
+define void @fltToUInt() #0 {
+entry:
+ %uiui = alloca i32, align 4
+ %0 = load float, float* @f, align 4
+ %conv = fptoui float %0 to i32
+ store volatile i32 %conv, i32* %uiui, align 4
+ ret void
+; CHECK-LABEL: @fltToUInt
+; CHECK: xscvdpuxws [[REGCONV4:[0-9]+]],
+; CHECK: stxsiwx [[REGCONV4]],
+}
+
+; Function Attrs: nounwind
+define void @uIntToDbl() #0 {
+entry:
+ %dd = alloca double, align 8
+ %0 = load i32, i32* @ui, align 4
+ %conv = uitofp i32 %0 to double
+ store volatile double %conv, double* %dd, align 8
+ ret void
+; CHECK-LABEL: @uIntToDbl
+; CHECK: lxsiwzx [[REGLD3:[0-9]+]],
+; CHECK: xscvuxddp {{[0-9]+}}, [[REGLD3]]
+}
+
+; Function Attrs: nounwind
+define void @uIntToFlt() #0 {
+entry:
+ %ff = alloca float, align 4
+ %0 = load i32, i32* @ui, align 4
+ %conv = uitofp i32 %0 to float
+ store volatile float %conv, float* %ff, align 4
+ ret void
+; CHECK-LABEL: @uIntToFlt
+; CHECK: lxsiwzx [[REGLD4:[0-9]+]],
+; FIXME: the below will change when the VSX form is implemented
+; CHECK: fcfidus {{[0-9]+}}, [[REGLD4]]
+}
+
+; Function Attrs: nounwind
+define void @dblToFloat() #0 {
+entry:
+ %ff = alloca float, align 4
+ %0 = load double, double* @d, align 8
+ %conv = fptrunc double %0 to float
+ store volatile float %conv, float* %ff, align 4
+ ret void
+; CHECK-LABEL: @dblToFloat
+; CHECK: lxsdx [[REGLD5:[0-9]+]],
+; CHECK: stxsspx [[REGLD5]],
+}
+
+; Function Attrs: nounwind
+define void @floatToDbl() #0 {
+entry:
+ %dd = alloca double, align 8
+ %0 = load float, float* @f, align 4
+ %conv = fpext float %0 to double
+ store volatile double %conv, double* %dd, align 8
+ ret void
+; CHECK-LABEL: @floatToDbl
+; CHECK: lxsspx [[REGLD5:[0-9]+]],
+; CHECK: stxsdx [[REGLD5]],
+}
OpenPOWER on IntegriCloud