[llvm] 1d007d0 - [InstCombine] add tests for bitwise logic with bool op; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 20 09:33:34 PST 2021
Author: Sanjay Patel
Date: 2021-11-20T12:32:55-05:00
New Revision: 1d007d0e5a929c3f5cb25aea18d6c8a16326c02e
URL: https://github.com/llvm/llvm-project/commit/1d007d0e5a929c3f5cb25aea18d6c8a16326c02e
DIFF: https://github.com/llvm/llvm-project/commit/1d007d0e5a929c3f5cb25aea18d6c8a16326c02e.diff
LOG: [InstCombine] add tests for bitwise logic with bool op; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/and.ll
llvm/test/Transforms/InstCombine/or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/and.ll b/llvm/test/Transforms/InstCombine/and.ll
index 92e5a75eb47f..ec16ffc36106 100644
--- a/llvm/test/Transforms/InstCombine/and.ll
+++ b/llvm/test/Transforms/InstCombine/and.ll
@@ -1471,6 +1471,16 @@ define i32 @sext_to_sel(i32 %x, i1 %y) {
ret i32 %r
}
+define <2 x i32> @sext_to_sel_constant_vec(<2 x i1> %y) {
+; CHECK-LABEL: @sext_to_sel_constant_vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[Y:%.*]], <2 x i32> <i32 42, i32 -7>, <2 x i32> zeroinitializer
+; CHECK-NEXT: ret <2 x i32> [[R]]
+;
+ %sext = sext <2 x i1> %y to <2 x i32>
+ %r = and <2 x i32> <i32 42, i32 -7>, %sext
+ ret <2 x i32> %r
+}
+
define <2 x i32> @sext_to_sel_swap(<2 x i32> %px, <2 x i1> %y) {
; CHECK-LABEL: @sext_to_sel_swap(
; CHECK-NEXT: [[X:%.*]] = mul <2 x i32> [[PX:%.*]], [[PX]]
diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
index 9fd61eba759c..64266124aab3 100644
--- a/llvm/test/Transforms/InstCombine/or.ll
+++ b/llvm/test/Transforms/InstCombine/or.ll
@@ -618,6 +618,16 @@ define i32 @sext_to_sel(i32 %x, i1 %y) {
ret i32 %r
}
+define <2 x i32> @sext_to_sel_constant_vec(<2 x i1> %y) {
+; CHECK-LABEL: @sext_to_sel_constant_vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[Y:%.*]], <2 x i32> <i32 -1, i32 -1>, <2 x i32> <i32 42, i32 -7>
+; CHECK-NEXT: ret <2 x i32> [[R]]
+;
+ %sext = sext <2 x i1> %y to <2 x i32>
+ %r = or <2 x i32> <i32 42, i32 -7>, %sext
+ ret <2 x i32> %r
+}
+
define <2 x i32> @sext_to_sel_swap(<2 x i32> %px, <2 x i1> %y) {
; CHECK-LABEL: @sext_to_sel_swap(
; CHECK-NEXT: [[X:%.*]] = mul <2 x i32> [[PX:%.*]], [[PX]]
More information about the llvm-commits
mailing list