diff options
| author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-07-18 10:14:55 +0000 |
|---|---|---|
| committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-07-18 10:14:55 +0000 |
| commit | 9dffd71d0af3d78ee1f21865dd064fb43bc623be (patch) | |
| tree | b93aa63b62d21fa6a20218d9ba9e75f83e6cccd2 /test | |
| parent | 30a132f7676ec5465a2245cb94e7bd9214ea8eb7 (diff) | |
| download | external_llvm-9dffd71d0af3d78ee1f21865dd064fb43bc623be.zip external_llvm-9dffd71d0af3d78ee1f21865dd064fb43bc623be.tar.gz external_llvm-9dffd71d0af3d78ee1f21865dd064fb43bc623be.tar.bz2 | |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
| -rw-r--r-- | test/CodeGen/SystemZ/risbg-01.ll | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/risbg-01.ll b/test/CodeGen/SystemZ/risbg-01.ll index 0c6826a..6f89fef 100644 --- a/test/CodeGen/SystemZ/risbg-01.ll +++ b/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 +} |
