diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-01-30 18:17:14 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-01-30 18:17:14 +0000 |
| commit | 1a86607d386c00dbe28f9dc879104c80fad99141 (patch) | |
| tree | 7373b69b1e97ee5086a02cff7a118f9f1efaa6d3 /llvm/test/Transforms | |
| parent | d2406ea900faa58bf4d585724407a150cb073215 (diff) | |
| download | bcm5719-llvm-1a86607d386c00dbe28f9dc879104c80fad99141.tar.gz bcm5719-llvm-1a86607d386c00dbe28f9dc879104c80fad99141.zip | |
[InstCombine] add vector splat tests for (X >>?exact C1) << C2 --> X >>?exact (C1-C2); NFC
llvm-svn: 293517
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/shift.ll | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll index 459bd5862bd..0c6655c800d 100644 --- a/llvm/test/Transforms/InstCombine/shift.ll +++ b/llvm/test/Transforms/InstCombine/shift.ll @@ -790,6 +790,8 @@ define i32 @test45(i32 %a) nounwind { ret i32 %z } +; (X >>?exact C1) << C2 --> X >>?exact (C1-C2) + define i32 @test46(i32 %a) { ; CHECK-LABEL: @test46( ; CHECK-NEXT: [[Z:%.*]] = ashr exact i32 %a, 2 @@ -800,14 +802,42 @@ define i32 @test46(i32 %a) { ret i32 %z } -define i32 @test47(i32 %a) { +; (X >>?exact C1) << C2 --> X >>?exact (C1-C2) + +define <2 x i32> @test46_splat_vec(<2 x i32> %a) { +; CHECK-LABEL: @test46_splat_vec( +; CHECK-NEXT: [[Y:%.*]] = ashr exact <2 x i32> %a, <i32 3, i32 3> +; CHECK-NEXT: [[Z:%.*]] = shl nsw <2 x i32> [[Y]], <i32 1, i32 1> +; CHECK-NEXT: ret <2 x i32> [[Z]] +; + %y = ashr exact <2 x i32> %a, <i32 3, i32 3> + %z = shl <2 x i32> %y, <i32 1, i32 1> + ret <2 x i32> %z +} + +; (X >>?exact C1) << C2 --> X >>?exact (C1-C2) + +define i8 @test47(i8 %a) { ; CHECK-LABEL: @test47( -; CHECK-NEXT: [[Z:%.*]] = lshr exact i32 %a, 2 -; CHECK-NEXT: ret i32 [[Z]] +; CHECK-NEXT: [[Z:%.*]] = lshr exact i8 %a, 2 +; CHECK-NEXT: ret i8 [[Z]] ; - %y = lshr exact i32 %a, 3 - %z = shl i32 %y, 1 - ret i32 %z + %y = lshr exact i8 %a, 3 + %z = shl i8 %y, 1 + ret i8 %z +} + +; (X >>?exact C1) << C2 --> X >>?exact (C1-C2) + +define <2 x i8> @test47_splat_vec(<2 x i8> %a) { +; CHECK-LABEL: @test47_splat_vec( +; CHECK-NEXT: [[Y:%.*]] = lshr exact <2 x i8> %a, <i8 3, i8 3> +; CHECK-NEXT: [[Z:%.*]] = shl nuw nsw <2 x i8> [[Y]], <i8 1, i8 1> +; CHECK-NEXT: ret <2 x i8> [[Z]] +; + %y = lshr exact <2 x i8> %a, <i8 3, i8 3> + %z = shl <2 x i8> %y, <i8 1, i8 1> + ret <2 x i8> %z } ; (X >>u,exact C1) << C2 --> X << (C2-C1) when C2 > C1 |

