summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-31 12:58:26 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-31 12:58:26 +0000
commit791bea4182a225eb3c05dea1da3a36fc5afe084f (patch)
tree1dd15a63a8fb7c3945e67e8c4502500005b2c792 /llvm/test/CodeGen/SystemZ
parentee8343822e6a17f1946b32f95517f1253d25cb5c (diff)
downloadbcm5719-llvm-791bea4182a225eb3c05dea1da3a36fc5afe084f.tar.gz
bcm5719-llvm-791bea4182a225eb3c05dea1da3a36fc5afe084f.zip
[SystemZ] Implement isLegalAddressingMode()
The loop optimizers were assuming that scales > 1 were OK. I think this is actually a bug in TargetLoweringBase::isLegalAddressingMode(), since it seems to be trying to reject anything that isn't r+i or r+r, but it has no default case for scales other than 0, 1 or 2. Implementing the hook for z means that z can no longer test any change there though. llvm-svn: 187497
Diffstat (limited to 'llvm/test/CodeGen/SystemZ')
-rw-r--r--llvm/test/CodeGen/SystemZ/loop-01.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/loop-01.ll b/llvm/test/CodeGen/SystemZ/loop-01.ll
new file mode 100644
index 00000000000..025a34eaf5c
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/loop-01.ll
@@ -0,0 +1,25 @@
+; Test loop tuning.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
+
+; Test that strength reduction is applied to addresses with a scale factor,
+; but that indexed addressing can still be used.
+define void @f1(i32 *%dest, i32 %a) {
+; CHECK-LABEL: f1
+; CHECK-NOT: sllg
+; CHECK: st %r3, 0({{%r[1-5],%r[1-5]}})
+; CHECK: br %r14
+entry:
+ br label %loop
+
+loop:
+ %index = phi i64 [ 0, %entry ], [ %next, %loop ]
+ %ptr = getelementptr i32 *%dest, i64 %index
+ store i32 %a, i32 *%ptr
+ %next = add i64 %index, 1
+ %cmp = icmp ne i64 %next, 100
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}
OpenPOWER on IntegriCloud