Skip to content

Commit 30010f4

Browse files
tonykuttaiTony Varghese
andauthored
[NFC][PowerPC] Pre-commit testcases for locking down the xxsel instructions for ternary(A, X, eqv(B,C)), ternary(A, X, not(C)), ternary(A, X, not(B)), ternary(A, X, nand(B,C)) and ternary(A, X, nor(B,C)) patterns (#158091)
Pre-commit test case for exploitation of `xxsel` for ternary operations of the pattern. This adds support for v4i32, v2i64, v16i8 and v8i16 operand types for the following patterns. The following are the patterns involved in the change: ``` ternary(A, and(B,C), nor(B,C)) ternary(A, B, nor(B,C)) ternary(A, C, nor(B,C)) ternary(A, xor(B,C), nor(B,C)) ternary(A, not(C), nor(B,C)) ternary(A, not(B), nor(B,C)) ternary(A, nand(B,C), nor(B,C)) ternary(A, or(B,C), eqv(B,C)) ternary(A, nor(B,C), eqv(B,C)) ternary(A, not(C), eqv(B,C)) ternary(A, nand(B,C), eqv(B,C)) ternary(A, and(B,C), not(C)) ternary(A, B, not(C)) ternary(A, xor(B,C), not(C)) ternary(A, or(B,C), not(C)) ternary(A, not(B), not(C)) ternary(A, nand(B,C), not(C)) ternary(A, and(B,C), not(B)) ternary(A, xor(B,C), not(B)) ternary(A, or(B,C), not(B)) ternary(A, nand(B,C), not(B)) ternary(A, B, nand(B,C)) ternary(A, C, nand(B,C)) ternary(A, xor(B,C), nand(B,C)) ternary(A, or(B,C), nand(B,C)) ternary(A, eqv(B,C), nand(B,C)) ``` Exploitation of `xxeval` for the above patterns to be added as a follow up. Co-authored-by: Tony Varghese <[email protected]>
1 parent 5621fa1 commit 30010f4

File tree

5 files changed

+2001
-0
lines changed

5 files changed

+2001
-0
lines changed
Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; Test file to verify the emission of Vector Evaluate instructions when ternary operators are used.
3+
4+
; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64le-unknown-unknown \
5+
; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s
6+
7+
; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc-ibm-aix-xcoff \
8+
; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s
9+
10+
; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64-ibm-aix-xcoff \
11+
; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s
12+
13+
; Function to test ternary(A, or(B, C), eqv(B, C)) for <4 x i32>
14+
define <4 x i32> @ternary_A_or_BC_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
15+
; CHECK-LABEL: ternary_A_or_BC_eqv_BC_4x32:
16+
; CHECK: # %bb.0: # %entry
17+
; CHECK-NEXT: xxleqv v5, v5, v5
18+
; CHECK-NEXT: xxlor vs0, v3, v4
19+
; CHECK-NEXT: xxleqv vs1, v3, v4
20+
; CHECK-NEXT: vslw v2, v2, v5
21+
; CHECK-NEXT: vsraw v2, v2, v5
22+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
23+
; CHECK-NEXT: blr
24+
entry:
25+
%or = or <4 x i32> %B, %C
26+
%xor = xor <4 x i32> %B, %C
27+
%eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
28+
%res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %eqv
29+
ret <4 x i32> %res
30+
}
31+
32+
; Function to test ternary(A, or(B, C), eqv(B, C)) for <2 x i64>
33+
define <2 x i64> @ternary_A_or_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
34+
; CHECK-LABEL: ternary_A_or_BC_eqv_BC_2x64:
35+
; CHECK: # %bb.0: # %entry
36+
; CHECK-NEXT: xxlxor v5, v5, v5
37+
; CHECK-NEXT: xxlor vs0, v3, v4
38+
; CHECK-NEXT: xxleqv vs1, v3, v4
39+
; CHECK-NEXT: xxsplti32dx v5, 1, 63
40+
; CHECK-NEXT: vsld v2, v2, v5
41+
; CHECK-NEXT: vsrad v2, v2, v5
42+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
43+
; CHECK-NEXT: blr
44+
entry:
45+
%or = or <2 x i64> %B, %C
46+
%xor = xor <2 x i64> %B, %C
47+
%eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
48+
%res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %eqv
49+
ret <2 x i64> %res
50+
}
51+
52+
; Function to test ternary(A, or(B, C), eqv(B, C)) for <16 x i8>
53+
define <16 x i8> @ternary_A_or_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
54+
; CHECK-LABEL: ternary_A_or_BC_eqv_BC_16x8:
55+
; CHECK: # %bb.0: # %entry
56+
; CHECK-NEXT: xxspltib v5, 7
57+
; CHECK-NEXT: xxlor vs0, v3, v4
58+
; CHECK-NEXT: xxleqv vs1, v3, v4
59+
; CHECK-NEXT: vslb v2, v2, v5
60+
; CHECK-NEXT: vsrab v2, v2, v5
61+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
62+
; CHECK-NEXT: blr
63+
entry:
64+
%or = or <16 x i8> %B, %C
65+
%xor = xor <16 x i8> %B, %C
66+
%eqv = xor <16 x i8> %xor, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector eqv operation
67+
%res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %eqv
68+
ret <16 x i8> %res
69+
}
70+
71+
; Function to test ternary(A, or(B, C), eqv(B, C)) for <8 x i16>
72+
define <8 x i16> @ternary_A_or_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
73+
; CHECK-LABEL: ternary_A_or_BC_eqv_BC_8x16:
74+
; CHECK: # %bb.0: # %entry
75+
; CHECK-NEXT: xxspltiw v5, 983055
76+
; CHECK-NEXT: xxlor vs0, v3, v4
77+
; CHECK-NEXT: xxleqv vs1, v3, v4
78+
; CHECK-NEXT: vslh v2, v2, v5
79+
; CHECK-NEXT: vsrah v2, v2, v5
80+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
81+
; CHECK-NEXT: blr
82+
entry:
83+
%or = or <8 x i16> %B, %C
84+
%xor = xor <8 x i16> %B, %C
85+
%eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation
86+
%res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %eqv
87+
ret <8 x i16> %res
88+
}
89+
90+
; Function to test ternary(A, nor(B, C), eqv(B, C)) for <4 x i32>
91+
define <4 x i32> @ternary_A_nor_BC_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
92+
; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_4x32:
93+
; CHECK: # %bb.0: # %entry
94+
; CHECK-NEXT: xxleqv v5, v5, v5
95+
; CHECK-NEXT: xxlnor vs0, v3, v4
96+
; CHECK-NEXT: xxleqv vs1, v3, v4
97+
; CHECK-NEXT: vslw v2, v2, v5
98+
; CHECK-NEXT: vsraw v2, v2, v5
99+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
100+
; CHECK-NEXT: blr
101+
entry:
102+
%or = or <4 x i32> %B, %C
103+
%nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector NOR operation
104+
%xor = xor <4 x i32> %B, %C
105+
%eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
106+
%res = select <4 x i1> %A, <4 x i32> %nor, <4 x i32> %eqv
107+
ret <4 x i32> %res
108+
}
109+
110+
; Function to test ternary(A, nor(B, C), eqv(B, C)) for <2 x i64>
111+
define <2 x i64> @ternary_A_nor_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
112+
; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_2x64:
113+
; CHECK: # %bb.0: # %entry
114+
; CHECK-NEXT: xxlxor v5, v5, v5
115+
; CHECK-NEXT: xxlnor vs0, v3, v4
116+
; CHECK-NEXT: xxleqv vs1, v3, v4
117+
; CHECK-NEXT: xxsplti32dx v5, 1, 63
118+
; CHECK-NEXT: vsld v2, v2, v5
119+
; CHECK-NEXT: vsrad v2, v2, v5
120+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
121+
; CHECK-NEXT: blr
122+
entry:
123+
%or = or <2 x i64> %B, %C
124+
%nor = xor <2 x i64> %or, <i64 -1, i64 -1> ; Vector NOR operation
125+
%xor = xor <2 x i64> %B, %C
126+
%eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
127+
%res = select <2 x i1> %A, <2 x i64> %nor, <2 x i64> %eqv
128+
ret <2 x i64> %res
129+
}
130+
131+
; Function to test ternary(A, nor(B, C), eqv(B, C)) for <16 x i8>
132+
define <16 x i8> @ternary_A_nor_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
133+
; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_16x8:
134+
; CHECK: # %bb.0: # %entry
135+
; CHECK-NEXT: xxspltib v5, 7
136+
; CHECK-NEXT: xxlnor vs0, v3, v4
137+
; CHECK-NEXT: xxleqv vs1, v3, v4
138+
; CHECK-NEXT: vslb v2, v2, v5
139+
; CHECK-NEXT: vsrab v2, v2, v5
140+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
141+
; CHECK-NEXT: blr
142+
entry:
143+
%or = or <16 x i8> %B, %C
144+
%nor = xor <16 x i8> %or, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector NOR operation
145+
%xor = xor <16 x i8> %B, %C
146+
%eqv = xor <16 x i8> %xor, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector eqv operation
147+
%res = select <16 x i1> %A, <16 x i8> %nor, <16 x i8> %eqv
148+
ret <16 x i8> %res
149+
}
150+
151+
; Function to test ternary(A, nor(B, C), eqv(B, C)) for <8 x i16>
152+
define <8 x i16> @ternary_A_nor_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
153+
; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_8x16:
154+
; CHECK: # %bb.0: # %entry
155+
; CHECK-NEXT: xxspltiw v5, 983055
156+
; CHECK-NEXT: xxlnor vs0, v3, v4
157+
; CHECK-NEXT: xxleqv vs1, v3, v4
158+
; CHECK-NEXT: vslh v2, v2, v5
159+
; CHECK-NEXT: vsrah v2, v2, v5
160+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
161+
; CHECK-NEXT: blr
162+
entry:
163+
%or = or <8 x i16> %B, %C
164+
%nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector NOR operation
165+
%xor = xor <8 x i16> %B, %C
166+
%eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation
167+
%res = select <8 x i1> %A, <8 x i16> %nor, <8 x i16> %eqv
168+
ret <8 x i16> %res
169+
}
170+
171+
; Function to test ternary(A, not(C), eqv(B, C)) for <4 x i32>
172+
define <4 x i32> @ternary_A_not_C_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
173+
; CHECK-LABEL: ternary_A_not_C_eqv_BC_4x32:
174+
; CHECK: # %bb.0: # %entry
175+
; CHECK-NEXT: xxleqv v5, v5, v5
176+
; CHECK-NEXT: xxlnor vs0, v4, v4
177+
; CHECK-NEXT: xxleqv vs1, v4, v3
178+
; CHECK-NEXT: vslw v2, v2, v5
179+
; CHECK-NEXT: vsraw v2, v2, v5
180+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
181+
; CHECK-NEXT: blr
182+
entry:
183+
%not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
184+
%xor = xor <4 x i32> %B, %C
185+
%eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
186+
%res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %eqv
187+
ret <4 x i32> %res
188+
}
189+
190+
; Function to test ternary(A, not(C), eqv(B, C)) for <2 x i64>
191+
define <2 x i64> @ternary_A_not_C_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
192+
; CHECK-LABEL: ternary_A_not_C_eqv_BC_2x64:
193+
; CHECK: # %bb.0: # %entry
194+
; CHECK-NEXT: xxlxor v5, v5, v5
195+
; CHECK-NEXT: xxlnor vs0, v4, v4
196+
; CHECK-NEXT: xxleqv vs1, v4, v3
197+
; CHECK-NEXT: xxsplti32dx v5, 1, 63
198+
; CHECK-NEXT: vsld v2, v2, v5
199+
; CHECK-NEXT: vsrad v2, v2, v5
200+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
201+
; CHECK-NEXT: blr
202+
entry:
203+
%not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
204+
%xor = xor <2 x i64> %B, %C
205+
%eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
206+
%res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %eqv
207+
ret <2 x i64> %res
208+
}
209+
210+
; Function to test ternary(A, not(C), eqv(B, C)) for <16 x i8>
211+
define <16 x i8> @ternary_A_not_C_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
212+
; CHECK-LABEL: ternary_A_not_C_eqv_BC_16x8:
213+
; CHECK: # %bb.0: # %entry
214+
; CHECK-NEXT: xxspltib v5, 7
215+
; CHECK-NEXT: xxlnor vs0, v4, v4
216+
; CHECK-NEXT: xxleqv vs1, v4, v3
217+
; CHECK-NEXT: vslb v2, v2, v5
218+
; CHECK-NEXT: vsrab v2, v2, v5
219+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
220+
; CHECK-NEXT: blr
221+
entry:
222+
%not = xor <16 x i8> %C, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector not operation
223+
%xor = xor <16 x i8> %B, %C
224+
%eqv = xor <16 x i8> %xor, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector eqv operation
225+
%res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %eqv
226+
ret <16 x i8> %res
227+
}
228+
229+
; Function to test ternary(A, not(C), eqv(B, C)) for <8 x i16>
230+
define <8 x i16> @ternary_A_not_C_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
231+
; CHECK-LABEL: ternary_A_not_C_eqv_BC_8x16:
232+
; CHECK: # %bb.0: # %entry
233+
; CHECK-NEXT: xxspltiw v5, 983055
234+
; CHECK-NEXT: xxlnor vs0, v4, v4
235+
; CHECK-NEXT: xxleqv vs1, v4, v3
236+
; CHECK-NEXT: vslh v2, v2, v5
237+
; CHECK-NEXT: vsrah v2, v2, v5
238+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
239+
; CHECK-NEXT: blr
240+
entry:
241+
%not = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
242+
%xor = xor <8 x i16> %B, %C
243+
%eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation
244+
%res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %eqv
245+
ret <8 x i16> %res
246+
}
247+
248+
; Function to test ternary(A, nand(B, C), eqv(B, C)) for <4 x i32>
249+
define <4 x i32> @ternary_A_nand_BC_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
250+
; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_4x32:
251+
; CHECK: # %bb.0: # %entry
252+
; CHECK-NEXT: xxleqv v5, v5, v5
253+
; CHECK-NEXT: xxlnand vs0, v3, v4
254+
; CHECK-NEXT: xxleqv vs1, v3, v4
255+
; CHECK-NEXT: vslw v2, v2, v5
256+
; CHECK-NEXT: vsraw v2, v2, v5
257+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
258+
; CHECK-NEXT: blr
259+
entry:
260+
%and = and <4 x i32> %B, %C
261+
%nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation
262+
%xor = xor <4 x i32> %B, %C
263+
%eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
264+
%res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %eqv
265+
ret <4 x i32> %res
266+
}
267+
268+
; Function to test ternary(A, nand(B, C), eqv(B, C)) for <2 x i64>
269+
define <2 x i64> @ternary_A_nand_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
270+
; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_2x64:
271+
; CHECK: # %bb.0: # %entry
272+
; CHECK-NEXT: xxlxor v5, v5, v5
273+
; CHECK-NEXT: xxlnand vs0, v3, v4
274+
; CHECK-NEXT: xxleqv vs1, v3, v4
275+
; CHECK-NEXT: xxsplti32dx v5, 1, 63
276+
; CHECK-NEXT: vsld v2, v2, v5
277+
; CHECK-NEXT: vsrad v2, v2, v5
278+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
279+
; CHECK-NEXT: blr
280+
entry:
281+
%and = and <2 x i64> %B, %C
282+
%nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation
283+
%xor = xor <2 x i64> %B, %C
284+
%eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
285+
%res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %eqv
286+
ret <2 x i64> %res
287+
}
288+
289+
; Function to test ternary(A, nand(B, C), eqv(B, C)) for <16 x i8>
290+
define <16 x i8> @ternary_A_nand_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
291+
; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_16x8:
292+
; CHECK: # %bb.0: # %entry
293+
; CHECK-NEXT: xxspltib v5, 7
294+
; CHECK-NEXT: xxlnand vs0, v3, v4
295+
; CHECK-NEXT: xxleqv vs1, v3, v4
296+
; CHECK-NEXT: vslb v2, v2, v5
297+
; CHECK-NEXT: vsrab v2, v2, v5
298+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
299+
; CHECK-NEXT: blr
300+
entry:
301+
%and = and <16 x i8> %B, %C
302+
%nand = xor <16 x i8> %and, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector nand operation
303+
%xor = xor <16 x i8> %B, %C
304+
%eqv = xor <16 x i8> %xor, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector eqv operation
305+
%res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %eqv
306+
ret <16 x i8> %res
307+
}
308+
309+
; Function to test ternary(A, nand(B, C), eqv(B, C)) for <8 x i16>
310+
define <8 x i16> @ternary_A_nand_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
311+
; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_8x16:
312+
; CHECK: # %bb.0: # %entry
313+
; CHECK-NEXT: xxspltiw v5, 983055
314+
; CHECK-NEXT: xxlnand vs0, v3, v4
315+
; CHECK-NEXT: xxleqv vs1, v3, v4
316+
; CHECK-NEXT: vslh v2, v2, v5
317+
; CHECK-NEXT: vsrah v2, v2, v5
318+
; CHECK-NEXT: xxsel v2, vs1, vs0, v2
319+
; CHECK-NEXT: blr
320+
entry:
321+
%and = and <8 x i16> %B, %C
322+
%nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation
323+
%xor = xor <8 x i16> %B, %C
324+
%eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation
325+
%res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %eqv
326+
ret <8 x i16> %res
327+
}

0 commit comments

Comments
 (0)