blob: c804256f513b7596166fd2d87774cc97bbb66b8b [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
Scott Michel9de5d0d2008-01-11 02:53:15 +00004target 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"
5target triple = "spu"
Scott Michel0a92af42007-12-19 20:50:49 +00006
Scott Michel53dec472008-03-05 23:00:19 +00007;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
8; v2i64
9;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
10
11; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000012define <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 +000013 %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
17 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000018}
19
Scott Michel53dec472008-03-05 23:00:19 +000020; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000021define <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 +000022 %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
26 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000027}
28
Scott Michel53dec472008-03-05 23:00:19 +000029; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000030define <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 +000031 %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
35 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000036}
37
Scott Michel53dec472008-03-05 23:00:19 +000038; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000039define <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 +000040 %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
44 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000045}
46
Scott Michel53dec472008-03-05 23:00:19 +000047; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000048define <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 +000049 %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
53 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000054}
55
Scott Michel53dec472008-03-05 23:00:19 +000056; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000057define <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 +000058 %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
62 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000063}
64
Scott Michel53dec472008-03-05 23:00:19 +000065; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000066define <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 +000067 %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
71 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000072}
73
Scott Michel53dec472008-03-05 23:00:19 +000074; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000075define <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 +000076 %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
80 ret <2 x i64> %D
Scott Michel0a92af42007-12-19 20:50:49 +000081}
82
Scott Michel53dec472008-03-05 23:00:19 +000083;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
84; v4i32
85;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
86
87; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000088define <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 +000089 %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
93 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +000094}
95
Scott Michel53dec472008-03-05 23:00:19 +000096; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +000097define <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 +000098 %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
102 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000103}
104
Scott Michel53dec472008-03-05 23:00:19 +0000105; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000106define <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 +0000107 %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
111 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000112}
113
Scott Michel53dec472008-03-05 23:00:19 +0000114; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000115define <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 +0000116 %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
120 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000121}
122
Scott Michel53dec472008-03-05 23:00:19 +0000123; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000124define <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 +0000125 %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
129 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000130}
131
Scott Michel53dec472008-03-05 23:00:19 +0000132; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000133define <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 +0000134 %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
138 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000139}
140
Scott Michel53dec472008-03-05 23:00:19 +0000141; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000142define <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 +0000143 %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
147 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000148}
149
Scott Michel53dec472008-03-05 23:00:19 +0000150; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000151define <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 +0000152 %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
156 ret <4 x i32> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000157}
158
Scott Michel53dec472008-03-05 23:00:19 +0000159;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
160; v8i16
161;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
162
163; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000164define <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 +0000165 %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
170 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000171}
172
Scott Michel53dec472008-03-05 23:00:19 +0000173; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000174define <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 +0000175 %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
180 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000181}
182
Scott Michel53dec472008-03-05 23:00:19 +0000183; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000184define <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 +0000185 %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
190 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000191}
192
Scott Michel53dec472008-03-05 23:00:19 +0000193; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000194define <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 +0000195 %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
200 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000201}
202
Scott Michel53dec472008-03-05 23:00:19 +0000203; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000204define <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 +0000205 %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
210 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000211}
212
Scott Michel53dec472008-03-05 23:00:19 +0000213; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000214define <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 +0000215 %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
220 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000221}
222
Scott Michel53dec472008-03-05 23:00:19 +0000223; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000224define <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 +0000225 %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
230 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000231}
232
Scott Michel53dec472008-03-05 23:00:19 +0000233; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000234define <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 +0000235 %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
240 ret <8 x i16> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000241}
242
Scott Michel53dec472008-03-05 23:00:19 +0000243;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
244; v16i8
245;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
246
247; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000248define <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 +0000249 %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
256 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000257}
258
Scott Michel53dec472008-03-05 23:00:19 +0000259; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000260define <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 +0000261 %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
268 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000269}
270
Scott Michel53dec472008-03-05 23:00:19 +0000271; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000272define <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 +0000273 %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
280 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000281}
282
Scott Michel53dec472008-03-05 23:00:19 +0000283; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000284define <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 +0000285 %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
292 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000293}
294
Scott Michel53dec472008-03-05 23:00:19 +0000295; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000296define <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 +0000297 %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
304 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000305}
306
Scott Michel53dec472008-03-05 23:00:19 +0000307; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000308define <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 +0000309 %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
316 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000317}
318
Scott Michel53dec472008-03-05 23:00:19 +0000319; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000320define <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 +0000321 %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
328 ret <16 x i8> %D
Scott Michel0a92af42007-12-19 20:50:49 +0000329}
330
Scott Michel53dec472008-03-05 23:00:19 +0000331; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000332define <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 +0000333 %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
340 ret <16 x i8> %D
341}
342
343;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
344; i32
345;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
346
347; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000348define i32 @selectbits_i32_01(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000349 %C = and i32 %rC, %rB
350 %A = xor i32 %rC, -1
351 %B = and i32 %A, %rA
352 %D = or i32 %C, %B
353 ret i32 %D
354}
355
356; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000357define i32 @selectbits_i32_02(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000358 %C = and i32 %rB, %rC
359 %A = xor i32 %rC, -1
360 %B = and i32 %A, %rA
361 %D = or i32 %C, %B
362 ret i32 %D
363}
364
365; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000366define i32 @selectbits_i32_03(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000367 %A = xor i32 %rC, -1
368 %B = and i32 %A, %rA
369 %C = and i32 %rB, %rC
370 %D = or i32 %C, %B
371 ret i32 %D
372}
373
374; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000375define i32 @selectbits_i32_04(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000376 %A = xor i32 %rC, -1
377 %B = and i32 %A, %rA
378 %C = and i32 %rC, %rB
379 %D = or i32 %C, %B
380 ret i32 %D
381}
382
383; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000384define i32 @selectbits_i32_05(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000385 %C = and i32 %rC, %rB
386 %A = xor i32 %rC, -1
387 %B = and i32 %rA, %A
388 %D = or i32 %C, %B
389 ret i32 %D
390}
391
392; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000393define i32 @selectbits_i32_06(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000394 %C = and i32 %rB, %rC
395 %A = xor i32 %rC, -1
396 %B = and i32 %rA, %A
397 %D = or i32 %C, %B
398 ret i32 %D
399}
400
401; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000402define i32 @selectbits_i32_07(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000403 %A = xor i32 %rC, -1
404 %B = and i32 %rA, %A
405 %C = and i32 %rB, %rC
406 %D = or i32 %C, %B
407 ret i32 %D
408}
409
410; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000411define i32 @selectbits_i32_08(i32 %rA, i32 %rB, i32 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000412 %A = xor i32 %rC, -1
413 %B = and i32 %rA, %A
414 %C = and i32 %rC, %rB
415 %D = or i32 %C, %B
416 ret i32 %D
417}
418
419;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
420; i16
421;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
422
423; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000424define i16 @selectbits_i16_01(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000425 %C = and i16 %rC, %rB
426 %A = xor i16 %rC, -1
427 %B = and i16 %A, %rA
428 %D = or i16 %C, %B
429 ret i16 %D
430}
431
432; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000433define i16 @selectbits_i16_02(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000434 %C = and i16 %rB, %rC
435 %A = xor i16 %rC, -1
436 %B = and i16 %A, %rA
437 %D = or i16 %C, %B
438 ret i16 %D
439}
440
441; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000442define i16 @selectbits_i16_03(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000443 %A = xor i16 %rC, -1
444 %B = and i16 %A, %rA
445 %C = and i16 %rB, %rC
446 %D = or i16 %C, %B
447 ret i16 %D
448}
449
450; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000451define i16 @selectbits_i16_04(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000452 %A = xor i16 %rC, -1
453 %B = and i16 %A, %rA
454 %C = and i16 %rC, %rB
455 %D = or i16 %C, %B
456 ret i16 %D
457}
458
459; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000460define i16 @selectbits_i16_05(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000461 %C = and i16 %rC, %rB
462 %A = xor i16 %rC, -1
463 %B = and i16 %rA, %A
464 %D = or i16 %C, %B
465 ret i16 %D
466}
467
468; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000469define i16 @selectbits_i16_06(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000470 %C = and i16 %rB, %rC
471 %A = xor i16 %rC, -1
472 %B = and i16 %rA, %A
473 %D = or i16 %C, %B
474 ret i16 %D
475}
476
477; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000478define i16 @selectbits_i16_07(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000479 %A = xor i16 %rC, -1
480 %B = and i16 %rA, %A
481 %C = and i16 %rB, %rC
482 %D = or i16 %C, %B
483 ret i16 %D
484}
485
486; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000487define i16 @selectbits_i16_08(i16 %rA, i16 %rB, i16 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000488 %A = xor i16 %rC, -1
489 %B = and i16 %rA, %A
490 %C = and i16 %rC, %rB
491 %D = or i16 %C, %B
492 ret i16 %D
493}
494
495;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
496; i8
497;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
498
499; (or (and rC, rB), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000500define i8 @selectbits_i8_01(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000501 %C = and i8 %rC, %rB
502 %A = xor i8 %rC, -1
503 %B = and i8 %A, %rA
504 %D = or i8 %C, %B
505 ret i8 %D
506}
507
508; (or (and rB, rC), (and (not rC), rA))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000509define i8 @selectbits_i8_02(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000510 %C = and i8 %rB, %rC
511 %A = xor i8 %rC, -1
512 %B = and i8 %A, %rA
513 %D = or i8 %C, %B
514 ret i8 %D
515}
516
517; (or (and (not rC), rA), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000518define i8 @selectbits_i8_03(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000519 %A = xor i8 %rC, -1
520 %B = and i8 %A, %rA
521 %C = and i8 %rB, %rC
522 %D = or i8 %C, %B
523 ret i8 %D
524}
525
526; (or (and (not rC), rA), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000527define i8 @selectbits_i8_04(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000528 %A = xor i8 %rC, -1
529 %B = and i8 %A, %rA
530 %C = and i8 %rC, %rB
531 %D = or i8 %C, %B
532 ret i8 %D
533}
534
535; (or (and rC, rB), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000536define i8 @selectbits_i8_05(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000537 %C = and i8 %rC, %rB
538 %A = xor i8 %rC, -1
539 %B = and i8 %rA, %A
540 %D = or i8 %C, %B
541 ret i8 %D
542}
543
544; (or (and rB, rC), (and rA, (not rC)))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000545define i8 @selectbits_i8_06(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000546 %C = and i8 %rB, %rC
547 %A = xor i8 %rC, -1
548 %B = and i8 %rA, %A
549 %D = or i8 %C, %B
550 ret i8 %D
551}
552
553; (or (and rA, (not rC)), (and rB, rC))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000554define i8 @selectbits_i8_07(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000555 %A = xor i8 %rC, -1
556 %B = and i8 %rA, %A
557 %C = and i8 %rB, %rC
558 %D = or i8 %C, %B
559 ret i8 %D
560}
561
562; (or (and rA, (not rC)), (and rC, rB))
Scott Michelc9c8b2a2009-01-26 03:31:40 +0000563define i8 @selectbits_i8_08(i8 %rA, i8 %rB, i8 %rC) {
Scott Michel53dec472008-03-05 23:00:19 +0000564 %A = xor i8 %rC, -1
565 %B = and i8 %rA, %A
566 %C = and i8 %rC, %rB
567 %D = or i8 %C, %B
568 ret i8 %D
Scott Michel0a92af42007-12-19 20:50:49 +0000569}