Debian Codegraph @

llvm/test/CodeGen/PowerPC/xxeval-vselect-x-not-b.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(B)) for <4 x i32>
14 define <4 x i32> @ternary_A_and_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
15 ; CHECK-LABEL: ternary_A_and_BC_not_B_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, 193
21 ; CHECK-NEXT: blr
22 entry:
23 %and = and <4 x i32> %B, %C
24 %not = xor <4 x i32> %B, <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(B)) for <2 x i64>
30 define <2 x i64> @ternary_A_and_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
31 ; CHECK-LABEL: ternary_A_and_BC_not_B_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, 193
38 ; CHECK-NEXT: blr
39 entry:
40 %and = and <2 x i64> %B, %C
41 %not = xor <2 x i64> %B, <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(B)) for <16 x i8>
47 define <16 x i8> @ternary_A_and_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
48 ; CHECK-LABEL: ternary_A_and_BC_not_B_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, 193
54 ; CHECK-NEXT: blr
55 entry:
56 %and = and <16 x i8> %B, %C
57 %not = 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
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(B)) for <8 x i16>
63 define <8 x i16> @ternary_A_and_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
64 ; CHECK-LABEL: ternary_A_and_BC_not_B_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, 193
70 ; CHECK-NEXT: blr
71 entry:
72 %and = and <8 x i16> %B, %C
73 %not = xor <8 x i16> %B, <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, xor(B, C), not(B)) for <4 x i32>
79 define <4 x i32> @ternary_A_xor_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
80 ; CHECK-LABEL: ternary_A_xor_BC_not_B_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, 198
86 ; CHECK-NEXT: blr
87 entry:
88 %xor = xor <4 x i32> %B, %C
89 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
90 %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %not
91 ret <4 x i32> %res
92 }
93
94 ; Function to test ternary(A, xor(B, C), not(B)) for <2 x i64>
95 define <2 x i64> @ternary_A_xor_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
96 ; CHECK-LABEL: ternary_A_xor_BC_not_B_2x64:
97 ; CHECK: # %bb.0: # %entry
98 ; CHECK-NEXT: xxlxor v5, v5, v5
99 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
100 ; CHECK-NEXT: vsld v2, v2, v5
101 ; CHECK-NEXT: vsrad v2, v2, v5
102 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 198
103 ; CHECK-NEXT: blr
104 entry:
105 %xor = xor <2 x i64> %B, %C
106 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation
107 %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %not
108 ret <2 x i64> %res
109 }
110
111 ; Function to test ternary(A, xor(B, C), not(B)) for <16 x i8>
112 define <16 x i8> @ternary_A_xor_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
113 ; CHECK-LABEL: ternary_A_xor_BC_not_B_16x8:
114 ; CHECK: # %bb.0: # %entry
115 ; CHECK-NEXT: xxspltib v5, 7
116 ; CHECK-NEXT: vslb v2, v2, v5
117 ; CHECK-NEXT: vsrab v2, v2, v5
118 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 198
119 ; CHECK-NEXT: blr
120 entry:
121 %xor = xor <16 x i8> %B, %C
122 %not = 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
123 %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %not
124 ret <16 x i8> %res
125 }
126
127 ; Function to test ternary(A, xor(B, C), not(B)) for <8 x i16>
128 define <8 x i16> @ternary_A_xor_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
129 ; CHECK-LABEL: ternary_A_xor_BC_not_B_8x16:
130 ; CHECK: # %bb.0: # %entry
131 ; CHECK-NEXT: xxspltiw v5, 983055
132 ; CHECK-NEXT: vslh v2, v2, v5
133 ; CHECK-NEXT: vsrah v2, v2, v5
134 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 198
135 ; CHECK-NEXT: blr
136 entry:
137 %xor = xor <8 x i16> %B, %C
138 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
139 %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %not
140 ret <8 x i16> %res
141 }
142
143 ; Function to test ternary(A, or(B, C), not(B)) for <4 x i32>
144 define <4 x i32> @ternary_A_or_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
145 ; CHECK-LABEL: ternary_A_or_BC_not_B_4x32:
146 ; CHECK: # %bb.0: # %entry
147 ; CHECK-NEXT: xxleqv v5, v5, v5
148 ; CHECK-NEXT: vslw v2, v2, v5
149 ; CHECK-NEXT: vsraw v2, v2, v5
150 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 199
151 ; CHECK-NEXT: blr
152 entry:
153 %or = or <4 x i32> %B, %C
154 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
155 %res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %not
156 ret <4 x i32> %res
157 }
158
159 ; Function to test ternary(A, or(B, C), not(B)) for <2 x i64>
160 define <2 x i64> @ternary_A_or_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
161 ; CHECK-LABEL: ternary_A_or_BC_not_B_2x64:
162 ; CHECK: # %bb.0: # %entry
163 ; CHECK-NEXT: xxlxor v5, v5, v5
164 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
165 ; CHECK-NEXT: vsld v2, v2, v5
166 ; CHECK-NEXT: vsrad v2, v2, v5
167 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 199
168 ; CHECK-NEXT: blr
169 entry:
170 %or = or <2 x i64> %B, %C
171 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation
172 %res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %not
173 ret <2 x i64> %res
174 }
175
176 ; Function to test ternary(A, or(B, C), not(B)) for <16 x i8>
177 define <16 x i8> @ternary_A_or_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
178 ; CHECK-LABEL: ternary_A_or_BC_not_B_16x8:
179 ; CHECK: # %bb.0: # %entry
180 ; CHECK-NEXT: xxspltib v5, 7
181 ; CHECK-NEXT: vslb v2, v2, v5
182 ; CHECK-NEXT: vsrab v2, v2, v5
183 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 199
184 ; CHECK-NEXT: blr
185 entry:
186 %or = or <16 x i8> %B, %C
187 %not = 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
188 %res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %not
189 ret <16 x i8> %res
190 }
191
192 ; Function to test ternary(A, or(B, C), not(B)) for <8 x i16>
193 define <8 x i16> @ternary_A_or_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
194 ; CHECK-LABEL: ternary_A_or_BC_not_B_8x16:
195 ; CHECK: # %bb.0: # %entry
196 ; CHECK-NEXT: xxspltiw v5, 983055
197 ; CHECK-NEXT: vslh v2, v2, v5
198 ; CHECK-NEXT: vsrah v2, v2, v5
199 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 199
200 ; CHECK-NEXT: blr
201 entry:
202 %or = or <8 x i16> %B, %C
203 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
204 %res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %not
205 ret <8 x i16> %res
206 }
207
208 ; Function to test ternary(A, nand(B, C), not(B)) for <4 x i32>
209 define <4 x i32> @ternary_A_nand_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {
210 ; CHECK-LABEL: ternary_A_nand_BC_not_B_4x32:
211 ; CHECK: # %bb.0: # %entry
212 ; CHECK-NEXT: xxleqv v5, v5, v5
213 ; CHECK-NEXT: vslw v2, v2, v5
214 ; CHECK-NEXT: vsraw v2, v2, v5
215 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 206
216 ; CHECK-NEXT: blr
217 entry:
218 %and = and <4 x i32> %B, %C
219 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation
220 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation
221 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %not
222 ret <4 x i32> %res
223 }
224
225 ; Function to test ternary(A, nand(B, C), not(B)) for <2 x i64>
226 define <2 x i64> @ternary_A_nand_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {
227 ; CHECK-LABEL: ternary_A_nand_BC_not_B_2x64:
228 ; CHECK: # %bb.0: # %entry
229 ; CHECK-NEXT: xxlxor v5, v5, v5
230 ; CHECK-NEXT: xxsplti32dx v5, 1, 63
231 ; CHECK-NEXT: vsld v2, v2, v5
232 ; CHECK-NEXT: vsrad v2, v2, v5
233 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 206
234 ; CHECK-NEXT: blr
235 entry:
236 %and = and <2 x i64> %B, %C
237 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation
238 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation
239 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %not
240 ret <2 x i64> %res
241 }
242
243 ; Function to test ternary(A, nand(B, C), not(B)) for <16 x i8>
244 define <16 x i8> @ternary_A_nand_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {
245 ; CHECK-LABEL: ternary_A_nand_BC_not_B_16x8:
246 ; CHECK: # %bb.0: # %entry
247 ; CHECK-NEXT: xxspltib v5, 7
248 ; CHECK-NEXT: vslb v2, v2, v5
249 ; CHECK-NEXT: vsrab v2, v2, v5
250 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 206
251 ; CHECK-NEXT: blr
252 entry:
253 %and = and <16 x i8> %B, %C
254 %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
255 %not = 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
256 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %not
257 ret <16 x i8> %res
258 }
259
260 ; Function to test ternary(A, nand(B, C), not(B)) for <8 x i16>
261 define <8 x i16> @ternary_A_nand_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {
262 ; CHECK-LABEL: ternary_A_nand_BC_not_B_8x16:
263 ; CHECK: # %bb.0: # %entry
264 ; CHECK-NEXT: xxspltiw v5, 983055
265 ; CHECK-NEXT: vslh v2, v2, v5
266 ; CHECK-NEXT: vsrah v2, v2, v5
267 ; CHECK-NEXT: xxeval v2, v2, v3, v4, 206
268 ; CHECK-NEXT: blr
269 entry:
270 %and = and <8 x i16> %B, %C
271 %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
272 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation
273 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %not
274 ret <8 x i16> %res
275 }