diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-04-20 20:44:54 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-04-20 20:44:54 +0000 |
commit | 7e77bed813f25bdb7aff11828a8ce820cdeb5541 (patch) | |
tree | b8a6794e74e2d52f16fd228b3875d1a721d9ae7b | |
parent | ada104888efce709181b5c82983b331e40015d36 (diff) | |
download | bcm5719-llvm-7e77bed813f25bdb7aff11828a8ce820cdeb5541.tar.gz bcm5719-llvm-7e77bed813f25bdb7aff11828a8ce820cdeb5541.zip |
[InstCombine] add tests for demanded bits ashr/lshr splat constants; NFC
llvm-svn: 300884
-rw-r--r-- | llvm/test/Transforms/InstCombine/shift.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll index 60ba35557f7..72d361e8b6d 100644 --- a/llvm/test/Transforms/InstCombine/shift.ll +++ b/llvm/test/Transforms/InstCombine/shift.ll @@ -1268,3 +1268,25 @@ define <2 x i64> @test_64_splat_vec(<2 x i32> %t) { ret <2 x i64> %shl } +define <2 x i8> @ashr_demanded_bits_splat(<2 x i8> %x) { +; CHECK-LABEL: @ashr_demanded_bits_splat( +; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> %x, <i8 -128, i8 -128> +; CHECK-NEXT: [[SHR:%.*]] = ashr exact <2 x i8> [[AND]], <i8 7, i8 7> +; CHECK-NEXT: ret <2 x i8> [[SHR]] +; + %and = and <2 x i8> %x, <i8 128, i8 128> + %shr = ashr <2 x i8> %and, <i8 7, i8 7> + ret <2 x i8> %shr +} + +define <2 x i8> @lshr_demanded_bits_splat(<2 x i8> %x) { +; CHECK-LABEL: @lshr_demanded_bits_splat( +; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> %x, <i8 -128, i8 -128> +; CHECK-NEXT: [[SHR:%.*]] = lshr exact <2 x i8> [[AND]], <i8 7, i8 7> +; CHECK-NEXT: ret <2 x i8> [[SHR]] +; + %and = and <2 x i8> %x, <i8 128, i8 128> + %shr = lshr <2 x i8> %and, <i8 7, i8 7> + ret <2 x i8> %shr +} + |