summaryrefslogtreecommitdiff
path: root/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
commitfa487e83a83c260d6a50f3df00a0eb012553a912 (patch)
treef6ddd72df044eaa9cabbce37fd4b04f64b978139 /test/CodeGen/SystemZ/int-sub-05.ll
parentb81b477cd4392a51112c3af0659ea9fc176e74f1 (diff)
downloadllvm-fa487e83a83c260d6a50f3df00a0eb012553a912.tar.gz
llvm-fa487e83a83c260d6a50f3df00a0eb012553a912.tar.bz2
llvm-fa487e83a83c260d6a50f3df00a0eb012553a912.tar.xz
[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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ/int-sub-05.ll')
-rw-r--r--test/CodeGen/SystemZ/int-sub-05.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/int-sub-05.ll b/test/CodeGen/SystemZ/int-sub-05.ll
index 1475b244f6..5d95e79080 100644
--- a/test/CodeGen/SystemZ/int-sub-05.ll
+++ b/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
+}