diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-10-17 11:16:57 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-10-17 11:16:57 +0000 |
commit | f9a5e40b90e5a98cfae5c0f8a42eedd71c849dbc (patch) | |
tree | 6b2d84bec6f2deb4205d3e6d0f1c26ccc591267a /test/CodeGen/SystemZ | |
parent | 888cbad774acdff580611f6b07daaf96e825b7e7 (diff) | |
download | external_llvm-f9a5e40b90e5a98cfae5c0f8a42eedd71c849dbc.zip external_llvm-f9a5e40b90e5a98cfae5c0f8a42eedd71c849dbc.tar.gz external_llvm-f9a5e40b90e5a98cfae5c0f8a42eedd71c849dbc.tar.bz2 |
Replace sra with srl if a single sign bit is required
E.g. (and (sra (i32 x) 31) 2) -> (and (srl (i32 x) 30) 2).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ')
-rw-r--r-- | test/CodeGen/SystemZ/shift-10.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/shift-10.ll b/test/CodeGen/SystemZ/shift-10.ll index 3fd9657..46ed218 100644 --- a/test/CodeGen/SystemZ/shift-10.ll +++ b/test/CodeGen/SystemZ/shift-10.ll @@ -64,3 +64,15 @@ define i64 @f5(i32 %a) { %or = or i64 %shl, 7 ret i64 %or } + +; Test that SRA gets replaced with SRL if the sign bit is the only one +; that matters. +define i64 @f6(i64 %a) { +; CHECK-LABEL: f6: +; CHECK: risbg %r2, %r2, 55, 183, 19 +; CHECK: br %r14 + %shl = shl i64 %a, 10 + %shr = ashr i64 %shl, 60 + %and = and i64 %shr, 256 + ret i64 %and +} |