Skip to content

Commit 5765edb

Browse files
committed
[InstSimplify] add vector cmp tests; NFC
1 parent 93f3d7f commit 5765edb

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

llvm/test/Transforms/InstSimplify/compare.ll

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,6 @@ define i1 @icmp_shl_nuw_1(i64 %a) {
14661466
%shl = shl nuw i64 1, %a
14671467
%cmp = icmp ne i64 %shl, 0
14681468
ret i1 %cmp
1469-
14701469
}
14711470

14721471
define i1 @icmp_shl_1_V_ugt_2147483648(i32 %V) {
@@ -1476,7 +1475,39 @@ define i1 @icmp_shl_1_V_ugt_2147483648(i32 %V) {
14761475
%shl = shl i32 1, %V
14771476
%cmp = icmp ugt i32 %shl, 2147483648
14781477
ret i1 %cmp
1478+
}
1479+
1480+
define <2 x i1> @icmp_shl_1_ugt_signmask(<2 x i8> %V) {
1481+
; CHECK-LABEL: @icmp_shl_1_ugt_signmask(
1482+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 1>, [[V:%.*]]
1483+
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i8> [[SHL]], <i8 -128, i8 -128>
1484+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1485+
;
1486+
%shl = shl <2 x i8> <i8 1, i8 1>, %V
1487+
%cmp = icmp ugt <2 x i8> %shl, <i8 128, i8 128>
1488+
ret <2 x i1> %cmp
1489+
}
1490+
1491+
define <2 x i1> @icmp_shl_1_ugt_signmask_undef(<2 x i8> %V) {
1492+
; CHECK-LABEL: @icmp_shl_1_ugt_signmask_undef(
1493+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 1>, [[V:%.*]]
1494+
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i8> [[SHL]], <i8 -128, i8 undef>
1495+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1496+
;
1497+
%shl = shl <2 x i8> <i8 1, i8 1>, %V
1498+
%cmp = icmp ugt <2 x i8> %shl, <i8 128, i8 undef>
1499+
ret <2 x i1> %cmp
1500+
}
14791501

1502+
define <2 x i1> @icmp_shl_1_ugt_signmask_undef2(<2 x i8> %V) {
1503+
; CHECK-LABEL: @icmp_shl_1_ugt_signmask_undef2(
1504+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 undef>, [[V:%.*]]
1505+
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i8> [[SHL]], <i8 undef, i8 -128>
1506+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1507+
;
1508+
%shl = shl <2 x i8> <i8 1, i8 undef>, %V
1509+
%cmp = icmp ugt <2 x i8> %shl, <i8 undef, i8 128>
1510+
ret <2 x i1> %cmp
14801511
}
14811512

14821513
define i1 @icmp_shl_1_V_ule_2147483648(i32 %V) {
@@ -1486,7 +1517,39 @@ define i1 @icmp_shl_1_V_ule_2147483648(i32 %V) {
14861517
%shl = shl i32 1, %V
14871518
%cmp = icmp ule i32 %shl, 2147483648
14881519
ret i1 %cmp
1520+
}
14891521

1522+
define <2 x i1> @icmp_shl_1_ule_signmask(<2 x i8> %V) {
1523+
; CHECK-LABEL: @icmp_shl_1_ule_signmask(
1524+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 1>, [[V:%.*]]
1525+
; CHECK-NEXT: [[CMP:%.*]] = icmp ule <2 x i8> [[SHL]], <i8 -128, i8 -128>
1526+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1527+
;
1528+
%shl = shl <2 x i8> <i8 1, i8 1>, %V
1529+
%cmp = icmp ule <2 x i8> %shl, <i8 128, i8 128>
1530+
ret <2 x i1> %cmp
1531+
}
1532+
1533+
define <2 x i1> @icmp_shl_1_ule_signmask_undef(<2 x i8> %V) {
1534+
; CHECK-LABEL: @icmp_shl_1_ule_signmask_undef(
1535+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 1>, [[V:%.*]]
1536+
; CHECK-NEXT: [[CMP:%.*]] = icmp ule <2 x i8> [[SHL]], <i8 -128, i8 undef>
1537+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1538+
;
1539+
%shl = shl <2 x i8> <i8 1, i8 1>, %V
1540+
%cmp = icmp ule <2 x i8> %shl, <i8 128, i8 undef>
1541+
ret <2 x i1> %cmp
1542+
}
1543+
1544+
define <2 x i1> @icmp_shl_1_ule_signmask_undef2(<2 x i8> %V) {
1545+
; CHECK-LABEL: @icmp_shl_1_ule_signmask_undef2(
1546+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> <i8 1, i8 undef>, [[V:%.*]]
1547+
; CHECK-NEXT: [[CMP:%.*]] = icmp ule <2 x i8> [[SHL]], <i8 undef, i8 -128>
1548+
; CHECK-NEXT: ret <2 x i1> [[CMP]]
1549+
;
1550+
%shl = shl <2 x i8> <i8 1, i8 undef>, %V
1551+
%cmp = icmp ule <2 x i8> %shl, <i8 undef, i8 128>
1552+
ret <2 x i1> %cmp
14901553
}
14911554

14921555
define i1 @icmp_shl_1_V_eq_31(i32 %V) {
@@ -1496,7 +1559,6 @@ define i1 @icmp_shl_1_V_eq_31(i32 %V) {
14961559
%shl = shl i32 1, %V
14971560
%cmp = icmp eq i32 %shl, 31
14981561
ret i1 %cmp
1499-
15001562
}
15011563

15021564
define i1 @icmp_shl_1_V_ne_31(i32 %V) {
@@ -1506,7 +1568,6 @@ define i1 @icmp_shl_1_V_ne_31(i32 %V) {
15061568
%shl = shl i32 1, %V
15071569
%cmp = icmp ne i32 %shl, 31
15081570
ret i1 %cmp
1509-
15101571
}
15111572

15121573
define i1 @tautological1(i32 %A, i32 %B) {

0 commit comments

Comments
 (0)