1 ; RUN: llc < %s -march=cellspu > %t1.s 2 ; RUN: grep selb %t1.s | count 56 3 4 ; CellSPU legalization is over-sensitive to Legalize's traversal order. 5 ; XFAIL: * 6 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" 8 target triple = "spu" 9 10 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 11 ; v2i64 12 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 13 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 20 ret <2 x i64> %D 21 } 22 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 29 ret <2 x i64> %D 30 } 31 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 38 ret <2 x i64> %D 39 } 40 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 47 ret <2 x i64> %D 48 } 49 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 56 ret <2 x i64> %D 57 } 58 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 65 ret <2 x i64> %D 66 } 67 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 74 ret <2 x i64> %D 75 } 76 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 83 ret <2 x i64> %D 84 } 85 86 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 87 ; v4i32 88 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 89 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 96 ret <4 x i32> %D 97 } 98 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 105 ret <4 x i32> %D 106 } 107 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 114 ret <4 x i32> %D 115 } 116 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 123 ret <4 x i32> %D 124 } 125 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 132 ret <4 x i32> %D 133 } 134 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 141 ret <4 x i32> %D 142 } 143 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 150 ret <4 x i32> %D 151 } 152 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 159 ret <4 x i32> %D 160 } 161 162 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 163 ; v8i16 164 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 165 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 173 ret <8 x i16> %D 174 } 175 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 183 ret <8 x i16> %D 184 } 185 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 193 ret <8 x i16> %D 194 } 195 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 203 ret <8 x i16> %D 204 } 205 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 213 ret <8 x i16> %D 214 } 215 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 223 ret <8 x i16> %D 224 } 225 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 233 ret <8 x i16> %D 234 } 235 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 243 ret <8 x i16> %D 244 } 245 246 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 247 ; v16i8 248 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 249 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 259 ret <16 x i8> %D 260 } 261 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 271 ret <16 x i8> %D 272 } 273 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 283 ret <16 x i8> %D 284 } 285 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 295 ret <16 x i8> %D 296 } 297 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 307 ret <16 x i8> %D 308 } 309 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 319 ret <16 x i8> %D 320 } 321 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 331 ret <16 x i8> %D 332 } 333 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 343 ret <16 x i8> %D 344 } 345 346 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 347 ; i32 348 ;-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 349 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 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)) 360 define i32 @selectbits_i32_02(i32 %rA, i32 %rB, i32 %rC) { 361 %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)) 369 define i32 @selectbits_i32_03(i32 %rA, i32 %rB, i32 %rC) { 370 %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)) 378 define i32 @selectbits_i32_04(i32 %rA, i32 %rB, i32 %rC) { 379 %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))) 387 define i32 @selectbits_i32_05(i32 %rA, i32 %rB, i32 %rC) { 388 %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))) 396 define i32 @selectbits_i32_06(i32 %rA, i32 %rB, i32 %rC) { 397 %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)) 405 define i32 @selectbits_i32_07(i32 %rA, i32 %rB, i32 %rC) { 406 %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)) 414 define i32 @selectbits_i32_08(i32 %rA, i32 %rB, i32 %rC) { 415 %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)) 427 define i16 @selectbits_i16_01(i16 %rA, i16 %rB, i16 %rC) { 428 %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)) 436 define i16 @selectbits_i16_02(i16 %rA, i16 %rB, i16 %rC) { 437 %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)) 445 define i16 @selectbits_i16_03(i16 %rA, i16 %rB, i16 %rC) { 446 %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)) 454 define i16 @selectbits_i16_04(i16 %rA, i16 %rB, i16 %rC) { 455 %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))) 463 define i16 @selectbits_i16_05(i16 %rA, i16 %rB, i16 %rC) { 464 %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))) 472 define i16 @selectbits_i16_06(i16 %rA, i16 %rB, i16 %rC) { 473 %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)) 481 define i16 @selectbits_i16_07(i16 %rA, i16 %rB, i16 %rC) { 482 %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)) 490 define i16 @selectbits_i16_08(i16 %rA, i16 %rB, i16 %rC) { 491 %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)) 503 define i8 @selectbits_i8_01(i8 %rA, i8 %rB, i8 %rC) { 504 %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)) 512 define i8 @selectbits_i8_02(i8 %rA, i8 %rB, i8 %rC) { 513 %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)) 521 define i8 @selectbits_i8_03(i8 %rA, i8 %rB, i8 %rC) { 522 %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)) 530 define i8 @selectbits_i8_04(i8 %rA, i8 %rB, i8 %rC) { 531 %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))) 539 define i8 @selectbits_i8_05(i8 %rA, i8 %rB, i8 %rC) { 540 %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))) 548 define i8 @selectbits_i8_06(i8 %rA, i8 %rB, i8 %rC) { 549 %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)) 557 define i8 @selectbits_i8_07(i8 %rA, i8 %rB, i8 %rC) { 558 %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)) 566 define i8 @selectbits_i8_08(i8 %rA, i8 %rB, i8 %rC) { 567 %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 572 } 573