Skip to content

Commit c8f40e7

Browse files
committed
[InstCombine] Add more test variants with poison elements (NFC)
1 parent 11e1378 commit c8f40e7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

llvm/test/Transforms/InstCombine/bit-checks.ll

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,56 @@ define i1 @no_masks_with_logical_or(i32 %a, i32 %b, i32 noundef %c) {
13391339
ret i1 %or2
13401340
}
13411341

1342+
define i1 @no_masks_with_logical_or2(i32 %a, i32 %b, i32 noundef %c) {
1343+
; CHECK-LABEL: @no_masks_with_logical_or2(
1344+
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[B:%.*]], 63
1345+
; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], [[C:%.*]]
1346+
; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], -1
1347+
; CHECK-NEXT: [[OR2:%.*]] = select i1 [[TMP2]], i1 true, i1 [[CMP2]]
1348+
; CHECK-NEXT: ret i1 [[OR2]]
1349+
;
1350+
%cmp1 = icmp ne i32 %a, -1
1351+
%cmp2 = icmp ne i32 %b, 63
1352+
%or1 = select i1 %cmp1, i1 true, i1 %cmp2
1353+
%cmp3 = icmp ne i32 %c, -1
1354+
%or2 = or i1 %or1, %cmp3
1355+
ret i1 %or2
1356+
}
1357+
1358+
define <2 x i1> @no_masks_with_logical_or_vec_poison1(<2 x i32> %a, <2 x i32> %b, <2 x i32> noundef %c) {
1359+
; CHECK-LABEL: @no_masks_with_logical_or_vec_poison1(
1360+
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[A:%.*]], <i32 0, i32 poison>
1361+
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne <2 x i32> [[B:%.*]], <i32 63, i32 poison>
1362+
; CHECK-NEXT: [[OR1:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[CMP2]]
1363+
; CHECK-NEXT: [[CMP3:%.*]] = icmp ne <2 x i32> [[C:%.*]], <i32 0, i32 poison>
1364+
; CHECK-NEXT: [[OR2:%.*]] = or <2 x i1> [[OR1]], [[CMP3]]
1365+
; CHECK-NEXT: ret <2 x i1> [[OR2]]
1366+
;
1367+
%cmp1 = icmp ne <2 x i32> %a, <i32 0, i32 poison>
1368+
%cmp2 = icmp ne <2 x i32> %b, <i32 63, i32 poison>
1369+
%or1 = select <2 x i1> %cmp1, <2 x i1> <i1 true, i1 true>, <2 x i1> %cmp2
1370+
%cmp3 = icmp ne <2 x i32> %c, <i32 0, i32 poison>
1371+
%or2 = or <2 x i1> %or1, %cmp3
1372+
ret <2 x i1> %or2
1373+
}
1374+
1375+
define <2 x i1> @no_masks_with_logical_or_vec_poison2(<2 x i32> %a, <2 x i32> %b, <2 x i32> noundef %c) {
1376+
; CHECK-LABEL: @no_masks_with_logical_or_vec_poison2(
1377+
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[A:%.*]], <i32 -1, i32 poison>
1378+
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne <2 x i32> [[B:%.*]], <i32 63, i32 poison>
1379+
; CHECK-NEXT: [[OR1:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[CMP2]]
1380+
; CHECK-NEXT: [[CMP3:%.*]] = icmp ne <2 x i32> [[C:%.*]], <i32 -1, i32 poison>
1381+
; CHECK-NEXT: [[OR2:%.*]] = or <2 x i1> [[OR1]], [[CMP3]]
1382+
; CHECK-NEXT: ret <2 x i1> [[OR2]]
1383+
;
1384+
%cmp1 = icmp ne <2 x i32> %a, <i32 -1, i32 poison>
1385+
%cmp2 = icmp ne <2 x i32> %b, <i32 63, i32 poison>
1386+
%or1 = select <2 x i1> %cmp1, <2 x i1> <i1 true, i1 true>, <2 x i1> %cmp2
1387+
%cmp3 = icmp ne <2 x i32> %c, <i32 -1, i32 poison>
1388+
%or2 = or <2 x i1> %or1, %cmp3
1389+
ret <2 x i1> %or2
1390+
}
1391+
13421392
define i1 @only_one_masked(i64 %a) {
13431393
; CHECK-LABEL: @only_one_masked(
13441394
; CHECK-NEXT: [[AND:%.*]] = icmp eq i64 [[A:%.*]], -9223372036854775808

0 commit comments

Comments
 (0)