Skip to content

Commit 4bb4f5b

Browse files
committed
[InstCombine] add tests for vector icmp with undef constant elements; NFC
1 parent f533fa3 commit 4bb4f5b

5 files changed

+54
-0
lines changed

llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
9090
ret <3 x i1> %ret
9191
}
9292

93+
define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
94+
; CHECK-LABEL: @p3_vec_nonsplat_undef(
95+
; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <3 x i8> [[X:%.*]], <i8 -1, i8 undef, i8 3>
96+
; CHECK-NEXT: ret <3 x i1> [[TMP1]]
97+
;
98+
%tmp0 = and <3 x i8> %x, <i8 -1, i8 undef, i8 3>
99+
%ret = icmp ne <3 x i8> %tmp0, %x
100+
ret <3 x i1> %ret
101+
}
102+
93103
; ============================================================================ ;
94104
; Commutativity tests.
95105
; ============================================================================ ;

llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ define <3 x i1> @p3_vec_splat_undef() {
8585
ret <3 x i1> %ret
8686
}
8787

88+
define <3 x i1> @p3_vec_nonsplat_undef() {
89+
; CHECK-LABEL: @p3_vec_nonsplat_undef(
90+
; CHECK-NEXT: [[X:%.*]] = call <3 x i8> @gen3x8()
91+
; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt <3 x i8> [[X]], <i8 15, i8 3, i8 undef>
92+
; CHECK-NEXT: ret <3 x i1> [[TMP1]]
93+
;
94+
%x = call <3 x i8> @gen3x8()
95+
%tmp0 = and <3 x i8> %x, <i8 15, i8 3, i8 undef>
96+
%ret = icmp sgt <3 x i8> %x, %tmp0
97+
ret <3 x i1> %ret
98+
}
99+
88100
; ============================================================================ ;
89101
; One-use tests. We don't care about multi-uses here.
90102
; ============================================================================ ;

llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
6969
ret <3 x i1> %ret
7070
}
7171

72+
define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
73+
; CHECK-LABEL: @p3_vec_nonsplat_undef(
74+
; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt <3 x i8> [[X:%.*]], <i8 undef, i8 15, i8 3>
75+
; CHECK-NEXT: ret <3 x i1> [[TMP1]]
76+
;
77+
%tmp0 = and <3 x i8> %x, <i8 undef, i8 15, i8 3>
78+
%ret = icmp slt <3 x i8> %tmp0, %x
79+
ret <3 x i1> %ret
80+
}
81+
7282
; ============================================================================ ;
7383
; One-use tests. We don't care about multi-uses here.
7484
; ============================================================================ ;

llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ define <3 x i1> @p3_vec_splat_undef() {
108108
ret <3 x i1> %ret
109109
}
110110

111+
define <3 x i1> @p3_vec_nonsplat_undef() {
112+
; CHECK-LABEL: @p3_vec_nonsplat_undef(
113+
; CHECK-NEXT: [[X:%.*]] = call <3 x i8> @gen3x8()
114+
; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <3 x i8> [[X]], <i8 3, i8 undef, i8 15>
115+
; CHECK-NEXT: ret <3 x i1> [[TMP1]]
116+
;
117+
%x = call <3 x i8> @gen3x8()
118+
%tmp0 = and <3 x i8> %x, <i8 3, i8 undef, i8 15>
119+
%ret = icmp ugt <3 x i8> %x, %tmp0
120+
ret <3 x i1> %ret
121+
}
122+
111123
; ============================================================================ ;
112124
; Commutativity tests.
113125
; ============================================================================ ;

llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
9191
ret <3 x i1> %ret
9292
}
9393

94+
define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
95+
; CHECK-LABEL: @p3_vec_nonsplat_undef(
96+
; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <3 x i8> [[X:%.*]], <i8 7, i8 31, i8 undef>
97+
; CHECK-NEXT: ret <3 x i1> [[TMP1]]
98+
;
99+
%tmp0 = and <3 x i8> %x, <i8 7, i8 31, i8 undef>
100+
%ret = icmp ult <3 x i8> %tmp0, %x
101+
ret <3 x i1> %ret
102+
}
103+
94104
; ============================================================================ ;
95105
; Commutativity tests.
96106
; ============================================================================ ;

0 commit comments

Comments
 (0)