[llvm] ccf1260 - [InstCombine] Add tests for X shift (A srem B) -> X shift (A and B-1) pow2 nonuniform constant vectors
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 07:35:58 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-09T15:33:06+01:00
New Revision: ccf12607921766d57b0238ee7db5754509935288
URL: https://github.com/llvm/llvm-project/commit/ccf12607921766d57b0238ee7db5754509935288
DIFF: https://github.com/llvm/llvm-project/commit/ccf12607921766d57b0238ee7db5754509935288.diff
LOG: [InstCombine] Add tests for X shift (A srem B) -> X shift (A and B-1) pow2 nonuniform constant vectors
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 ea0954c02b4e..18aac5ac44b0 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -603,6 +603,37 @@ define i32 @test38(i32 %x) nounwind readnone {
ret i32 %shl
}
+define <2 x i32> @test38_uniform(<2 x i32> %x) nounwind readnone {
+; CHECK-LABEL: @test38_uniform(
+; CHECK-NEXT: [[REM1:%.*]] = and <2 x i32> [[X:%.*]], <i32 31, i32 31>
+; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, [[REM1]]
+; CHECK-NEXT: ret <2 x i32> [[SHL]]
+;
+ %rem = srem <2 x i32> %x, <i32 32, i32 32>
+ %shl = shl <2 x i32> <i32 1, i32 1>, %rem
+ ret <2 x i32> %shl
+}
+
+define <3 x i32> @test38_nonuniform(<3 x i32> %x) nounwind readnone {
+; CHECK-LABEL: @test38_nonuniform(
+; CHECK-NEXT: [[REM:%.*]] = srem <3 x i32> [[X:%.*]], <i32 32, i32 16, i32 1>
+; CHECK-NEXT: [[SHL:%.*]] = shl <3 x i32> <i32 1, i32 1, i32 1>, [[REM]]
+; CHECK-NEXT: ret <3 x i32> [[SHL]]
+;
+ %rem = srem <3 x i32> %x, <i32 32, i32 16, i32 1>
+ %shl = shl <3 x i32> <i32 1, i32 1, i32 1>, %rem
+ ret <3 x i32> %shl
+}
+
+define <2 x i32> @test38_undef(<2 x i32> %x) nounwind readnone {
+; CHECK-LABEL: @test38_undef(
+; CHECK-NEXT: ret <2 x i32> undef
+;
+ %rem = srem <2 x i32> %x, <i32 32, i32 undef>
+ %shl = shl <2 x i32> <i32 1, i32 1>, %rem
+ ret <2 x i32> %shl
+}
+
; <rdar://problem/8756731>
define i8 @test39(i32 %a0) {
; CHECK-LABEL: @test39(
More information about the llvm-commits
mailing list