Debian Codegraph @

llvm/test/CodeGen/PowerPC/xxeval-vselect-x-eqv.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, 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: vslw v2, v2, v5
19 ; CHECK-NEXT: vsraw v2, v2, v5
20 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 151
21 ; CHECK-NEXT: blr
22 entry:
23 %or = or <4 x i32> %B, %C
24 %xor = xor <4 x i32> %B, %C
25 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
26 %res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %eqv
27 ret <4 x i32> %res
28 }
29
30 ; Function to test ternary(A, or(B, C), eqv(B, C)) for <2 x i64>
31 define <2 x i64> @ternary_A_or_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
32 ; CHECK-LABEL: ternary_A_or_BC_eqv_BC_2x64:
33 ; CHECK: # %bb.0: # %entry
34 ; CHECK-NEXT: xxlxor v5, v5, v5
35 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
36 ; CHECK-NEXT: vsld v2, v2, v5
37 ; CHECK-NEXT: vsrad v2, v2, v5
38 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 151
39 ; CHECK-NEXT: blr
40 entry:
41 %or = or <2 x i64> %B, %C
42 %xor = xor <2 x i64> %B, %C
43 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
44 %res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %eqv
45 ret <2 x i64> %res
46 }
47
48 ; Function to test ternary(A, or(B, C), eqv(B, C)) for <16 x i8>
49 define <16 x i8> @ternary_A_or_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
50 ; CHECK-LABEL: ternary_A_or_BC_eqv_BC_16x8:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: xxspltib v5, 7
53 ; CHECK-NEXT: vslb v2, v2, v5
54 ; CHECK-NEXT: vsrab v2, v2, v5
55 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 151
56 ; CHECK-NEXT: blr
57 entry:
58 %or = or <16 x i8> %B, %C
59 %xor = xor <16 x i8> %B, %C
60 %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
61 %res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %eqv
62 ret <16 x i8> %res
63 }
64
65 ; Function to test ternary(A, or(B, C), eqv(B, C)) for <8 x i16>
66 define <8 x i16> @ternary_A_or_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
67 ; CHECK-LABEL: ternary_A_or_BC_eqv_BC_8x16:
68 ; CHECK: # %bb.0: # %entry
69 ; CHECK-NEXT: xxspltiw v5, 983055
70 ; CHECK-NEXT: vslh v2, v2, v5
71 ; CHECK-NEXT: vsrah v2, v2, v5
72 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 151
73 ; CHECK-NEXT: blr
74 entry:
75 %or = or <8 x i16> %B, %C
76 %xor = xor <8 x i16> %B, %C
77 %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
78 %res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %eqv
79 ret <8 x i16> %res
80 }
81
82 ; Function to test ternary(A, nor(B, C), eqv(B, C)) for <4 x i32>
83 define <4 x i32> @ternary_A_nor_BC_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
84 ; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_4x32:
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK-NEXT: xxleqv v5, v5, v5
87 ; CHECK-NEXT: vslw v2, v2, v5
88 ; CHECK-NEXT: vsraw v2, v2, v5
89 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 152
90 ; CHECK-NEXT: blr
91 entry:
92 %or = or <4 x i32> %B, %C
93 %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector NOR operation
94 %xor = xor <4 x i32> %B, %C
95 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
96 %res = select <4 x i1> %A, <4 x i32> %nor, <4 x i32> %eqv
97 ret <4 x i32> %res
98 }
99
100 ; Function to test ternary(A, nor(B, C), eqv(B, C)) for <2 x i64>
101 define <2 x i64> @ternary_A_nor_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
102 ; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_2x64:
103 ; CHECK: # %bb.0: # %entry
104 ; CHECK-NEXT: xxlxor v5, v5, v5
105 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
106 ; CHECK-NEXT: vsld v2, v2, v5
107 ; CHECK-NEXT: vsrad v2, v2, v5
108 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 152
109 ; CHECK-NEXT: blr
110 entry:
111 %or = or <2 x i64> %B, %C
112 %nor = xor <2 x i64> %or, <i64 -1, i64 -1> ; Vector NOR operation
113 %xor = xor <2 x i64> %B, %C
114 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
115 %res = select <2 x i1> %A, <2 x i64> %nor, <2 x i64> %eqv
116 ret <2 x i64> %res
117 }
118
119 ; Function to test ternary(A, nor(B, C), eqv(B, C)) for <16 x i8>
120 define <16 x i8> @ternary_A_nor_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
121 ; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_16x8:
122 ; CHECK: # %bb.0: # %entry
123 ; CHECK-NEXT: xxspltib v5, 7
124 ; CHECK-NEXT: vslb v2, v2, v5
125 ; CHECK-NEXT: vsrab v2, v2, v5
126 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 152
127 ; CHECK-NEXT: blr
128 entry:
129 %or = or <16 x i8> %B, %C
130 %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
131 %xor = xor <16 x i8> %B, %C
132 %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
133 %res = select <16 x i1> %A, <16 x i8> %nor, <16 x i8> %eqv
134 ret <16 x i8> %res
135 }
136
137 ; Function to test ternary(A, nor(B, C), eqv(B, C)) for <8 x i16>
138 define <8 x i16> @ternary_A_nor_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
139 ; CHECK-LABEL: ternary_A_nor_BC_eqv_BC_8x16:
140 ; CHECK: # %bb.0: # %entry
141 ; CHECK-NEXT: xxspltiw v5, 983055
142 ; CHECK-NEXT: vslh v2, v2, v5
143 ; CHECK-NEXT: vsrah v2, v2, v5
144 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 152
145 ; CHECK-NEXT: blr
146 entry:
147 %or = or <8 x i16> %B, %C
148 %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
149 %xor = xor <8 x i16> %B, %C
150 %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
151 %res = select <8 x i1> %A, <8 x i16> %nor, <8 x i16> %eqv
152 ret <8 x i16> %res
153 }
154
155 ; Function to test ternary(A, not(C), eqv(B, C)) for <4 x i32>
156 define <4 x i32> @ternary_A_not_C_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
157 ; CHECK-LABEL: ternary_A_not_C_eqv_BC_4x32:
158 ; CHECK: # %bb.0: # %entry
159 ; CHECK-NEXT: xxleqv v5, v5, v5
160 ; CHECK-NEXT: vslw v2, v2, v5
161 ; CHECK-NEXT: vsraw v2, v2, v5
162 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 154
163 ; CHECK-NEXT: blr
164 entry:
165 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
166 %xor = xor <4 x i32> %B, %C
167 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
168 %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %eqv
169 ret <4 x i32> %res
170 }
171
172 ; Function to test ternary(A, not(C), eqv(B, C)) for <2 x i64>
173 define <2 x i64> @ternary_A_not_C_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
174 ; CHECK-LABEL: ternary_A_not_C_eqv_BC_2x64:
175 ; CHECK: # %bb.0: # %entry
176 ; CHECK-NEXT: xxlxor v5, v5, v5
177 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
178 ; CHECK-NEXT: vsld v2, v2, v5
179 ; CHECK-NEXT: vsrad v2, v2, v5
180 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 154
181 ; CHECK-NEXT: blr
182 entry:
183 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation
184 %xor = xor <2 x i64> %B, %C
185 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
186 %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %eqv
187 ret <2 x i64> %res
188 }
189
190 ; Function to test ternary(A, not(C), eqv(B, C)) for <16 x i8>
191 define <16 x i8> @ternary_A_not_C_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
192 ; CHECK-LABEL: ternary_A_not_C_eqv_BC_16x8:
193 ; CHECK: # %bb.0: # %entry
194 ; CHECK-NEXT: xxspltib v5, 7
195 ; CHECK-NEXT: vslb v2, v2, v5
196 ; CHECK-NEXT: vsrab v2, v2, v5
197 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 154
198 ; CHECK-NEXT: blr
199 entry:
200 %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
201 %xor = xor <16 x i8> %B, %C
202 %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
203 %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %eqv
204 ret <16 x i8> %res
205 }
206
207 ; Function to test ternary(A, not(C), eqv(B, C)) for <8 x i16>
208 define <8 x i16> @ternary_A_not_C_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
209 ; CHECK-LABEL: ternary_A_not_C_eqv_BC_8x16:
210 ; CHECK: # %bb.0: # %entry
211 ; CHECK-NEXT: xxspltiw v5, 983055
212 ; CHECK-NEXT: vslh v2, v2, v5
213 ; CHECK-NEXT: vsrah v2, v2, v5
214 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 154
215 ; CHECK-NEXT: blr
216 entry:
217 %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
218 %xor = xor <8 x i16> %B, %C
219 %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
220 %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %eqv
221 ret <8 x i16> %res
222 }
223
224 ; Function to test ternary(A, nand(B, C), eqv(B, C)) for <4 x i32>
225 define <4 x i32> @ternary_A_nand_BC_eqv_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
226 ; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_4x32:
227 ; CHECK: # %bb.0: # %entry
228 ; CHECK-NEXT: xxleqv v5, v5, v5
229 ; CHECK-NEXT: vslw v2, v2, v5
230 ; CHECK-NEXT: vsraw v2, v2, v5
231 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 158
232 ; CHECK-NEXT: blr
233 entry:
234 %and = and <4 x i32> %B, %C
235 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation
236 %xor = xor <4 x i32> %B, %C
237 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation
238 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %eqv
239 ret <4 x i32> %res
240 }
241
242 ; Function to test ternary(A, nand(B, C), eqv(B, C)) for <2 x i64>
243 define <2 x i64> @ternary_A_nand_BC_eqv_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
244 ; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_2x64:
245 ; CHECK: # %bb.0: # %entry
246 ; CHECK-NEXT: xxlxor v5, v5, v5
247 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
248 ; CHECK-NEXT: vsld v2, v2, v5
249 ; CHECK-NEXT: vsrad v2, v2, v5
250 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 158
251 ; CHECK-NEXT: blr
252 entry:
253 %and = and <2 x i64> %B, %C
254 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation
255 %xor = xor <2 x i64> %B, %C
256 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation
257 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %eqv
258 ret <2 x i64> %res
259 }
260
261 ; Function to test ternary(A, nand(B, C), eqv(B, C)) for <16 x i8>
262 define <16 x i8> @ternary_A_nand_BC_eqv_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
263 ; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_16x8:
264 ; CHECK: # %bb.0: # %entry
265 ; CHECK-NEXT: xxspltib v5, 7
266 ; CHECK-NEXT: vslb v2, v2, v5
267 ; CHECK-NEXT: vsrab v2, v2, v5
268 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 158
269 ; CHECK-NEXT: blr
270 entry:
271 %and = and <16 x i8> %B, %C
272 %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
273 %xor = xor <16 x i8> %B, %C
274 %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
275 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %eqv
276 ret <16 x i8> %res
277 }
278
279 ; Function to test ternary(A, nand(B, C), eqv(B, C)) for <8 x i16>
280 define <8 x i16> @ternary_A_nand_BC_eqv_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
281 ; CHECK-LABEL: ternary_A_nand_BC_eqv_BC_8x16:
282 ; CHECK: # %bb.0: # %entry
283 ; CHECK-NEXT: xxspltiw v5, 983055
284 ; CHECK-NEXT: vslh v2, v2, v5
285 ; CHECK-NEXT: vsrah v2, v2, v5
286 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 158
287 ; CHECK-NEXT: blr
288 entry:
289 %and = and <8 x i16> %B, %C
290 %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
291 %xor = xor <8 x i16> %B, %C
292 %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
293 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %eqv
294 ret <8 x i16> %res
295 }