diff options
author | Zhan Jun Liau <zhanjunl@ca.ibm.com> | 2016-06-22 16:16:27 +0000 |
---|---|---|
committer | Zhan Jun Liau <zhanjunl@ca.ibm.com> | 2016-06-22 16:16:27 +0000 |
commit | 464847757fd99da9f1347871f9bc71c37df4b0ef (patch) | |
tree | 9cef2fa6593287b78b1728ae4897299916c89321 /test/CodeGen/SystemZ/risbg-01.ll | |
parent | 065537a5a0aa92ef46b40b23b559a975f1b089f4 (diff) |
[SystemZ] Recognize RISBG opportunities involving a truncate
Summary:
Recognize RISBG opportunities where the end result is narrower than the
original input - where a truncate separates the shift/and operations.
The motivating case is some code in postgres which looks like:
srlg %r2, %r0, 11
nilh %r2, 255
Reviewers: uweigand
Author: RolandF
Differential Revision: http://reviews.llvm.org/D21452
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ/risbg-01.ll')
-rw-r--r-- | test/CodeGen/SystemZ/risbg-01.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/risbg-01.ll b/test/CodeGen/SystemZ/risbg-01.ll index d75e8e4b11a..1c4315343de 100644 --- a/test/CodeGen/SystemZ/risbg-01.ll +++ b/test/CodeGen/SystemZ/risbg-01.ll @@ -480,3 +480,24 @@ define i64 @f42(i1 %x) { %ext2 = zext i8 %ext to i64 ret i64 %ext2 } + +; Check that we get the case where a 64-bit shift is used by a 32-bit and. +define signext i32 @f43(i64 %x) { +; CHECK-LABEL: f43: +; CHECK: risbg [[REG:%r[0-5]]], %r2, 32, 189, 52 +; CHECK: lgfr %r2, [[REG]] + %shr3 = lshr i64 %x, 12 + %shr3.tr = trunc i64 %shr3 to i32 + %conv = and i32 %shr3.tr, -4 + ret i32 %conv +} + +; Check that we don't get the case where the 32-bit and mask is not contiguous +define signext i32 @f44(i64 %x) { +; CHECK-LABEL: f44: +; CHECK: srlg [[REG:%r[0-5]]], %r2, 12 + %shr4 = lshr i64 %x, 12 + %conv = trunc i64 %shr4 to i32 + %and = and i32 %conv, 10 + ret i32 %and +} |