Skip to content

Commit 1b5ab13

Browse files
committed
[AArch64] add select tests with partial vector undefs; NFC
1 parent 068aa12 commit 1b5ab13

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

llvm/test/CodeGen/AArch64/select-with-and-or.ll

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,66 @@ define <4 x i1> @or_not_vec(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z, <4 x i32>
116116
%s = select <4 x i1> %a, <4 x i1> %b, <4 x i1> <i1 1, i1 1, i1 1, i1 1>
117117
ret <4 x i1> %s
118118
}
119+
120+
define <4 x i1> @and_vec_undef(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z, <4 x i32> %w) {
121+
; CHECK-LABEL: and_vec_undef:
122+
; CHECK: // %bb.0:
123+
; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
124+
; CHECK-NEXT: cmgt v1.4s, v2.4s, v3.4s
125+
; CHECK-NEXT: and v0.16b, v1.16b, v0.16b
126+
; CHECK-NEXT: xtn v0.4h, v0.4s
127+
; CHECK-NEXT: ret
128+
%a = icmp eq <4 x i32> %x, %y
129+
%b = icmp sgt <4 x i32> %z, %w
130+
%s = select <4 x i1> %a, <4 x i1> %b, <4 x i1> <i1 0, i1 undef, i1 0, i1 undef>
131+
ret <4 x i1> %s
132+
}
133+
134+
define <4 x i1> @or_vec_undef(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z, <4 x i32> %w) {
135+
; CHECK-LABEL: or_vec_undef:
136+
; CHECK: // %bb.0:
137+
; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
138+
; CHECK-NEXT: cmgt v1.4s, v2.4s, v3.4s
139+
; CHECK-NEXT: xtn v0.4h, v0.4s
140+
; CHECK-NEXT: xtn v1.4h, v1.4s
141+
; CHECK-NEXT: movi v2.4h, #1
142+
; CHECK-NEXT: bsl v0.8b, v2.8b, v1.8b
143+
; CHECK-NEXT: ret
144+
%a = icmp eq <4 x i32> %x, %y
145+
%b = icmp sgt <4 x i32> %z, %w
146+
%s = select <4 x i1> %a, <4 x i1> <i1 undef, i1 1, i1 1, i1 undef>, <4 x i1> %b
147+
ret <4 x i1> %s
148+
}
149+
150+
define <4 x i1> @and_not_vec_undef(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z, <4 x i32> %w) {
151+
; CHECK-LABEL: and_not_vec_undef:
152+
; CHECK: // %bb.0:
153+
; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
154+
; CHECK-NEXT: cmgt v1.4s, v2.4s, v3.4s
155+
; CHECK-NEXT: xtn v0.4h, v0.4s
156+
; CHECK-NEXT: xtn v1.4h, v1.4s
157+
; CHECK-NEXT: bic v0.8b, v1.8b, v0.8b
158+
; CHECK-NEXT: ret
159+
%a = icmp eq <4 x i32> %x, %y
160+
%b = icmp sgt <4 x i32> %z, %w
161+
%s = select <4 x i1> %a, <4 x i1> <i1 0, i1 0, i1 undef, i1 0>, <4 x i1> %b
162+
ret <4 x i1> %s
163+
}
164+
165+
define <4 x i1> @or_not_vec_undef(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z, <4 x i32> %w) {
166+
; CHECK-LABEL: or_not_vec_undef:
167+
; CHECK: // %bb.0:
168+
; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
169+
; CHECK-NEXT: cmgt v1.4s, v2.4s, v3.4s
170+
; CHECK-NEXT: movi v2.4h, #1
171+
; CHECK-NEXT: xtn v3.4h, v0.4s
172+
; CHECK-NEXT: and v0.16b, v1.16b, v0.16b
173+
; CHECK-NEXT: xtn v0.4h, v0.4s
174+
; CHECK-NEXT: bic v1.8b, v2.8b, v3.8b
175+
; CHECK-NEXT: orr v0.8b, v0.8b, v1.8b
176+
; CHECK-NEXT: ret
177+
%a = icmp eq <4 x i32> %x, %y
178+
%b = icmp sgt <4 x i32> %z, %w
179+
%s = select <4 x i1> %a, <4 x i1> %b, <4 x i1> <i1 1, i1 undef, i1 1, i1 1>
180+
ret <4 x i1> %s
181+
}

0 commit comments

Comments
 (0)