summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-18 10:14:55 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-18 10:14:55 +0000
commit297f7d27247b0cd6955b70674dde7a6e1b2526b6 (patch)
tree3106b6232b7a6bb05684e596c6dda3371c166886 /llvm/test
parent7878b852e63edb758f89f28313be31f8bf1bc92f (diff)
downloadbcm5719-llvm-297f7d27247b0cd6955b70674dde7a6e1b2526b6.tar.gz
bcm5719-llvm-297f7d27247b0cd6955b70674dde7a6e1b2526b6.zip
[SystemZ] Generalize RxSBG SRA case
The original code only folded SRA into ROTATE ... SELECTED BITS if there was no outer shift. This patch splits out that check and generalises it slightly. The extra cases aren't really that interesting, but this is paving the way for RNSBG support. llvm-svn: 186571
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/SystemZ/risbg-01.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/risbg-01.ll b/llvm/test/CodeGen/SystemZ/risbg-01.ll
index 0c6826ad1f3..6f89fefd9fe 100644
--- a/llvm/test/CodeGen/SystemZ/risbg-01.ll
+++ b/llvm/test/CodeGen/SystemZ/risbg-01.ll
@@ -416,3 +416,41 @@ define i64 @f37(i64 %foo) {
%shl = lshr i64 %and, 1
ret i64 %shl
}
+
+; Test a combination involving a large ASHR and a shift left. We can't
+; use RISBG there.
+define i64 @f38(i64 %foo) {
+; CHECK-LABEL: f38:
+; CHECK: srag {{%r[0-5]}}
+; CHECK: sllg {{%r[0-5]}}
+; CHECK: br %r14
+ %ashr = ashr i64 %foo, 32
+ %shl = shl i64 %ashr, 5
+ ret i64 %shl
+}
+
+; Try a similar thing in which no shifted sign bits are kept.
+define i64 @f39(i64 %foo, i64 *%dest) {
+; CHECK-LABEL: f39:
+; CHECK: srag [[REG:%r[01345]]], %r2, 35
+; CHECK: risbg %r2, %r2, 33, 189, 31
+; CHECK: br %r14
+ %ashr = ashr i64 %foo, 35
+ store i64 %ashr, i64 *%dest
+ %shl = shl i64 %ashr, 2
+ %and = and i64 %shl, 2147483647
+ ret i64 %and
+}
+
+; ...and again with the next highest shift value, where one sign bit is kept.
+define i64 @f40(i64 %foo, i64 *%dest) {
+; CHECK-LABEL: f40:
+; CHECK: srag [[REG:%r[01345]]], %r2, 36
+; CHECK: risbg %r2, [[REG]], 33, 189, 2
+; CHECK: br %r14
+ %ashr = ashr i64 %foo, 36
+ store i64 %ashr, i64 *%dest
+ %shl = shl i64 %ashr, 2
+ %and = and i64 %shl, 2147483647
+ ret i64 %and
+}
OpenPOWER on IntegriCloud