summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll
diff options
context:
space:
mode:
authorZaara Syeda <syzaara@ca.ibm.com>2017-09-21 16:12:33 +0000
committerZaara Syeda <syzaara@ca.ibm.com>2017-09-21 16:12:33 +0000
commitfcd9697d72eee33614a4441d63526349d08710fa (patch)
treef59004947a35d7a3edb18833c4bd5d1c69745b31 /llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll
parentc48461922e716ed067618585ab9da48c65624e2e (diff)
downloadbcm5719-llvm-fcd9697d72eee33614a4441d63526349d08710fa.tar.gz
bcm5719-llvm-fcd9697d72eee33614a4441d63526349d08710fa.zip
[Power9] Spill gprs to vector registers rather than stack
This patch updates register allocation to enable spilling gprs to volatile vector registers rather than the stack. It can be enabled for Power9 with option -ppc-enable-gpr-to-vsr-spills. Differential Revision: https://reviews.llvm.org/D34815 llvm-svn: 313886
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll')
-rw-r--r--llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll b/llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll
new file mode 100644
index 00000000000..0b1781a0646
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/gpr-vsr-spill.ll
@@ -0,0 +1,24 @@
+; RUN: llc -verify-machineinstrs -mcpu=pwr9 -ppc-enable-gpr-to-vsr-spills < %s | FileCheck %s
+define signext i32 @foo(i32 signext %a, i32 signext %b) {
+entry:
+ %cmp = icmp slt i32 %a, %b
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ %0 = tail call i32 asm "add $0, $1, $2", "=r,r,r,~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28},~{r29}"(i32 %a, i32 %b)
+ %mul = mul nsw i32 %0, %a
+ %add = add i32 %b, %a
+ %tmp = add i32 %add, %mul
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ %e.0 = phi i32 [ %tmp, %if.then ], [ undef, %entry ]
+ ret i32 %e.0
+; CHECK: @foo
+; CHECK: mr [[NEWREG:[0-9]+]], 3
+; CHECK: mtvsrd [[NEWREG2:[0-9]+]], 4
+; CHECK: mffprd [[REG1:[0-9]+]], [[NEWREG2]]
+; CHECK: add {{[0-9]+}}, [[NEWREG]], [[REG1]]
+; CHECK: mffprd [[REG2:[0-9]+]], [[NEWREG2]]
+; CHECK: add {{[0-9]+}}, [[REG2]], [[NEWREG]]
+}
OpenPOWER on IntegriCloud