Debian Codegraph @

llvm/test/CodeGen/PowerPC/xxeval-vselect-x-not-c.ll

raw
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, and(B, C), not(C)) for <4 x i32>
14 define <4 x i32> @ternary_A_and_BC_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
15 ; CHECK-LABEL: ternary_A_and_BC_not_C_4x32:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: xxleqv v5, v5, v5
18 ; CHECK-NEXT: vslw v2, v2, v5
19 ; CHECK-NEXT: vsraw v2, v2, v5
20 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 161
21 ; CHECK-NEXT: blr
22 entry:
23 %and = and <4 x i32> %B, %C
24 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
25 %res = select <4 x i1> %A, <4 x i32> %and, <4 x i32> %not
26 ret <4 x i32> %res
27 }
28
29 ; Function to test ternary(A, and(B, C), not(C)) for <2 x i64>
30 define <2 x i64> @ternary_A_and_BC_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
31 ; CHECK-LABEL: ternary_A_and_BC_not_C_2x64:
32 ; CHECK: # %bb.0: # %entry
33 ; CHECK-NEXT: xxlxor v5, v5, v5
34 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
35 ; CHECK-NEXT: vsld v2, v2, v5
36 ; CHECK-NEXT: vsrad v2, v2, v5
37 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 161
38 ; CHECK-NEXT: blr
39 entry:
40 %and = and <2 x i64> %B, %C
41 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
42 %res = select <2 x i1> %A, <2 x i64> %and, <2 x i64> %not
43 ret <2 x i64> %res
44 }
45
46 ; Function to test ternary(A, and(B, C), not(C)) for <16 x i8>
47 define <16 x i8> @ternary_A_and_BC_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
48 ; CHECK-LABEL: ternary_A_and_BC_not_C_16x8:
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: xxspltib v5, 7
51 ; CHECK-NEXT: vslb v2, v2, v5
52 ; CHECK-NEXT: vsrab v2, v2, v5
53 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 161
54 ; CHECK-NEXT: blr
55 entry:
56 %and = and <16 x i8> %B, %C
57 %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
58 %res = select <16 x i1> %A, <16 x i8> %and, <16 x i8> %not
59 ret <16 x i8> %res
60 }
61
62 ; Function to test ternary(A, and(B, C), not(C)) for <8 x i16>
63 define <8 x i16> @ternary_A_and_BC_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
64 ; CHECK-LABEL: ternary_A_and_BC_not_C_8x16:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK-NEXT: xxspltiw v5, 983055
67 ; CHECK-NEXT: vslh v2, v2, v5
68 ; CHECK-NEXT: vsrah v2, v2, v5
69 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 161
70 ; CHECK-NEXT: blr
71 entry:
72 %and = and <8 x i16> %B, %C
73 %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
74 %res = select <8 x i1> %A, <8 x i16> %and, <8 x i16> %not
75 ret <8 x i16> %res
76 }
77
78 ; Function to test ternary(A, B, not(C)) for <4 x i32>
79 define <4 x i32> @ternary_A_B_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
80 ; CHECK-LABEL: ternary_A_B_not_C_4x32:
81 ; CHECK: # %bb.0: # %entry
82 ; CHECK-NEXT: xxleqv v5, v5, v5
83 ; CHECK-NEXT: vslw v2, v2, v5
84 ; CHECK-NEXT: vsraw v2, v2, v5
85 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 163
86 ; CHECK-NEXT: blr
87 entry:
88 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
89 %res = select <4 x i1> %A, <4 x i32> %B, <4 x i32> %not
90 ret <4 x i32> %res
91 }
92
93 ; Function to test ternary(A, B, not(C)) for <2 x i64>
94 define <2 x i64> @ternary_A_B_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
95 ; CHECK-LABEL: ternary_A_B_not_C_2x64:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK-NEXT: xxlxor v5, v5, v5
98 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
99 ; CHECK-NEXT: vsld v2, v2, v5
100 ; CHECK-NEXT: vsrad v2, v2, v5
101 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 163
102 ; CHECK-NEXT: blr
103 entry:
104 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
105 %res = select <2 x i1> %A, <2 x i64> %B, <2 x i64> %not
106 ret <2 x i64> %res
107 }
108
109 ; Function to test ternary(A, B, not(C)) for <16 x i8>
110 define <16 x i8> @ternary_A_B_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
111 ; CHECK-LABEL: ternary_A_B_not_C_16x8:
112 ; CHECK: # %bb.0: # %entry
113 ; CHECK-NEXT: xxspltib v5, 7
114 ; CHECK-NEXT: vslb v2, v2, v5
115 ; CHECK-NEXT: vsrab v2, v2, v5
116 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 163
117 ; CHECK-NEXT: blr
118 entry:
119 %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
120 %res = select <16 x i1> %A, <16 x i8> %B, <16 x i8> %not
121 ret <16 x i8> %res
122 }
123
124 ; Function to test ternary(A, B, not(C)) for <8 x i16>
125 define <8 x i16> @ternary_A_B_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
126 ; CHECK-LABEL: ternary_A_B_not_C_8x16:
127 ; CHECK: # %bb.0: # %entry
128 ; CHECK-NEXT: xxspltiw v5, 983055
129 ; CHECK-NEXT: vslh v2, v2, v5
130 ; CHECK-NEXT: vsrah v2, v2, v5
131 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 163
132 ; CHECK-NEXT: blr
133 entry:
134 %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
135 %res = select <8 x i1> %A, <8 x i16> %B, <8 x i16> %not
136 ret <8 x i16> %res
137 }
138
139 ; Function to test ternary(A, xor(B, C), not(C)) for <4 x i32>
140 define <4 x i32> @ternary_A_xor_BC_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
141 ; CHECK-LABEL: ternary_A_xor_BC_not_C_4x32:
142 ; CHECK: # %bb.0: # %entry
143 ; CHECK-NEXT: xxleqv v5, v5, v5
144 ; CHECK-NEXT: vslw v2, v2, v5
145 ; CHECK-NEXT: vsraw v2, v2, v5
146 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 166
147 ; CHECK-NEXT: blr
148 entry:
149 %xor = xor <4 x i32> %B, %C
150 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
151 %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %not
152 ret <4 x i32> %res
153 }
154
155 ; Function to test ternary(A, xor(B, C), not(C)) for <2 x i64>
156 define <2 x i64> @ternary_A_xor_BC_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
157 ; CHECK-LABEL: ternary_A_xor_BC_not_C_2x64:
158 ; CHECK: # %bb.0: # %entry
159 ; CHECK-NEXT: xxlxor v5, v5, v5
160 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
161 ; CHECK-NEXT: vsld v2, v2, v5
162 ; CHECK-NEXT: vsrad v2, v2, v5
163 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 166
164 ; CHECK-NEXT: blr
165 entry:
166 %xor = xor <2 x i64> %B, %C
167 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
168 %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %not
169 ret <2 x i64> %res
170 }
171
172 ; Function to test ternary(A, xor(B, C), not(C)) for <16 x i8>
173 define <16 x i8> @ternary_A_xor_BC_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
174 ; CHECK-LABEL: ternary_A_xor_BC_not_C_16x8:
175 ; CHECK: # %bb.0: # %entry
176 ; CHECK-NEXT: xxspltib v5, 7
177 ; CHECK-NEXT: vslb v2, v2, v5
178 ; CHECK-NEXT: vsrab v2, v2, v5
179 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 166
180 ; CHECK-NEXT: blr
181 entry:
182 %xor = xor <16 x i8> %B, %C
183 %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
184 %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %not
185 ret <16 x i8> %res
186 }
187
188 ; Function to test ternary(A, xor(B, C), not(C)) for <8 x i16>
189 define <8 x i16> @ternary_A_xor_BC_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
190 ; CHECK-LABEL: ternary_A_xor_BC_not_C_8x16:
191 ; CHECK: # %bb.0: # %entry
192 ; CHECK-NEXT: xxspltiw v5, 983055
193 ; CHECK-NEXT: vslh v2, v2, v5
194 ; CHECK-NEXT: vsrah v2, v2, v5
195 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 166
196 ; CHECK-NEXT: blr
197 entry:
198 %xor = xor <8 x i16> %B, %C
199 %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
200 %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %not
201 ret <8 x i16> %res
202 }
203
204 ; Function to test ternary(A, or(B, C), not(C)) for <4 x i32>
205 define <4 x i32> @ternary_A_or_BC_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
206 ; CHECK-LABEL: ternary_A_or_BC_not_C_4x32:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: xxleqv v5, v5, v5
209 ; CHECK-NEXT: vslw v2, v2, v5
210 ; CHECK-NEXT: vsraw v2, v2, v5
211 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 167
212 ; CHECK-NEXT: blr
213 entry:
214 %or = or <4 x i32> %B, %C
215 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
216 %res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %not
217 ret <4 x i32> %res
218 }
219
220 ; Function to test ternary(A, or(B, C), not(C)) for <2 x i64>
221 define <2 x i64> @ternary_A_or_BC_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
222 ; CHECK-LABEL: ternary_A_or_BC_not_C_2x64:
223 ; CHECK: # %bb.0: # %entry
224 ; CHECK-NEXT: xxlxor v5, v5, v5
225 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
226 ; CHECK-NEXT: vsld v2, v2, v5
227 ; CHECK-NEXT: vsrad v2, v2, v5
228 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 167
229 ; CHECK-NEXT: blr
230 entry:
231 %or = or <2 x i64> %B, %C
232 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
233 %res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %not
234 ret <2 x i64> %res
235 }
236
237 ; Function to test ternary(A, or(B, C), not(C)) for <16 x i8>
238 define <16 x i8> @ternary_A_or_BC_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
239 ; CHECK-LABEL: ternary_A_or_BC_not_C_16x8:
240 ; CHECK: # %bb.0: # %entry
241 ; CHECK-NEXT: xxspltib v5, 7
242 ; CHECK-NEXT: vslb v2, v2, v5
243 ; CHECK-NEXT: vsrab v2, v2, v5
244 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 167
245 ; CHECK-NEXT: blr
246 entry:
247 %or = or <16 x i8> %B, %C
248 %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
249 %res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %not
250 ret <16 x i8> %res
251 }
252
253 ; Function to test ternary(A, or(B, C), not(C)) for <8 x i16>
254 define <8 x i16> @ternary_A_or_BC_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
255 ; CHECK-LABEL: ternary_A_or_BC_not_C_8x16:
256 ; CHECK: # %bb.0: # %entry
257 ; CHECK-NEXT: xxspltiw v5, 983055
258 ; CHECK-NEXT: vslh v2, v2, v5
259 ; CHECK-NEXT: vsrah v2, v2, v5
260 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 167
261 ; CHECK-NEXT: blr
262 entry:
263 %or = or <8 x i16> %B, %C
264 %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
265 %res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %not
266 ret <8 x i16> %res
267 }
268
269 ; Function to test ternary(A, not(B), not(C)) for <4 x i32>
270 define <4 x i32> @ternary_A_not_B_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
271 ; CHECK-LABEL: ternary_A_not_B_not_C_4x32:
272 ; CHECK: # %bb.0: # %entry
273 ; CHECK-NEXT: xxleqv v5, v5, v5
274 ; CHECK-NEXT: vslw v2, v2, v5
275 ; CHECK-NEXT: vsraw v2, v2, v5
276 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 172
277 ; CHECK-NEXT: blr
278 entry:
279 %not_b = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
280 %not_c = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
281 %res = select <4 x i1> %A, <4 x i32> %not_b, <4 x i32> %not_c
282 ret <4 x i32> %res
283 }
284
285 ; Function to test ternary(A, not(B), not(C)) for <2 x i64>
286 define <2 x i64> @ternary_A_not_B_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
287 ; CHECK-LABEL: ternary_A_not_B_not_C_2x64:
288 ; CHECK: # %bb.0: # %entry
289 ; CHECK-NEXT: xxlxor v5, v5, v5
290 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
291 ; CHECK-NEXT: vsld v2, v2, v5
292 ; CHECK-NEXT: vsrad v2, v2, v5
293 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 172
294 ; CHECK-NEXT: blr
295 entry:
296 %not_b = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation
297 %not_c = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
298 %res = select <2 x i1> %A, <2 x i64> %not_b, <2 x i64> %not_c
299 ret <2 x i64> %res
300 }
301
302 ; Function to test ternary(A, not(B), not(C)) for <16 x i8>
303 define <16 x i8> @ternary_A_not_B_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
304 ; CHECK-LABEL: ternary_A_not_B_not_C_16x8:
305 ; CHECK: # %bb.0: # %entry
306 ; CHECK-NEXT: xxspltib v5, 7
307 ; CHECK-NEXT: vslb v2, v2, v5
308 ; CHECK-NEXT: vsrab v2, v2, v5
309 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 172
310 ; CHECK-NEXT: blr
311 entry:
312 %not_b = xor <16 x i8> %B, <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
313 %not_c = 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
314 %res = select <16 x i1> %A, <16 x i8> %not_b, <16 x i8> %not_c
315 ret <16 x i8> %res
316 }
317
318 ; Function to test ternary(A, not(B), not(C)) for <8 x i16>
319 define <8 x i16> @ternary_A_not_B_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
320 ; CHECK-LABEL: ternary_A_not_B_not_C_8x16:
321 ; CHECK: # %bb.0: # %entry
322 ; CHECK-NEXT: xxspltiw v5, 983055
323 ; CHECK-NEXT: vslh v2, v2, v5
324 ; CHECK-NEXT: vsrah v2, v2, v5
325 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 172
326 ; CHECK-NEXT: blr
327 entry:
328 %not_b = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
329 %not_c = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
330 %res = select <8 x i1> %A, <8 x i16> %not_b, <8 x i16> %not_c
331 ret <8 x i16> %res
332 }
333
334 ; Function to test ternary(A, nand(B, C), not(C)) for <4 x i32>
335 define <4 x i32> @ternary_A_nand_BC_not_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
336 ; CHECK-LABEL: ternary_A_nand_BC_not_C_4x32:
337 ; CHECK: # %bb.0: # %entry
338 ; CHECK-NEXT: xxleqv v5, v5, v5
339 ; CHECK-NEXT: vslw v2, v2, v5
340 ; CHECK-NEXT: vsraw v2, v2, v5
341 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 174
342 ; CHECK-NEXT: blr
343 entry:
344 %and = and <4 x i32> %B, %C
345 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation
346 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
347 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %not
348 ret <4 x i32> %res
349 }
350
351 ; Function to test ternary(A, nand(B, C), not(C)) for <2 x i64>
352 define <2 x i64> @ternary_A_nand_BC_not_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
353 ; CHECK-LABEL: ternary_A_nand_BC_not_C_2x64:
354 ; CHECK: # %bb.0: # %entry
355 ; CHECK-NEXT: xxlxor v5, v5, v5
356 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
357 ; CHECK-NEXT: vsld v2, v2, v5
358 ; CHECK-NEXT: vsrad v2, v2, v5
359 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 174
360 ; CHECK-NEXT: blr
361 entry:
362 %and = and <2 x i64> %B, %C
363 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation
364 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
365 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %not
366 ret <2 x i64> %res
367 }
368
369 ; Function to test ternary(A, nand(B, C), not(C)) for <16 x i8>
370 define <16 x i8> @ternary_A_nand_BC_not_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
371 ; CHECK-LABEL: ternary_A_nand_BC_not_C_16x8:
372 ; CHECK: # %bb.0: # %entry
373 ; CHECK-NEXT: xxspltib v5, 7
374 ; CHECK-NEXT: vslb v2, v2, v5
375 ; CHECK-NEXT: vsrab v2, v2, v5
376 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 174
377 ; CHECK-NEXT: blr
378 entry:
379 %and = and <16 x i8> %B, %C
380 %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
381 %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
382 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %not
383 ret <16 x i8> %res
384 }
385
386 ; Function to test ternary(A, nand(B, C), not(C)) for <8 x i16>
387 define <8 x i16> @ternary_A_nand_BC_not_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
388 ; CHECK-LABEL: ternary_A_nand_BC_not_C_8x16:
389 ; CHECK: # %bb.0: # %entry
390 ; CHECK-NEXT: xxspltiw v5, 983055
391 ; CHECK-NEXT: vslh v2, v2, v5
392 ; CHECK-NEXT: vsrah v2, v2, v5
393 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 174
394 ; CHECK-NEXT: blr
395 entry:
396 %and = and <8 x i16> %B, %C
397 %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
398 %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
399 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %not
400 ret <8 x i16> %res
401 }