[llvm] af1f016 - [InstCombine] Add lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) vector tests
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 08:56:05 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-09T16:54:46+01:00
New Revision: af1f016436b29ef23eaecd5d909753d3b19f3cf8
URL: https://github.com/llvm/llvm-project/commit/af1f016436b29ef23eaecd5d909753d3b19f3cf8
DIFF: https://github.com/llvm/llvm-project/commit/af1f016436b29ef23eaecd5d909753d3b19f3cf8.diff
LOG: [InstCombine] Add lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) vector tests
Added:
Modified:
llvm/test/Transforms/InstCombine/shift.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index 70ef9c54c1f6..aca47336fc80 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -448,7 +448,6 @@ bb2:
ret i8 %i2
}
-
define i32 @test29(i64 %d18) {
; CHECK-LABEL: @test29(
; CHECK-NEXT: entry:
@@ -463,6 +462,50 @@ entry:
ret i32 %i10
}
+define <2 x i32> @test29_uniform(<2 x i64> %d18) {
+; CHECK-LABEL: @test29_uniform(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[I916:%.*]] = lshr <2 x i64> [[D18:%.*]], <i64 32, i64 32>
+; CHECK-NEXT: [[I917:%.*]] = trunc <2 x i64> [[I916]] to <2 x i32>
+; CHECK-NEXT: [[I10:%.*]] = lshr <2 x i32> [[I917]], <i32 31, i32 31>
+; CHECK-NEXT: ret <2 x i32> [[I10]]
+;
+entry:
+ %i916 = lshr <2 x i64> %d18, <i64 32, i64 32>
+ %i917 = trunc <2 x i64> %i916 to <2 x i32>
+ %i10 = lshr <2 x i32> %i917, <i32 31, i32 31>
+ ret <2 x i32> %i10
+}
+
+define <2 x i32> @test29_nonuniform(<2 x i64> %d18) {
+; CHECK-LABEL: @test29_nonuniform(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[I916:%.*]] = lshr <2 x i64> [[D18:%.*]], <i64 32, i64 15>
+; CHECK-NEXT: [[I917:%.*]] = trunc <2 x i64> [[I916]] to <2 x i32>
+; CHECK-NEXT: [[I10:%.*]] = lshr <2 x i32> [[I917]], <i32 31, i32 22>
+; CHECK-NEXT: ret <2 x i32> [[I10]]
+;
+entry:
+ %i916 = lshr <2 x i64> %d18, <i64 32, i64 15>
+ %i917 = trunc <2 x i64> %i916 to <2 x i32>
+ %i10 = lshr <2 x i32> %i917, <i32 31, i32 22>
+ ret <2 x i32> %i10
+}
+
+define <2 x i32> @test29_undef(<2 x i64> %d18) {
+; CHECK-LABEL: @test29_undef(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[I916:%.*]] = lshr <2 x i64> [[D18:%.*]], <i64 32, i64 undef>
+; CHECK-NEXT: [[I917:%.*]] = trunc <2 x i64> [[I916]] to <2 x i32>
+; CHECK-NEXT: [[I10:%.*]] = lshr <2 x i32> [[I917]], <i32 31, i32 undef>
+; CHECK-NEXT: ret <2 x i32> [[I10]]
+;
+entry:
+ %i916 = lshr <2 x i64> %d18, <i64 32, i64 undef>
+ %i917 = trunc <2 x i64> %i916 to <2 x i32>
+ %i10 = lshr <2 x i32> %i917, <i32 31, i32 undef>
+ ret <2 x i32> %i10
+}
define i32 @test30(i32 %A, i32 %B, i32 %C) {
; CHECK-LABEL: @test30(
More information about the llvm-commits
mailing list