1 ; RUN: llc < %s -march=cellspu > %t1.s
2 ; RUN: grep selb %t1.s | count 56
4 ; CellSPU legalization is over-sensitive to Legalize's traversal order.
7 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"
10 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
12 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
14 ; (or (and rC, rB), (and (not rC), rA))
15 define <2 x i64> @selectbits_v2i64_01(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
16 %C = and <2 x i64> %rC, %rB
17 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
18 %B = and <2 x i64> %A, %rA
19 %D = or <2 x i64> %C, %B
23 ; (or (and rB, rC), (and (not rC), rA))
24 define <2 x i64> @selectbits_v2i64_02(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
25 %C = and <2 x i64> %rB, %rC
26 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
27 %B = and <2 x i64> %A, %rA
28 %D = or <2 x i64> %C, %B
32 ; (or (and (not rC), rA), (and rB, rC))
33 define <2 x i64> @selectbits_v2i64_03(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
34 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
35 %B = and <2 x i64> %A, %rA
36 %C = and <2 x i64> %rB, %rC
37 %D = or <2 x i64> %C, %B
41 ; (or (and (not rC), rA), (and rC, rB))
42 define <2 x i64> @selectbits_v2i64_04(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
43 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
44 %B = and <2 x i64> %A, %rA
45 %C = and <2 x i64> %rC, %rB
46 %D = or <2 x i64> %C, %B
50 ; (or (and rC, rB), (and rA, (not rC)))
51 define <2 x i64> @selectbits_v2i64_05(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
52 %C = and <2 x i64> %rC, %rB
53 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
54 %B = and <2 x i64> %rA, %A
55 %D = or <2 x i64> %C, %B
59 ; (or (and rB, rC), (and rA, (not rC)))
60 define <2 x i64> @selectbits_v2i64_06(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
61 %C = and <2 x i64> %rB, %rC
62 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
63 %B = and <2 x i64> %rA, %A
64 %D = or <2 x i64> %C, %B
68 ; (or (and rA, (not rC)), (and rB, rC))
69 define <2 x i64> @selectbits_v2i64_07(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
70 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
71 %B = and <2 x i64> %rA, %A
72 %C = and <2 x i64> %rB, %rC
73 %D = or <2 x i64> %C, %B
77 ; (or (and rA, (not rC)), (and rC, rB))
78 define <2 x i64> @selectbits_v2i64_08(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
79 %A = xor <2 x i64> %rC, < i64 -1, i64 -1 >
80 %B = and <2 x i64> %rA, %A
81 %C = and <2 x i64> %rC, %rB
82 %D = or <2 x i64> %C, %B
86 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
88 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
90 ; (or (and rC, rB), (and (not rC), rA))
91 define <4 x i32> @selectbits_v4i32_01(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
92 %C = and <4 x i32> %rC, %rB
93 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
94 %B = and <4 x i32> %A, %rA
95 %D = or <4 x i32> %C, %B
99 ; (or (and rB, rC), (and (not rC), rA))
100 define <4 x i32> @selectbits_v4i32_02(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
101 %C = and <4 x i32> %rB, %rC
102 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
103 %B = and <4 x i32> %A, %rA
104 %D = or <4 x i32> %C, %B
108 ; (or (and (not rC), rA), (and rB, rC))
109 define <4 x i32> @selectbits_v4i32_03(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
110 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1 >
111 %B = and <4 x i32> %A, %rA
112 %C = and <4 x i32> %rB, %rC
113 %D = or <4 x i32> %C, %B
117 ; (or (and (not rC), rA), (and rC, rB))
118 define <4 x i32> @selectbits_v4i32_04(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
119 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
120 %B = and <4 x i32> %A, %rA
121 %C = and <4 x i32> %rC, %rB
122 %D = or <4 x i32> %C, %B
126 ; (or (and rC, rB), (and rA, (not rC)))
127 define <4 x i32> @selectbits_v4i32_05(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
128 %C = and <4 x i32> %rC, %rB
129 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
130 %B = and <4 x i32> %rA, %A
131 %D = or <4 x i32> %C, %B
135 ; (or (and rB, rC), (and rA, (not rC)))
136 define <4 x i32> @selectbits_v4i32_06(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
137 %C = and <4 x i32> %rB, %rC
138 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
139 %B = and <4 x i32> %rA, %A
140 %D = or <4 x i32> %C, %B
144 ; (or (and rA, (not rC)), (and rB, rC))
145 define <4 x i32> @selectbits_v4i32_07(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
146 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
147 %B = and <4 x i32> %rA, %A
148 %C = and <4 x i32> %rB, %rC
149 %D = or <4 x i32> %C, %B
153 ; (or (and rA, (not rC)), (and rC, rB))
154 define <4 x i32> @selectbits_v4i32_08(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
155 %A = xor <4 x i32> %rC, < i32 -1, i32 -1, i32 -1, i32 -1>
156 %B = and <4 x i32> %rA, %A
157 %C = and <4 x i32> %rC, %rB
158 %D = or <4 x i32> %C, %B
162 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
164 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
166 ; (or (and rC, rB), (and (not rC), rA))
167 define <8 x i16> @selectbits_v8i16_01(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
168 %C = and <8 x i16> %rC, %rB
169 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
170 i16 -1, i16 -1, i16 -1, i16 -1 >
171 %B = and <8 x i16> %A, %rA
172 %D = or <8 x i16> %C, %B
176 ; (or (and rB, rC), (and (not rC), rA))
177 define <8 x i16> @selectbits_v8i16_02(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
178 %C = and <8 x i16> %rB, %rC
179 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
180 i16 -1, i16 -1, i16 -1, i16 -1 >
181 %B = and <8 x i16> %A, %rA
182 %D = or <8 x i16> %C, %B
186 ; (or (and (not rC), rA), (and rB, rC))
187 define <8 x i16> @selectbits_v8i16_03(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
188 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
189 i16 -1, i16 -1, i16 -1, i16 -1 >
190 %B = and <8 x i16> %A, %rA
191 %C = and <8 x i16> %rB, %rC
192 %D = or <8 x i16> %C, %B
196 ; (or (and (not rC), rA), (and rC, rB))
197 define <8 x i16> @selectbits_v8i16_04(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
198 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
199 i16 -1, i16 -1, i16 -1, i16 -1 >
200 %B = and <8 x i16> %A, %rA
201 %C = and <8 x i16> %rC, %rB
202 %D = or <8 x i16> %C, %B
206 ; (or (and rC, rB), (and rA, (not rC)))
207 define <8 x i16> @selectbits_v8i16_05(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
208 %C = and <8 x i16> %rC, %rB
209 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
210 i16 -1, i16 -1, i16 -1, i16 -1 >
211 %B = and <8 x i16> %rA, %A
212 %D = or <8 x i16> %C, %B
216 ; (or (and rB, rC), (and rA, (not rC)))
217 define <8 x i16> @selectbits_v8i16_06(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
218 %C = and <8 x i16> %rB, %rC
219 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
220 i16 -1, i16 -1, i16 -1, i16 -1 >
221 %B = and <8 x i16> %rA, %A
222 %D = or <8 x i16> %C, %B
226 ; (or (and rA, (not rC)), (and rB, rC))
227 define <8 x i16> @selectbits_v8i16_07(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
228 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
229 i16 -1, i16 -1, i16 -1, i16 -1 >
230 %B = and <8 x i16> %rA, %A
231 %C = and <8 x i16> %rB, %rC
232 %D = or <8 x i16> %C, %B
236 ; (or (and rA, (not rC)), (and rC, rB))
237 define <8 x i16> @selectbits_v8i16_08(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
238 %A = xor <8 x i16> %rC, < i16 -1, i16 -1, i16 -1, i16 -1,
239 i16 -1, i16 -1, i16 -1, i16 -1 >
240 %B = and <8 x i16> %rA, %A
241 %C = and <8 x i16> %rC, %rB
242 %D = or <8 x i16> %C, %B
246 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
248 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
250 ; (or (and rC, rB), (and (not rC), rA))
251 define <16 x i8> @selectbits_v16i8_01(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
252 %C = and <16 x i8> %rC, %rB
253 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
254 i8 -1, i8 -1, i8 -1, i8 -1,
255 i8 -1, i8 -1, i8 -1, i8 -1,
256 i8 -1, i8 -1, i8 -1, i8 -1 >
257 %B = and <16 x i8> %A, %rA
258 %D = or <16 x i8> %C, %B
262 ; (or (and rB, rC), (and (not rC), rA))
263 define <16 x i8> @selectbits_v16i8_02(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
264 %C = and <16 x i8> %rB, %rC
265 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
266 i8 -1, i8 -1, i8 -1, i8 -1,
267 i8 -1, i8 -1, i8 -1, i8 -1,
268 i8 -1, i8 -1, i8 -1, i8 -1 >
269 %B = and <16 x i8> %A, %rA
270 %D = or <16 x i8> %C, %B
274 ; (or (and (not rC), rA), (and rB, rC))
275 define <16 x i8> @selectbits_v16i8_03(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
276 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
277 i8 -1, i8 -1, i8 -1, i8 -1,
278 i8 -1, i8 -1, i8 -1, i8 -1,
279 i8 -1, i8 -1, i8 -1, i8 -1 >
280 %B = and <16 x i8> %A, %rA
281 %C = and <16 x i8> %rB, %rC
282 %D = or <16 x i8> %C, %B
286 ; (or (and (not rC), rA), (and rC, rB))
287 define <16 x i8> @selectbits_v16i8_04(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
288 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
289 i8 -1, i8 -1, i8 -1, i8 -1,
290 i8 -1, i8 -1, i8 -1, i8 -1,
291 i8 -1, i8 -1, i8 -1, i8 -1 >
292 %B = and <16 x i8> %A, %rA
293 %C = and <16 x i8> %rC, %rB
294 %D = or <16 x i8> %C, %B
298 ; (or (and rC, rB), (and rA, (not rC)))
299 define <16 x i8> @selectbits_v16i8_05(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
300 %C = and <16 x i8> %rC, %rB
301 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
302 i8 -1, i8 -1, i8 -1, i8 -1,
303 i8 -1, i8 -1, i8 -1, i8 -1,
304 i8 -1, i8 -1, i8 -1, i8 -1 >
305 %B = and <16 x i8> %rA, %A
306 %D = or <16 x i8> %C, %B
310 ; (or (and rB, rC), (and rA, (not rC)))
311 define <16 x i8> @selectbits_v16i8_06(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
312 %C = and <16 x i8> %rB, %rC
313 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
314 i8 -1, i8 -1, i8 -1, i8 -1,
315 i8 -1, i8 -1, i8 -1, i8 -1,
316 i8 -1, i8 -1, i8 -1, i8 -1 >
317 %B = and <16 x i8> %rA, %A
318 %D = or <16 x i8> %C, %B
322 ; (or (and rA, (not rC)), (and rB, rC))
323 define <16 x i8> @selectbits_v16i8_07(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
324 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
325 i8 -1, i8 -1, i8 -1, i8 -1,
326 i8 -1, i8 -1, i8 -1, i8 -1,
327 i8 -1, i8 -1, i8 -1, i8 -1 >
328 %B = and <16 x i8> %rA, %A
329 %C = and <16 x i8> %rB, %rC
330 %D = or <16 x i8> %C, %B
334 ; (or (and rA, (not rC)), (and rC, rB))
335 define <16 x i8> @selectbits_v16i8_08(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
336 %A = xor <16 x i8> %rC, < i8 -1, i8 -1, i8 -1, i8 -1,
337 i8 -1, i8 -1, i8 -1, i8 -1,
338 i8 -1, i8 -1, i8 -1, i8 -1,
339 i8 -1, i8 -1, i8 -1, i8 -1 >
340 %B = and <16 x i8> %rA, %A
341 %C = and <16 x i8> %rC, %rB
342 %D = or <16 x i8> %C, %B
346 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
348 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
350 ; (or (and rC, rB), (and (not rC), rA))
351 define i32 @selectbits_i32_01(i32 %rA, i32 %rB, i32 %rC) {
352 %C = and i32 %rC, %rB
359 ; (or (and rB, rC), (and (not rC), rA))
360 define i32 @selectbits_i32_02(i32 %rA, i32 %rB, i32 %rC) {
361 %C = and i32 %rB, %rC
368 ; (or (and (not rC), rA), (and rB, rC))
369 define i32 @selectbits_i32_03(i32 %rA, i32 %rB, i32 %rC) {
372 %C = and i32 %rB, %rC
377 ; (or (and (not rC), rA), (and rC, rB))
378 define i32 @selectbits_i32_04(i32 %rA, i32 %rB, i32 %rC) {
381 %C = and i32 %rC, %rB
386 ; (or (and rC, rB), (and rA, (not rC)))
387 define i32 @selectbits_i32_05(i32 %rA, i32 %rB, i32 %rC) {
388 %C = and i32 %rC, %rB
395 ; (or (and rB, rC), (and rA, (not rC)))
396 define i32 @selectbits_i32_06(i32 %rA, i32 %rB, i32 %rC) {
397 %C = and i32 %rB, %rC
404 ; (or (and rA, (not rC)), (and rB, rC))
405 define i32 @selectbits_i32_07(i32 %rA, i32 %rB, i32 %rC) {
408 %C = and i32 %rB, %rC
413 ; (or (and rA, (not rC)), (and rC, rB))
414 define i32 @selectbits_i32_08(i32 %rA, i32 %rB, i32 %rC) {
417 %C = and i32 %rC, %rB
422 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
424 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
426 ; (or (and rC, rB), (and (not rC), rA))
427 define i16 @selectbits_i16_01(i16 %rA, i16 %rB, i16 %rC) {
428 %C = and i16 %rC, %rB
435 ; (or (and rB, rC), (and (not rC), rA))
436 define i16 @selectbits_i16_02(i16 %rA, i16 %rB, i16 %rC) {
437 %C = and i16 %rB, %rC
444 ; (or (and (not rC), rA), (and rB, rC))
445 define i16 @selectbits_i16_03(i16 %rA, i16 %rB, i16 %rC) {
448 %C = and i16 %rB, %rC
453 ; (or (and (not rC), rA), (and rC, rB))
454 define i16 @selectbits_i16_04(i16 %rA, i16 %rB, i16 %rC) {
457 %C = and i16 %rC, %rB
462 ; (or (and rC, rB), (and rA, (not rC)))
463 define i16 @selectbits_i16_05(i16 %rA, i16 %rB, i16 %rC) {
464 %C = and i16 %rC, %rB
471 ; (or (and rB, rC), (and rA, (not rC)))
472 define i16 @selectbits_i16_06(i16 %rA, i16 %rB, i16 %rC) {
473 %C = and i16 %rB, %rC
480 ; (or (and rA, (not rC)), (and rB, rC))
481 define i16 @selectbits_i16_07(i16 %rA, i16 %rB, i16 %rC) {
484 %C = and i16 %rB, %rC
489 ; (or (and rA, (not rC)), (and rC, rB))
490 define i16 @selectbits_i16_08(i16 %rA, i16 %rB, i16 %rC) {
493 %C = and i16 %rC, %rB
498 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
500 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
502 ; (or (and rC, rB), (and (not rC), rA))
503 define i8 @selectbits_i8_01(i8 %rA, i8 %rB, i8 %rC) {
511 ; (or (and rB, rC), (and (not rC), rA))
512 define i8 @selectbits_i8_02(i8 %rA, i8 %rB, i8 %rC) {
520 ; (or (and (not rC), rA), (and rB, rC))
521 define i8 @selectbits_i8_03(i8 %rA, i8 %rB, i8 %rC) {
529 ; (or (and (not rC), rA), (and rC, rB))
530 define i8 @selectbits_i8_04(i8 %rA, i8 %rB, i8 %rC) {
538 ; (or (and rC, rB), (and rA, (not rC)))
539 define i8 @selectbits_i8_05(i8 %rA, i8 %rB, i8 %rC) {
547 ; (or (and rB, rC), (and rA, (not rC)))
548 define i8 @selectbits_i8_06(i8 %rA, i8 %rB, i8 %rC) {
556 ; (or (and rA, (not rC)), (and rB, rC))
557 define i8 @selectbits_i8_07(i8 %rA, i8 %rB, i8 %rC) {
565 ; (or (and rA, (not rC)), (and rC, rB))
566 define i8 @selectbits_i8_08(i8 %rA, i8 %rB, i8 %rC) {