]> granicus.if.org Git - llvm/commitdiff
[InstCombine] add tests for more shift-shift patterns; NFC
authorSanjay Patel <spatel@rotateright.com>
Mon, 30 Jan 2017 22:24:36 +0000 (22:24 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 30 Jan 2017 22:24:36 +0000 (22:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293555 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/shift.ll

index ea4936e373747c656f2ea86eefa7a3c94f69348b..573cb8dfe1d68deb665b1cd0d64d7d7c924b02d9 100644 (file)
@@ -1007,6 +1007,39 @@ define i32 @test53(i32 %x) {
   ret i32 %B
 }
 
+define <2 x i32> @test53_splat_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test53_splat_vec(
+; CHECK-NEXT:    [[A:%.*]] = shl nuw <2 x i32> %x, <i32 3, i32 3>
+; CHECK-NEXT:    [[B:%.*]] = lshr exact <2 x i32> [[A]], <i32 1, i32 1>
+; CHECK-NEXT:    ret <2 x i32> [[B]]
+;
+  %A = shl nuw <2 x i32> %x, <i32 3, i32 3>
+  %B = lshr <2 x i32> %A, <i32 1, i32 1>
+  ret <2 x i32> %B
+}
+
+define i8 @test53_no_nuw(i8 %x) {
+; CHECK-LABEL: @test53_no_nuw(
+; CHECK-NEXT:    [[TMP1:%.*]] = shl i8 %x, 2
+; CHECK-NEXT:    [[B:%.*]] = and i8 [[TMP1]], 124
+; CHECK-NEXT:    ret i8 [[B]]
+;
+  %A = shl i8 %x, 3
+  %B = lshr i8 %A, 1
+  ret i8 %B
+}
+
+define <2 x i8> @test53_no_nuw_splat_vec(<2 x i8> %x) {
+; CHECK-LABEL: @test53_no_nuw_splat_vec(
+; CHECK-NEXT:    [[A:%.*]] = shl <2 x i8> %x, <i8 3, i8 3>
+; CHECK-NEXT:    [[B:%.*]] = lshr exact <2 x i8> [[A]], <i8 1, i8 1>
+; CHECK-NEXT:    ret <2 x i8> [[B]]
+;
+  %A = shl <2 x i8> %x, <i8 3, i8 3>
+  %B = lshr <2 x i8> %A, <i8 1, i8 1>
+  ret <2 x i8> %B
+}
+
 define i32 @test54(i32 %x) {
 ; CHECK-LABEL: @test54(
 ; CHECK-NEXT:    [[TMP1:%.*]] = shl i32 %x, 3