1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep selb %t1.s | count 56
4 target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
7 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
9 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
11 ; (or (and rC, rB), (and (not rC), rA))
12 define <2 x i64> @selectbits_v2i64_01(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
13 %C = and <2 x i64> %rC, %rB
14 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
15 %B = and <2 x i64> %A, %rA
16 %D = or <2 x i64> %C, %B
20 ; (or (and rB, rC), (and (not rC), rA))
21 define <2 x i64> @selectbits_v2i64_02(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
22 %C = and <2 x i64> %rB, %rC
23 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
24 %B = and <2 x i64> %A, %rA
25 %D = or <2 x i64> %C, %B
29 ; (or (and (not rC), rA), (and rB, rC))
30 define <2 x i64> @selectbits_v2i64_03(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
31 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
32 %B = and <2 x i64> %A, %rA
33 %C = and <2 x i64> %rB, %rC
34 %D = or <2 x i64> %C, %B
38 ; (or (and (not rC), rA), (and rC, rB))
39 define <2 x i64> @selectbits_v2i64_04(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
40 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
41 %B = and <2 x i64> %A, %rA
42 %C = and <2 x i64> %rC, %rB
43 %D = or <2 x i64> %C, %B
47 ; (or (and rC, rB), (and rA, (not rC)))
48 define <2 x i64> @selectbits_v2i64_05(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
49 %C = and <2 x i64> %rC, %rB
50 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
51 %B = and <2 x i64> %rA, %A
52 %D = or <2 x i64> %C, %B
56 ; (or (and rB, rC), (and rA, (not rC)))
57 define <2 x i64> @selectbits_v2i64_06(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
58 %C = and <2 x i64> %rB, %rC
59 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
60 %B = and <2 x i64> %rA, %A
61 %D = or <2 x i64> %C, %B
65 ; (or (and rA, (not rC)), (and rB, rC))
66 define <2 x i64> @selectbits_v2i64_07(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
67 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
68 %B = and <2 x i64> %rA, %A
69 %C = and <2 x i64> %rB, %rC
70 %D = or <2 x i64> %C, %B
74 ; (or (and rA, (not rC)), (and rC, rB))
75 define <2 x i64> @selectbits_v2i64_08(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
76 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
77 %B = and <2 x i64> %rA, %A
78 %C = and <2 x i64> %rC, %rB
79 %D = or <2 x i64> %C, %B
83 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
85 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
87 ; (or (and rC, rB), (and (not rC), rA))
88 define <4 x i32> @selectbits_v4i32_01(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
89 %C = and <4 x i32> %rC, %rB
90 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
91 %B = and <4 x i32> %A, %rA
92 %D = or <4 x i32> %C, %B
96 ; (or (and rB, rC), (and (not rC), rA))
97 define <4 x i32> @selectbits_v4i32_02(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
98 %C = and <4 x i32> %rB, %rC
99 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
100 %B = and <4 x i32> %A, %rA
101 %D = or <4 x i32> %C, %B
105 ; (or (and (not rC), rA), (and rB, rC))
106 define <4 x i32> @selectbits_v4i32_03(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
107 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
108 %B = and <4 x i32> %A, %rA
109 %C = and <4 x i32> %rB, %rC
110 %D = or <4 x i32> %C, %B
114 ; (or (and (not rC), rA), (and rC, rB))
115 define <4 x i32> @selectbits_v4i32_04(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
116 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
117 %B = and <4 x i32> %A, %rA
118 %C = and <4 x i32> %rC, %rB
119 %D = or <4 x i32> %C, %B
123 ; (or (and rC, rB), (and rA, (not rC)))
124 define <4 x i32> @selectbits_v4i32_05(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
125 %C = and <4 x i32> %rC, %rB
126 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
127 %B = and <4 x i32> %rA, %A
128 %D = or <4 x i32> %C, %B
132 ; (or (and rB, rC), (and rA, (not rC)))
133 define <4 x i32> @selectbits_v4i32_06(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
134 %C = and <4 x i32> %rB, %rC
135 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
136 %B = and <4 x i32> %rA, %A
137 %D = or <4 x i32> %C, %B
141 ; (or (and rA, (not rC)), (and rB, rC))
142 define <4 x i32> @selectbits_v4i32_07(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
143 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
144 %B = and <4 x i32> %rA, %A
145 %C = and <4 x i32> %rB, %rC
146 %D = or <4 x i32> %C, %B
150 ; (or (and rA, (not rC)), (and rC, rB))
151 define <4 x i32> @selectbits_v4i32_08(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
152 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
153 %B = and <4 x i32> %rA, %A
154 %C = and <4 x i32> %rC, %rB
155 %D = or <4 x i32> %C, %B
159 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
161 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
163 ; (or (and rC, rB), (and (not rC), rA))
164 define <8 x i16> @selectbits_v8i16_01(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
165 %C = and <8 x i16> %rC, %rB
166 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
167 i16 -1, i16 -1, i16 -1, i16 -1 >
168 %B = and <8 x i16> %A, %rA
169 %D = or <8 x i16> %C, %B
173 ; (or (and rB, rC), (and (not rC), rA))
174 define <8 x i16> @selectbits_v8i16_02(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
175 %C = and <8 x i16> %rB, %rC
176 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
177 i16 -1, i16 -1, i16 -1, i16 -1 >
178 %B = and <8 x i16> %A, %rA
179 %D = or <8 x i16> %C, %B
183 ; (or (and (not rC), rA), (and rB, rC))
184 define <8 x i16> @selectbits_v8i16_03(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
185 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
186 i16 -1, i16 -1, i16 -1, i16 -1 >
187 %B = and <8 x i16> %A, %rA
188 %C = and <8 x i16> %rB, %rC
189 %D = or <8 x i16> %C, %B
193 ; (or (and (not rC), rA), (and rC, rB))
194 define <8 x i16> @selectbits_v8i16_04(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
195 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
196 i16 -1, i16 -1, i16 -1, i16 -1 >
197 %B = and <8 x i16> %A, %rA
198 %C = and <8 x i16> %rC, %rB
199 %D = or <8 x i16> %C, %B
203 ; (or (and rC, rB), (and rA, (not rC)))
204 define <8 x i16> @selectbits_v8i16_05(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
205 %C = and <8 x i16> %rC, %rB
206 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
207 i16 -1, i16 -1, i16 -1, i16 -1 >
208 %B = and <8 x i16> %rA, %A
209 %D = or <8 x i16> %C, %B
213 ; (or (and rB, rC), (and rA, (not rC)))
214 define <8 x i16> @selectbits_v8i16_06(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
215 %C = and <8 x i16> %rB, %rC
216 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
217 i16 -1, i16 -1, i16 -1, i16 -1 >
218 %B = and <8 x i16> %rA, %A
219 %D = or <8 x i16> %C, %B
223 ; (or (and rA, (not rC)), (and rB, rC))
224 define <8 x i16> @selectbits_v8i16_07(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
225 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
226 i16 -1, i16 -1, i16 -1, i16 -1 >
227 %B = and <8 x i16> %rA, %A
228 %C = and <8 x i16> %rB, %rC
229 %D = or <8 x i16> %C, %B
233 ; (or (and rA, (not rC)), (and rC, rB))
234 define <8 x i16> @selectbits_v8i16_08(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
235 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
236 i16 -1, i16 -1, i16 -1, i16 -1 >
237 %B = and <8 x i16> %rA, %A
238 %C = and <8 x i16> %rC, %rB
239 %D = or <8 x i16> %C, %B
243 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
245 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
247 ; (or (and rC, rB), (and (not rC), rA))
248 define <16 x i8> @selectbits_v16i8_01(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
249 %C = and <16 x i8> %rC, %rB
250 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
251 i8 -1, i8 -1, i8 -1, i8 -1,
252 i8 -1, i8 -1, i8 -1, i8 -1,
253 i8 -1, i8 -1, i8 -1, i8 -1 >
254 %B = and <16 x i8> %A, %rA
255 %D = or <16 x i8> %C, %B
259 ; (or (and rB, rC), (and (not rC), rA))
260 define <16 x i8> @selectbits_v16i8_02(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
261 %C = and <16 x i8> %rB, %rC
262 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
263 i8 -1, i8 -1, i8 -1, i8 -1,
264 i8 -1, i8 -1, i8 -1, i8 -1,
265 i8 -1, i8 -1, i8 -1, i8 -1 >
266 %B = and <16 x i8> %A, %rA
267 %D = or <16 x i8> %C, %B
271 ; (or (and (not rC), rA), (and rB, rC))
272 define <16 x i8> @selectbits_v16i8_03(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
273 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
274 i8 -1, i8 -1, i8 -1, i8 -1,
275 i8 -1, i8 -1, i8 -1, i8 -1,
276 i8 -1, i8 -1, i8 -1, i8 -1 >
277 %B = and <16 x i8> %A, %rA
278 %C = and <16 x i8> %rB, %rC
279 %D = or <16 x i8> %C, %B
283 ; (or (and (not rC), rA), (and rC, rB))
284 define <16 x i8> @selectbits_v16i8_04(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
285 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
286 i8 -1, i8 -1, i8 -1, i8 -1,
287 i8 -1, i8 -1, i8 -1, i8 -1,
288 i8 -1, i8 -1, i8 -1, i8 -1 >
289 %B = and <16 x i8> %A, %rA
290 %C = and <16 x i8> %rC, %rB
291 %D = or <16 x i8> %C, %B
295 ; (or (and rC, rB), (and rA, (not rC)))
296 define <16 x i8> @selectbits_v16i8_05(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
297 %C = and <16 x i8> %rC, %rB
298 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
299 i8 -1, i8 -1, i8 -1, i8 -1,
300 i8 -1, i8 -1, i8 -1, i8 -1,
301 i8 -1, i8 -1, i8 -1, i8 -1 >
302 %B = and <16 x i8> %rA, %A
303 %D = or <16 x i8> %C, %B
307 ; (or (and rB, rC), (and rA, (not rC)))
308 define <16 x i8> @selectbits_v16i8_06(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
309 %C = and <16 x i8> %rB, %rC
310 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
311 i8 -1, i8 -1, i8 -1, i8 -1,
312 i8 -1, i8 -1, i8 -1, i8 -1,
313 i8 -1, i8 -1, i8 -1, i8 -1 >
314 %B = and <16 x i8> %rA, %A
315 %D = or <16 x i8> %C, %B
319 ; (or (and rA, (not rC)), (and rB, rC))
320 define <16 x i8> @selectbits_v16i8_07(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
321 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
322 i8 -1, i8 -1, i8 -1, i8 -1,
323 i8 -1, i8 -1, i8 -1, i8 -1,
324 i8 -1, i8 -1, i8 -1, i8 -1 >
325 %B = and <16 x i8> %rA, %A
326 %C = and <16 x i8> %rB, %rC
327 %D = or <16 x i8> %C, %B
331 ; (or (and rA, (not rC)), (and rC, rB))
332 define <16 x i8> @selectbits_v16i8_08(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
333 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
334 i8 -1, i8 -1, i8 -1, i8 -1,
335 i8 -1, i8 -1, i8 -1, i8 -1,
336 i8 -1, i8 -1, i8 -1, i8 -1 >
337 %B = and <16 x i8> %rA, %A
338 %C = and <16 x i8> %rC, %rB
339 %D = or <16 x i8> %C, %B
343 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
345 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
347 ; (or (and rC, rB), (and (not rC), rA))
348 define i32 @selectbits_i32_01(i32 %rA, i32 %rB, i32 %rC) {
349 %C = and i32 %rC, %rB
356 ; (or (and rB, rC), (and (not rC), rA))
357 define i32 @selectbits_i32_02(i32 %rA, i32 %rB, i32 %rC) {
358 %C = and i32 %rB, %rC
365 ; (or (and (not rC), rA), (and rB, rC))
366 define i32 @selectbits_i32_03(i32 %rA, i32 %rB, i32 %rC) {
369 %C = and i32 %rB, %rC
374 ; (or (and (not rC), rA), (and rC, rB))
375 define i32 @selectbits_i32_04(i32 %rA, i32 %rB, i32 %rC) {
378 %C = and i32 %rC, %rB
383 ; (or (and rC, rB), (and rA, (not rC)))
384 define i32 @selectbits_i32_05(i32 %rA, i32 %rB, i32 %rC) {
385 %C = and i32 %rC, %rB
392 ; (or (and rB, rC), (and rA, (not rC)))
393 define i32 @selectbits_i32_06(i32 %rA, i32 %rB, i32 %rC) {
394 %C = and i32 %rB, %rC
401 ; (or (and rA, (not rC)), (and rB, rC))
402 define i32 @selectbits_i32_07(i32 %rA, i32 %rB, i32 %rC) {
405 %C = and i32 %rB, %rC
410 ; (or (and rA, (not rC)), (and rC, rB))
411 define i32 @selectbits_i32_08(i32 %rA, i32 %rB, i32 %rC) {
414 %C = and i32 %rC, %rB
419 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
421 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
423 ; (or (and rC, rB), (and (not rC), rA))
424 define i16 @selectbits_i16_01(i16 %rA, i16 %rB, i16 %rC) {
425 %C = and i16 %rC, %rB
432 ; (or (and rB, rC), (and (not rC), rA))
433 define i16 @selectbits_i16_02(i16 %rA, i16 %rB, i16 %rC) {
434 %C = and i16 %rB, %rC
441 ; (or (and (not rC), rA), (and rB, rC))
442 define i16 @selectbits_i16_03(i16 %rA, i16 %rB, i16 %rC) {
445 %C = and i16 %rB, %rC
450 ; (or (and (not rC), rA), (and rC, rB))
451 define i16 @selectbits_i16_04(i16 %rA, i16 %rB, i16 %rC) {
454 %C = and i16 %rC, %rB
459 ; (or (and rC, rB), (and rA, (not rC)))
460 define i16 @selectbits_i16_05(i16 %rA, i16 %rB, i16 %rC) {
461 %C = and i16 %rC, %rB
468 ; (or (and rB, rC), (and rA, (not rC)))
469 define i16 @selectbits_i16_06(i16 %rA, i16 %rB, i16 %rC) {
470 %C = and i16 %rB, %rC
477 ; (or (and rA, (not rC)), (and rB, rC))
478 define i16 @selectbits_i16_07(i16 %rA, i16 %rB, i16 %rC) {
481 %C = and i16 %rB, %rC
486 ; (or (and rA, (not rC)), (and rC, rB))
487 define i16 @selectbits_i16_08(i16 %rA, i16 %rB, i16 %rC) {
490 %C = and i16 %rC, %rB
495 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
497 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
499 ; (or (and rC, rB), (and (not rC), rA))
500 define i8 @selectbits_i8_01(i8 %rA, i8 %rB, i8 %rC) {
508 ; (or (and rB, rC), (and (not rC), rA))
509 define i8 @selectbits_i8_02(i8 %rA, i8 %rB, i8 %rC) {
517 ; (or (and (not rC), rA), (and rB, rC))
518 define i8 @selectbits_i8_03(i8 %rA, i8 %rB, i8 %rC) {
526 ; (or (and (not rC), rA), (and rC, rB))
527 define i8 @selectbits_i8_04(i8 %rA, i8 %rB, i8 %rC) {
535 ; (or (and rC, rB), (and rA, (not rC)))
536 define i8 @selectbits_i8_05(i8 %rA, i8 %rB, i8 %rC) {
544 ; (or (and rB, rC), (and rA, (not rC)))
545 define i8 @selectbits_i8_06(i8 %rA, i8 %rB, i8 %rC) {
553 ; (or (and rA, (not rC)), (and rB, rC))
554 define i8 @selectbits_i8_07(i8 %rA, i8 %rB, i8 %rC) {
562 ; (or (and rA, (not rC)), (and rC, rB))
563 define i8 @selectbits_i8_08(i8 %rA, i8 %rB, i8 %rC) {