blob: 65e0aa6fa0b0084febd1c5c6c1fd45a74e9dfe1f [file] [log] [blame]
Dan Gohmanb7c0b242009-09-11 18:36:27 +00001; RUN: llc < %s -march=cellspu > %t1.s
Scott Michelc9c8b2a2009-01-26 03:31:40 +00002; RUN: grep selb %t1.s | count 56
Scott Michel53dec472008-03-05 23:00:19 +00003
Dan Gohman65fd6562011-11-03 21:49:52 +00004; CellSPU legalization is over-sensitive to Legalize's traversal order.
5; XFAIL: *
6
Scott Michel9de5d0d2008-01-11 02:53:15 +00007target 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"
8target triple = "spu"
Scott Michel0a92af42007-12-19 20:50:49 +00009
Scott Michel53dec472008-03-05 23:00:19 +000010;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
11; v2i64
12;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
13
14; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000015define <2 x i64> @selectbits_v2i64_01(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000016 %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
20 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000021}
22
Scott Michel53dec472008-03-05 23:00:19 +000023; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000024define <2 x i64> @selectbits_v2i64_02(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000025 %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
29 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000030}
31
Scott Michel53dec472008-03-05 23:00:19 +000032; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000033define <2 x i64> @selectbits_v2i64_03(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000034 %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
38 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000039}
40
Scott Michel53dec472008-03-05 23:00:19 +000041; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000042define <2 x i64> @selectbits_v2i64_04(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000043 %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
47 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000048}
49
Scott Michel53dec472008-03-05 23:00:19 +000050; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000051define <2 x i64> @selectbits_v2i64_05(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000052 %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
56 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000057}
58
Scott Michel53dec472008-03-05 23:00:19 +000059; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000060define <2 x i64> @selectbits_v2i64_06(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000061 %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
65 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000066}
67
Scott Michel53dec472008-03-05 23:00:19 +000068; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000069define <2 x i64> @selectbits_v2i64_07(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000070 %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
74 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000075}
76
Scott Michel53dec472008-03-05 23:00:19 +000077; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000078define <2 x i64> @selectbits_v2i64_08(<2 x i64> %rA, <2 x i64> %rB, <2 x i64> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000079 %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
83 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000084}
85
Scott Michel53dec472008-03-05 23:00:19 +000086;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
87; v4i32
88;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
89
90; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000091define <4 x i32> @selectbits_v4i32_01(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +000092 %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
96 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +000097}
98
Scott Michel53dec472008-03-05 23:00:19 +000099; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000100define <4 x i32> @selectbits_v4i32_02(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000101 %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
105 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000106}
107
Scott Michel53dec472008-03-05 23:00:19 +0000108; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000109define <4 x i32> @selectbits_v4i32_03(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000110 %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
114 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000115}
116
Scott Michel53dec472008-03-05 23:00:19 +0000117; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000118define <4 x i32> @selectbits_v4i32_04(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000119 %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
123 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000124}
125
Scott Michel53dec472008-03-05 23:00:19 +0000126; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000127define <4 x i32> @selectbits_v4i32_05(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000128 %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
132 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000133}
134
Scott Michel53dec472008-03-05 23:00:19 +0000135; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000136define <4 x i32> @selectbits_v4i32_06(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000137 %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
141 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000142}
143
Scott Michel53dec472008-03-05 23:00:19 +0000144; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000145define <4 x i32> @selectbits_v4i32_07(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000146 %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
150 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000151}
152
Scott Michel53dec472008-03-05 23:00:19 +0000153; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000154define <4 x i32> @selectbits_v4i32_08(<4 x i32> %rA, <4 x i32> %rB, <4 x i32> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000155 %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
159 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000160}
161
Scott Michel53dec472008-03-05 23:00:19 +0000162;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
163; v8i16
164;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
165
166; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000167define <8 x i16> @selectbits_v8i16_01(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000168 %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
173 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000174}
175
Scott Michel53dec472008-03-05 23:00:19 +0000176; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000177define <8 x i16> @selectbits_v8i16_02(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000178 %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
183 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000184}
185
Scott Michel53dec472008-03-05 23:00:19 +0000186; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000187define <8 x i16> @selectbits_v8i16_03(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000188 %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
193 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000194}
195
Scott Michel53dec472008-03-05 23:00:19 +0000196; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000197define <8 x i16> @selectbits_v8i16_04(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000198 %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
203 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000204}
205
Scott Michel53dec472008-03-05 23:00:19 +0000206; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000207define <8 x i16> @selectbits_v8i16_05(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000208 %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
213 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000214}
215
Scott Michel53dec472008-03-05 23:00:19 +0000216; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000217define <8 x i16> @selectbits_v8i16_06(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000218 %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
223 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000224}
225
Scott Michel53dec472008-03-05 23:00:19 +0000226; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000227define <8 x i16> @selectbits_v8i16_07(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000228 %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
233 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000234}
235
Scott Michel53dec472008-03-05 23:00:19 +0000236; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000237define <8 x i16> @selectbits_v8i16_08(<8 x i16> %rA, <8 x i16> %rB, <8 x i16> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000238 %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
243 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000244}
245
Scott Michel53dec472008-03-05 23:00:19 +0000246;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
247; v16i8
248;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
249
250; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000251define <16 x i8> @selectbits_v16i8_01(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000252 %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
259 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000260}
261
Scott Michel53dec472008-03-05 23:00:19 +0000262; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000263define <16 x i8> @selectbits_v16i8_02(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000264 %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
271 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000272}
273
Scott Michel53dec472008-03-05 23:00:19 +0000274; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000275define <16 x i8> @selectbits_v16i8_03(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000276 %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
283 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000284}
285
Scott Michel53dec472008-03-05 23:00:19 +0000286; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000287define <16 x i8> @selectbits_v16i8_04(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000288 %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
295 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000296}
297
Scott Michel53dec472008-03-05 23:00:19 +0000298; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000299define <16 x i8> @selectbits_v16i8_05(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000300 %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
307 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000308}
309
Scott Michel53dec472008-03-05 23:00:19 +0000310; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000311define <16 x i8> @selectbits_v16i8_06(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000312 %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
319 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000320}
321
Scott Michel53dec472008-03-05 23:00:19 +0000322; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000323define <16 x i8> @selectbits_v16i8_07(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000324 %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
331 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000332}
333
Scott Michel53dec472008-03-05 23:00:19 +0000334; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000335define <16 x i8> @selectbits_v16i8_08(<16 x i8> %rA, <16 x i8> %rB, <16 x i8> %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000336 %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
343 ret <16 x i8> %D
344}
345
346;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
347; i32
348;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
349
350; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000351define i32 @selectbits_i32_01(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000352 %C = and i32 %rC, %rB
353 %A = xor i32 %rC, -1
354 %B = and i32 %A, %rA
355 %D = or i32 %C, %B
356 ret i32 %D
357}
358
359; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000360define i32 @selectbits_i32_02(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000361 %C = and i32 %rB, %rC
362 %A = xor i32 %rC, -1
363 %B = and i32 %A, %rA
364 %D = or i32 %C, %B
365 ret i32 %D
366}
367
368; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000369define i32 @selectbits_i32_03(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000370 %A = xor i32 %rC, -1
371 %B = and i32 %A, %rA
372 %C = and i32 %rB, %rC
373 %D = or i32 %C, %B
374 ret i32 %D
375}
376
377; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000378define i32 @selectbits_i32_04(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000379 %A = xor i32 %rC, -1
380 %B = and i32 %A, %rA
381 %C = and i32 %rC, %rB
382 %D = or i32 %C, %B
383 ret i32 %D
384}
385
386; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000387define i32 @selectbits_i32_05(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000388 %C = and i32 %rC, %rB
389 %A = xor i32 %rC, -1
390 %B = and i32 %rA, %A
391 %D = or i32 %C, %B
392 ret i32 %D
393}
394
395; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000396define i32 @selectbits_i32_06(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000397 %C = and i32 %rB, %rC
398 %A = xor i32 %rC, -1
399 %B = and i32 %rA, %A
400 %D = or i32 %C, %B
401 ret i32 %D
402}
403
404; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000405define i32 @selectbits_i32_07(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000406 %A = xor i32 %rC, -1
407 %B = and i32 %rA, %A
408 %C = and i32 %rB, %rC
409 %D = or i32 %C, %B
410 ret i32 %D
411}
412
413; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000414define i32 @selectbits_i32_08(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000415 %A = xor i32 %rC, -1
416 %B = and i32 %rA, %A
417 %C = and i32 %rC, %rB
418 %D = or i32 %C, %B
419 ret i32 %D
420}
421
422;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
423; i16
424;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
425
426; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000427define i16 @selectbits_i16_01(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000428 %C = and i16 %rC, %rB
429 %A = xor i16 %rC, -1
430 %B = and i16 %A, %rA
431 %D = or i16 %C, %B
432 ret i16 %D
433}
434
435; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000436define i16 @selectbits_i16_02(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000437 %C = and i16 %rB, %rC
438 %A = xor i16 %rC, -1
439 %B = and i16 %A, %rA
440 %D = or i16 %C, %B
441 ret i16 %D
442}
443
444; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000445define i16 @selectbits_i16_03(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000446 %A = xor i16 %rC, -1
447 %B = and i16 %A, %rA
448 %C = and i16 %rB, %rC
449 %D = or i16 %C, %B
450 ret i16 %D
451}
452
453; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000454define i16 @selectbits_i16_04(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000455 %A = xor i16 %rC, -1
456 %B = and i16 %A, %rA
457 %C = and i16 %rC, %rB
458 %D = or i16 %C, %B
459 ret i16 %D
460}
461
462; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000463define i16 @selectbits_i16_05(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000464 %C = and i16 %rC, %rB
465 %A = xor i16 %rC, -1
466 %B = and i16 %rA, %A
467 %D = or i16 %C, %B
468 ret i16 %D
469}
470
471; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000472define i16 @selectbits_i16_06(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000473 %C = and i16 %rB, %rC
474 %A = xor i16 %rC, -1
475 %B = and i16 %rA, %A
476 %D = or i16 %C, %B
477 ret i16 %D
478}
479
480; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000481define i16 @selectbits_i16_07(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000482 %A = xor i16 %rC, -1
483 %B = and i16 %rA, %A
484 %C = and i16 %rB, %rC
485 %D = or i16 %C, %B
486 ret i16 %D
487}
488
489; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000490define i16 @selectbits_i16_08(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000491 %A = xor i16 %rC, -1
492 %B = and i16 %rA, %A
493 %C = and i16 %rC, %rB
494 %D = or i16 %C, %B
495 ret i16 %D
496}
497
498;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
499; i8
500;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
501
502; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000503define i8 @selectbits_i8_01(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000504 %C = and i8 %rC, %rB
505 %A = xor i8 %rC, -1
506 %B = and i8 %A, %rA
507 %D = or i8 %C, %B
508 ret i8 %D
509}
510
511; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000512define i8 @selectbits_i8_02(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000513 %C = and i8 %rB, %rC
514 %A = xor i8 %rC, -1
515 %B = and i8 %A, %rA
516 %D = or i8 %C, %B
517 ret i8 %D
518}
519
520; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000521define i8 @selectbits_i8_03(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000522 %A = xor i8 %rC, -1
523 %B = and i8 %A, %rA
524 %C = and i8 %rB, %rC
525 %D = or i8 %C, %B
526 ret i8 %D
527}
528
529; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000530define i8 @selectbits_i8_04(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000531 %A = xor i8 %rC, -1
532 %B = and i8 %A, %rA
533 %C = and i8 %rC, %rB
534 %D = or i8 %C, %B
535 ret i8 %D
536}
537
538; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000539define i8 @selectbits_i8_05(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000540 %C = and i8 %rC, %rB
541 %A = xor i8 %rC, -1
542 %B = and i8 %rA, %A
543 %D = or i8 %C, %B
544 ret i8 %D
545}
546
547; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000548define i8 @selectbits_i8_06(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000549 %C = and i8 %rB, %rC
550 %A = xor i8 %rC, -1
551 %B = and i8 %rA, %A
552 %D = or i8 %C, %B
553 ret i8 %D
554}
555
556; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000557define i8 @selectbits_i8_07(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000558 %A = xor i8 %rC, -1
559 %B = and i8 %rA, %A
560 %C = and i8 %rB, %rC
561 %D = or i8 %C, %B
562 ret i8 %D
563}
564
565; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000566define i8 @selectbits_i8_08(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000567 %A = xor i8 %rC, -1
568 %B = and i8 %rA, %A
569 %C = and i8 %rC, %rB
570 %D = or i8 %C, %B
571 ret i8 %D
Scott Michel0a92af42007-12-19 20:50:49 +0000572}