summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ/int-sub-05.ll
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-03 10:10:02 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-03 10:10:02 +0000
commited1fab6b5bfb54d63102319a761011e985081cb4 (patch)
tree6f875f92916f0dc214d1f28035000331faccbac7 /llvm/test/CodeGen/SystemZ/int-sub-05.ll
parentd36cbaa4231e51a42d761d298ff20aaa6e88d014 (diff)
downloadbcm5719-llvm-ed1fab6b5bfb54d63102319a761011e985081cb4.tar.gz
bcm5719-llvm-ed1fab6b5bfb54d63102319a761011e985081cb4.zip
[SystemZ] Fold more spills
Add a mapping from register-based <INSN>R instructions to the corresponding memory-based <INSN>. Use it to cut down on the number of spill loads. Some instructions extend their operands from smaller fields, so this required a new TSFlags field to say how big the unextended operand is. This optimisation doesn't trigger for C(G)R and CL(G)R because in practice we always combine those instructions with a branch. Adding a test for every other case probably seems excessive, but it did catch a missed optimisation for DSGF (fixed in r185435). llvm-svn: 185529
Diffstat (limited to 'llvm/test/CodeGen/SystemZ/int-sub-05.ll')
-rw-r--r--llvm/test/CodeGen/SystemZ/int-sub-05.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/int-sub-05.ll b/llvm/test/CodeGen/SystemZ/int-sub-05.ll
index 1475b244f67..5d95e79080b 100644
--- a/llvm/test/CodeGen/SystemZ/int-sub-05.ll
+++ b/llvm/test/CodeGen/SystemZ/int-sub-05.ll
@@ -2,6 +2,8 @@
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+declare i128 *@foo()
+
; Test register addition.
define void @f1(i128 *%ptr, i64 %high, i64 %low) {
; CHECK: f1:
@@ -116,3 +118,35 @@ define void @f7(i64 %base) {
store i128 %sub, i128 *%aptr
ret void
}
+
+; Check that subtractions of spilled values can use SLG and SLBG rather than
+; SLGR and SLBGR.
+define void @f8(i128 *%ptr0) {
+; CHECK: f8:
+; CHECK: brasl %r14, foo@PLT
+; CHECK: slg {{%r[0-9]+}}, {{[0-9]+}}(%r15)
+; CHECK: slbg {{%r[0-9]+}}, {{[0-9]+}}(%r15)
+; CHECK: br %r14
+ %ptr1 = getelementptr i128 *%ptr0, i128 2
+ %ptr2 = getelementptr i128 *%ptr0, i128 4
+ %ptr3 = getelementptr i128 *%ptr0, i128 6
+ %ptr4 = getelementptr i128 *%ptr0, i128 8
+
+ %val0 = load i128 *%ptr0
+ %val1 = load i128 *%ptr1
+ %val2 = load i128 *%ptr2
+ %val3 = load i128 *%ptr3
+ %val4 = load i128 *%ptr4
+
+ %retptr = call i128 *@foo()
+
+ %ret = load i128 *%retptr
+ %sub0 = sub i128 %ret, %val0
+ %sub1 = sub i128 %sub0, %val1
+ %sub2 = sub i128 %sub1, %val2
+ %sub3 = sub i128 %sub2, %val3
+ %sub4 = sub i128 %sub3, %val4
+ store i128 %sub4, i128 *%retptr
+
+ ret void
+}
OpenPOWER on IntegriCloud