[llvm] r300884 - [InstCombine] add tests for demanded bits ashr/lshr splat constants; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 13:44:54 PDT 2017
Author: spatel
Date: Thu Apr 20 15:44:54 2017
New Revision: 300884
URL: http://llvm.org/viewvc/llvm-project?rev=300884&view=rev
Log:
[InstCombine] add tests for demanded bits ashr/lshr splat constants; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/shift.ll
Modified: llvm/trunk/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift.ll?rev=300884&r1=300883&r2=300884&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift.ll Thu Apr 20 15:44:54 2017
@@ -1268,3 +1268,25 @@ define <2 x i64> @test_64_splat_vec(<2 x
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
+}
+
More information about the llvm-commits
mailing list