1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep selb %t1.s | count 160
3 ; RUN: grep and %t1.s | count 2
4 ; RUN: grep xsbh %t1.s | count 1
5 ; RUN: grep xshw %t1.s | count 2
7 define <16 x i8> @selb_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
8 %A = xor <16 x i8> %arg3, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
9 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
10 i8 -1, i8 -1, i8 -1, i8 -1 >
11 %B = and <16 x i8> %A, %arg1 ; <<16 x i8>> [#uses=1]
12 %C = and <16 x i8> %arg2, %arg3 ; <<16 x i8>> [#uses=1]
13 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
17 define <16 x i8> @selb_v16i8_11(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
18 %A = xor <16 x i8> %arg3, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
19 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
20 i8 -1, i8 -1, i8 -1, i8 -1 >
21 %B = and <16 x i8> %arg1, %A ; <<16 x i8>> [#uses=1]
22 %C = and <16 x i8> %arg3, %arg2 ; <<16 x i8>> [#uses=1]
23 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
27 define <16 x i8> @selb_v16i8_12(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
28 %A = xor <16 x i8> %arg3, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
29 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
30 i8 -1, i8 -1, i8 -1, i8 -1 >
31 %B = and <16 x i8> %arg1, %A ; <<16 x i8>> [#uses=1]
32 %C = and <16 x i8> %arg2, %arg3 ; <<16 x i8>> [#uses=1]
33 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
37 define <16 x i8> @selb_v16i8_13(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
38 %A = xor <16 x i8> %arg3, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
39 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
40 i8 -1, i8 -1, i8 -1, i8 -1 >
41 %B = and <16 x i8> %A, %arg1 ; <<16 x i8>> [#uses=1]
42 %C = and <16 x i8> %arg2, %arg3 ; <<16 x i8>> [#uses=1]
43 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
47 define <16 x i8> @selb_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
48 %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
49 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
50 i8 -1, i8 -1, i8 -1, i8 -1 >
51 %B = and <16 x i8> %A, %arg2 ; <<16 x i8>> [#uses=1]
52 %C = and <16 x i8> %arg3, %arg1 ; <<16 x i8>> [#uses=1]
53 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
57 define <16 x i8> @selb_v16i8_21(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
58 %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
59 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
60 i8 -1, i8 -1, i8 -1, i8 -1 >
61 %B = and <16 x i8> %arg2, %A ; <<16 x i8>> [#uses=1]
62 %C = and <16 x i8> %arg3, %arg1 ; <<16 x i8>> [#uses=1]
63 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
67 define <16 x i8> @selb_v16i8_3(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
68 %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
69 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
70 i8 -1, i8 -1, i8 -1, i8 -1 >
71 %B = and <16 x i8> %A, %arg1 ; <<16 x i8>> [#uses=1]
72 %C = and <16 x i8> %arg3, %arg2 ; <<16 x i8>> [#uses=1]
73 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
77 define <16 x i8> @selb_v16i8_4(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
78 %C = and <16 x i8> %arg3, %arg2 ; <<16 x i8>> [#uses=1]
79 %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
80 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
81 i8 -1, i8 -1, i8 -1, i8 -1 >
82 %B = and <16 x i8> %A, %arg1 ; <<16 x i8>> [#uses=1]
83 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
87 define <16 x i8> @selb_v16i8_41(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
88 %C = and <16 x i8> %arg2, %arg3 ; <<16 x i8>> [#uses=1]
89 %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
90 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
91 i8 -1, i8 -1, i8 -1, i8 -1 >
92 %B = and <16 x i8> %arg1, %A ; <<16 x i8>> [#uses=1]
93 %D = or <16 x i8> %C, %B ; <<16 x i8>> [#uses=1]
97 define <16 x i8> @selb_v16i8_42(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
98 %C = and <16 x i8> %arg2, %arg3 ; <<16 x i8>> [#uses=1]
99 %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
100 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
101 i8 -1, i8 -1, i8 -1, i8 -1 >
102 %B = and <16 x i8> %A, %arg1 ; <<16 x i8>> [#uses=1]
103 %D = or <16 x i8> %C, %B ; <<16 x i8>> [#uses=1]
107 define <16 x i8> @selb_v16i8_5(<16 x i8> %arg1, <16 x i8> %arg2, <16 x i8> %arg3) {
108 %C = and <16 x i8> %arg2, %arg1 ; <<16 x i8>> [#uses=1]
109 %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
110 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
111 i8 -1, i8 -1, i8 -1, i8 -1 >
112 %B = and <16 x i8> %A, %arg3 ; <<16 x i8>> [#uses=1]
113 %D = or <16 x i8> %B, %C ; <<16 x i8>> [#uses=1]
117 define <8 x i16> @selb_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
118 %A = xor <8 x i16> %arg3, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
120 %B = and <8 x i16> %A, %arg1 ; <<8 x i16>> [#uses=1]
121 %C = and <8 x i16> %arg2, %arg3 ; <<8 x i16>> [#uses=1]
122 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
126 define <8 x i16> @selb_v8i16_11(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
127 %A = xor <8 x i16> %arg3, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
129 %B = and <8 x i16> %arg1, %A ; <<8 x i16>> [#uses=1]
130 %C = and <8 x i16> %arg3, %arg2 ; <<8 x i16>> [#uses=1]
131 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
135 define <8 x i16> @selb_v8i16_12(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
136 %A = xor <8 x i16> %arg3, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
138 %B = and <8 x i16> %arg1, %A ; <<8 x i16>> [#uses=1]
139 %C = and <8 x i16> %arg2, %arg3 ; <<8 x i16>> [#uses=1]
140 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
144 define <8 x i16> @selb_v8i16_13(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
145 %A = xor <8 x i16> %arg3, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
147 %B = and <8 x i16> %A, %arg1 ; <<8 x i16>> [#uses=1]
148 %C = and <8 x i16> %arg2, %arg3 ; <<8 x i16>> [#uses=1]
149 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
153 define <8 x i16> @selb_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
154 %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
156 %B = and <8 x i16> %A, %arg2 ; <<8 x i16>> [#uses=1]
157 %C = and <8 x i16> %arg3, %arg1 ; <<8 x i16>> [#uses=1]
158 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
162 define <8 x i16> @selb_v8i16_21(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
163 %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
165 %B = and <8 x i16> %arg2, %A ; <<8 x i16>> [#uses=1]
166 %C = and <8 x i16> %arg3, %arg1 ; <<8 x i16>> [#uses=1]
167 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
171 define <8 x i16> @selb_v8i16_3(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
172 %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
174 %B = and <8 x i16> %A, %arg1 ; <<8 x i16>> [#uses=1]
175 %C = and <8 x i16> %arg3, %arg2 ; <<8 x i16>> [#uses=1]
176 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
180 define <8 x i16> @selb_v8i16_4(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
181 %C = and <8 x i16> %arg3, %arg2 ; <<8 x i16>> [#uses=1]
182 %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
184 %B = and <8 x i16> %A, %arg1 ; <<8 x i16>> [#uses=1]
185 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
189 define <8 x i16> @selb_v8i16_41(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
190 %C = and <8 x i16> %arg2, %arg3 ; <<8 x i16>> [#uses=1]
191 %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
193 %B = and <8 x i16> %arg1, %A ; <<8 x i16>> [#uses=1]
194 %D = or <8 x i16> %C, %B ; <<8 x i16>> [#uses=1]
198 define <8 x i16> @selb_v8i16_42(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
199 %C = and <8 x i16> %arg2, %arg3 ; <<8 x i16>> [#uses=1]
200 %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
202 %B = and <8 x i16> %A, %arg1 ; <<8 x i16>> [#uses=1]
203 %D = or <8 x i16> %C, %B ; <<8 x i16>> [#uses=1]
207 define <8 x i16> @selb_v8i16_5(<8 x i16> %arg1, <8 x i16> %arg2, <8 x i16> %arg3) {
208 %C = and <8 x i16> %arg2, %arg1 ; <<8 x i16>> [#uses=1]
209 %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1,
211 %B = and <8 x i16> %A, %arg3 ; <<8 x i16>> [#uses=1]
212 %D = or <8 x i16> %B, %C ; <<8 x i16>> [#uses=1]
216 define <4 x i32> @selb_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32> %arg3) {
217 %tmpnot = xor <4 x i32> %arg3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
218 %tmp2 = and <4 x i32> %tmpnot, %arg1 ; <<4 x i32>> [#uses=1]
219 %tmp5 = and <4 x i32> %arg2, %arg3 ; <<4 x i32>> [#uses=1]
220 %tmp6 = or <4 x i32> %tmp2, %tmp5 ; <<4 x i32>> [#uses=1]
224 define <4 x i32> @selb_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32> %arg3) {
225 %tmpnot = xor <4 x i32> %arg3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
226 %tmp2 = and <4 x i32> %tmpnot, %arg1 ; <<4 x i32>> [#uses=1]
227 %tmp5 = and <4 x i32> %arg2, %arg3 ; <<4 x i32>> [#uses=1]
228 %tmp6 = or <4 x i32> %tmp2, %tmp5 ; <<4 x i32>> [#uses=1]
232 define <4 x i32> @selb_v4i32_3(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32> %arg3) {
233 %tmpnot = xor <4 x i32> %arg3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
234 %tmp2 = and <4 x i32> %tmpnot, %arg1 ; <<4 x i32>> [#uses=1]
235 %tmp5 = and <4 x i32> %arg3, %arg2 ; <<4 x i32>> [#uses=1]
236 %tmp6 = or <4 x i32> %tmp2, %tmp5 ; <<4 x i32>> [#uses=1]
240 define <4 x i32> @selb_v4i32_4(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32> %arg3) {
241 %tmp2 = and <4 x i32> %arg3, %arg2 ; <<4 x i32>> [#uses=1]
242 %tmp3not = xor <4 x i32> %arg3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
243 %tmp5 = and <4 x i32> %tmp3not, %arg1 ; <<4 x i32>> [#uses=1]
244 %tmp6 = or <4 x i32> %tmp2, %tmp5 ; <<4 x i32>> [#uses=1]
248 define <4 x i32> @selb_v4i32_5(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32> %arg3) {
249 %tmp2 = and <4 x i32> %arg3, %arg2 ; <<4 x i32>> [#uses=1]
250 %tmp3not = xor <4 x i32> %arg3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
251 %tmp5 = and <4 x i32> %tmp3not, %arg1 ; <<4 x i32>> [#uses=1]
252 %tmp6 = or <4 x i32> %tmp2, %tmp5 ; <<4 x i32>> [#uses=1]
256 define i32 @selb_i32(i32 %arg1, i32 %arg2, i32 %arg3) {
257 %tmp1not = xor i32 %arg3, -1 ; <i32> [#uses=1]
258 %tmp3 = and i32 %tmp1not, %arg1 ; <i32> [#uses=1]
259 %tmp6 = and i32 %arg3, %arg2 ; <i32> [#uses=1]
260 %tmp7 = or i32 %tmp3, %tmp6 ; <i32> [#uses=1]
264 define i16 @selb_i16(i16 signext %arg1, i16 signext %arg2, i16 signext %arg3) signext {
265 %tmp3 = and i16 %arg3, %arg1 ; <i16> [#uses=1]
266 %tmp4not = xor i16 %arg3, -1 ; <i16> [#uses=1]
267 %tmp6 = and i16 %tmp4not, %arg2 ; <i16> [#uses=1]
268 %retval1011 = or i16 %tmp3, %tmp6 ; <i16> [#uses=1]
272 define i16 @selb_i16u(i16 zeroext %arg1, i16 zeroext %arg2, i16 zeroext %arg3) zeroext {
273 %tmp3 = and i16 %arg3, %arg1 ; <i16> [#uses=1]
274 %tmp4not = xor i16 %arg3, -1 ; <i16> [#uses=1]
275 %tmp6 = and i16 %tmp4not, %arg2 ; <i16> [#uses=1]
276 %retval1011 = or i16 %tmp3, %tmp6 ; <i16> [#uses=1]
280 define i8 @selb_i8u(i8 zeroext %arg1, i8 zeroext %arg2, i8 zeroext %arg3) zeroext {
281 %tmp3 = and i8 %arg3, %arg1 ; <i8> [#uses=1]
282 %tmp4not = xor i8 %arg3, -1 ; <i8> [#uses=1]
283 %tmp6 = and i8 %tmp4not, %arg2 ; <i8> [#uses=1]
284 %retval1011 = or i8 %tmp3, %tmp6 ; <i8> [#uses=1]
288 define i8 @selb_i8(i8 signext %arg1, i8 signext %arg2, i8 signext %arg3) signext {
289 %tmp3 = and i8 %arg3, %arg1 ; <i8> [#uses=1]
290 %tmp4not = xor i8 %arg3, -1 ; <i8> [#uses=1]
291 %tmp6 = and i8 %tmp4not, %arg2 ; <i8> [#uses=1]
292 %retval1011 = or i8 %tmp3, %tmp6 ; <i8> [#uses=1]