diff options
| author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-11-26 10:53:16 +0000 |
|---|---|---|
| committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-11-26 10:53:16 +0000 |
| commit | dd7dd930d18acc95b344d768d632c5f9173c7077 (patch) | |
| tree | 71b9c7601a1fbaff81cd185f94141fb535528816 /llvm/test/CodeGen | |
| parent | 71d95d6e51641e8475cf4d1664582c1ca5537924 (diff) | |
| download | bcm5719-llvm-dd7dd930d18acc95b344d768d632c5f9173c7077.tar.gz bcm5719-llvm-dd7dd930d18acc95b344d768d632c5f9173c7077.zip | |
[SystemZ] Fix incorrect use of RISBG for a zero-extended right shift
We would wrongly transform the testcase into the equivalent of an AND with 1.
The problem was that, when testing whether the shifted-in bits of the right
shift were significant, we used the width of the final zero-extended result
rather than the width of the shifted value.
llvm-svn: 195731
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/risbg-01.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/risbg-01.ll b/llvm/test/CodeGen/SystemZ/risbg-01.ll index 8a5d4874f68..a4d11fdae5b 100644 --- a/llvm/test/CodeGen/SystemZ/risbg-01.ll +++ b/llvm/test/CodeGen/SystemZ/risbg-01.ll @@ -456,3 +456,17 @@ define i64 @f40(i64 %foo, i64 *%dest) { %and = and i64 %shl, 2147483647 ret i64 %and } + +; In this case the sign extension is converted to a pair of 32-bit shifts, +; which is then extended to 64 bits. We previously used the wrong bit size +; when testing whether the shifted-in bits of the shift right were significant. +define i64 @f41(i1 %x) { +; CHECK-LABEL: f41: +; CHECK: sll %r2, 31 +; CHECK: sra %r2, 31 +; CHECK: llgcr %r2, %r2 +; CHECK: br %r14 + %ext = sext i1 %x to i8 + %ext2 = zext i8 %ext to i64 + ret i64 %ext2 +} |

