Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 ; This file tests casting / conversion operations that apply to vector types. | |
| 2 | |
| 3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s | |
| 4 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s | |
| 5 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | |
| 6 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | |
| 7 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | |
| 8 ; RUN: | FileCheck --check-prefix=DUMP %s | |
| 9 | |
| 10 ; bitcast operations | |
| 11 | |
| 12 define <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) { | |
| 13 entry: | |
| 14 %res = bitcast <16 x i8> %arg to <16 x i8> | |
| 15 ret <16 x i8> %res | |
| 16 | |
| 17 ; CHECK-LABEL: test_bitcast_v16i8_to_v16i8: | |
| 18 ; CHECK: .L{{.*}}entry: | |
| 19 ; CHECK-NEXT: ret | |
|
jvoung (off chromium)
2014/07/15 00:24:11
Are these the only cases where OPTM1 differs from
wala
2014/07/15 00:41:09
Yes, the test for bitcast is basically checking th
wala
2014/07/15 22:52:22
Done.
| |
| 20 } | |
| 21 | |
| 22 define <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) { | |
| 23 entry: | |
| 24 %res = bitcast <16 x i8> %arg to <8 x i16> | |
| 25 ret <8 x i16> %res | |
| 26 | |
| 27 ; CHECK-LABEL: test_bitcast_v16i8_to_v8i16: | |
| 28 ; CHECK: .L{{.*}}entry: | |
| 29 ; CHECK-NEXT: ret | |
| 30 } | |
| 31 | |
| 32 define <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) { | |
| 33 entry: | |
| 34 %res = bitcast <16 x i8> %arg to <4 x i32> | |
| 35 ret <4 x i32> %res | |
| 36 | |
| 37 ; CHECK-LABEL: test_bitcast_v16i8_to_v4i32: | |
| 38 ; CHECK: .L{{.*}}entry: | |
| 39 ; CHECK-NEXT: ret | |
| 40 } | |
| 41 | |
| 42 define <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) { | |
| 43 entry: | |
| 44 %res = bitcast <16 x i8> %arg to <4 x float> | |
| 45 ret <4 x float> %res | |
| 46 | |
| 47 ; CHECK-LABEL: test_bitcast_v16i8_to_v4f32: | |
| 48 ; CHECK: .L{{.*}}entry: | |
| 49 ; CHECK-NEXT: ret | |
| 50 } | |
| 51 | |
| 52 define <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) { | |
| 53 entry: | |
| 54 %res = bitcast <8 x i16> %arg to <16 x i8> | |
| 55 ret <16 x i8> %res | |
| 56 | |
| 57 ; CHECK-LABEL: test_bitcast_v8i16_to_v16i8: | |
| 58 ; CHECK: .L{{.*}}entry: | |
| 59 ; CHECK-NEXT: ret | |
| 60 } | |
| 61 | |
| 62 define <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) { | |
| 63 entry: | |
| 64 %res = bitcast <8 x i16> %arg to <8 x i16> | |
| 65 ret <8 x i16> %res | |
| 66 | |
| 67 ; CHECK-LABEL: test_bitcast_v8i16_to_v8i16: | |
| 68 ; CHECK: .L{{.*}}entry: | |
| 69 ; CHECK-NEXT: ret | |
| 70 } | |
| 71 | |
| 72 define <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) { | |
| 73 entry: | |
| 74 %res = bitcast <8 x i16> %arg to <4 x i32> | |
| 75 ret <4 x i32> %res | |
| 76 | |
| 77 ; CHECK-LABEL: test_bitcast_v8i16_to_v4i32: | |
| 78 ; CHECK: .L{{.*}}entry: | |
| 79 ; CHECK-NEXT: ret | |
| 80 } | |
| 81 | |
| 82 define <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) { | |
| 83 entry: | |
| 84 %res = bitcast <8 x i16> %arg to <4 x float> | |
| 85 ret <4 x float> %res | |
| 86 | |
| 87 ; CHECK-LABEL: test_bitcast_v8i16_to_v4f32: | |
| 88 ; CHECK: .L{{.*}}entry: | |
| 89 ; CHECK-NEXT: ret | |
| 90 } | |
| 91 | |
| 92 define <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) { | |
| 93 entry: | |
| 94 %res = bitcast <4 x i32> %arg to <16 x i8> | |
| 95 ret <16 x i8> %res | |
| 96 | |
| 97 ; CHECK-LABEL: test_bitcast_v4i32_to_v16i8: | |
| 98 ; CHECK: .L{{.*}}entry: | |
| 99 ; CHECK-NEXT: ret | |
| 100 } | |
| 101 | |
| 102 define <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) { | |
| 103 entry: | |
| 104 %res = bitcast <4 x i32> %arg to <8 x i16> | |
| 105 ret <8 x i16> %res | |
| 106 | |
| 107 ; CHECK-LABEL: test_bitcast_v4i32_to_v8i16: | |
| 108 ; CHECK: .L{{.*}}entry: | |
| 109 ; CHECK-NEXT: ret | |
| 110 } | |
| 111 | |
| 112 define <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) { | |
| 113 entry: | |
| 114 %res = bitcast <4 x i32> %arg to <4 x i32> | |
| 115 ret <4 x i32> %res | |
| 116 | |
| 117 ; CHECK-LABEL: test_bitcast_v4i32_to_v4i32: | |
| 118 ; CHECK: .L{{.*}}entry: | |
| 119 ; CHECK-NEXT: ret | |
| 120 } | |
| 121 | |
| 122 define <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) { | |
| 123 entry: | |
| 124 %res = bitcast <4 x i32> %arg to <4 x float> | |
| 125 ret <4 x float> %res | |
| 126 | |
| 127 ; CHECK-LABEL: test_bitcast_v4i32_to_v4f32: | |
| 128 ; CHECK: .L{{.*}}entry: | |
| 129 ; CHECK-NEXT: ret | |
| 130 } | |
| 131 | |
| 132 define <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) { | |
| 133 entry: | |
| 134 %res = bitcast <4 x float> %arg to <16 x i8> | |
| 135 ret <16 x i8> %res | |
| 136 | |
| 137 ; CHECK-LABEL: test_bitcast_v4f32_to_v16i8: | |
| 138 ; CHECK: .L{{.*}}entry: | |
| 139 ; CHECK-NEXT: ret | |
| 140 } | |
| 141 | |
| 142 define <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) { | |
| 143 entry: | |
| 144 %res = bitcast <4 x float> %arg to <8 x i16> | |
| 145 ret <8 x i16> %res | |
| 146 | |
| 147 ; CHECK-LABEL: test_bitcast_v4f32_to_v8i16: | |
| 148 ; CHECK: .L{{.*}}entry: | |
| 149 ; CHECK-NEXT: ret | |
| 150 } | |
| 151 | |
| 152 define <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) { | |
| 153 entry: | |
| 154 %res = bitcast <4 x float> %arg to <4 x i32> | |
| 155 ret <4 x i32> %res | |
| 156 | |
| 157 ; CHECK-LABEL: test_bitcast_v4f32_to_v4i32: | |
| 158 ; CHECK: .L{{.*}}entry: | |
| 159 ; CHECK-NEXT: ret | |
| 160 } | |
| 161 | |
| 162 define <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) { | |
| 163 entry: | |
| 164 %res = bitcast <4 x float> %arg to <4 x float> | |
| 165 ret <4 x float> %res | |
| 166 | |
| 167 ; CHECK-LABEL: test_bitcast_v4f32_to_v4f32: | |
| 168 ; CHECK: .L{{.*}}entry: | |
| 169 ; CHECK-NEXT: ret | |
| 170 } | |
| 171 | |
| 172 define i8 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) { | |
| 173 entry: | |
| 174 %res = bitcast <8 x i1> %arg to i8 | |
| 175 ret i8 %res | |
| 176 | |
| 177 ; CHECK-LABEL: test_bitcast_v8i1_to_i8: | |
| 178 ; CHECK: call __bitcast_v8i1_to_i8 | |
| 179 | |
| 180 ; OPTM1-LABEL: test_bitcast_v8i1_to_i8: | |
| 181 ; OPTM1: call __bitcast_v8i1_to_i8 | |
| 182 } | |
| 183 | |
| 184 define i16 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) { | |
| 185 entry: | |
| 186 %res = bitcast <16 x i1> %arg to i16 | |
| 187 ret i16 %res | |
| 188 | |
| 189 ; CHECK-LABEL: test_bitcast_v16i1_to_i16: | |
| 190 ; CHECK: call __bitcast_v16i1_to_i16 | |
| 191 | |
| 192 ; OPTM1-LABEL: test_bitcast_v16i1_to_i16: | |
| 193 ; OPTM1: call __bitcast_v16i1_to_i16 | |
| 194 } | |
| 195 | |
| 196 define <8 x i1> @test_bitcast_i8_to_v8i1(i8 %arg) { | |
| 197 entry: | |
| 198 %res = bitcast i8 %arg to <8 x i1> | |
| 199 ret <8 x i1> %res | |
| 200 | |
| 201 ; CHECK-LABEL: test_bitcast_i8_to_v8i1: | |
| 202 ; CHECK: call __bitcast_i8_to_v8i1 | |
| 203 | |
| 204 ; OPTM1-LABEL: test_bitcast_i8_to_v8i1: | |
| 205 ; OPTM1: call __bitcast_i8_to_v8i1 | |
| 206 } | |
| 207 | |
| 208 define <16 x i1> @test_bitcast_i16_to_v16i1(i16 %arg) { | |
| 209 entry: | |
| 210 %res = bitcast i16 %arg to <16 x i1> | |
| 211 ret <16 x i1> %res | |
| 212 | |
| 213 ; CHECK-LABEL: test_bitcast_i16_to_v16i1: | |
| 214 ; CHECK: call __bitcast_i16_to_v16i1 | |
| 215 | |
| 216 ; OPTM1-LABEL: test_bitcast_i16_to_v16i1: | |
| 217 ; OPTM1: call __bitcast_i16_to_v16i1 | |
| 218 } | |
| 219 | |
| 220 ; sext operations | |
| 221 | |
| 222 define <16 x i8> @test_sext_v16i1_to_v16i8(<16 x i1> %arg) { | |
| 223 entry: | |
| 224 %res = sext <16 x i1> %arg to <16 x i8> | |
| 225 ret <16 x i8> %res | |
| 226 | |
| 227 ; CHECK-LABEL: test_sext_v16i1_to_v16i8: | |
| 228 ; CHECK: pxor | |
| 229 ; CHECK: pcmpeqb | |
| 230 ; CHECK: psubb | |
| 231 ; CHECK: pand | |
| 232 ; CHECK: pxor | |
| 233 ; CHECK: pcmpgtb | |
| 234 | |
| 235 ; OPTM1-LABEL: test_sext_v16i1_to_v16i8: | |
| 236 ; OPTM1: pxor | |
| 237 ; OPTM1: pcmpeqb | |
| 238 ; OPTM1: psubb | |
| 239 ; OPTM1: pand | |
| 240 ; OPTM1: pxor | |
| 241 ; OPTM1: pcmpgtb | |
| 242 } | |
| 243 | |
| 244 define <8 x i16> @test_sext_v8i1_to_v8i16(<8 x i1> %arg) { | |
| 245 entry: | |
| 246 %res = sext <8 x i1> %arg to <8 x i16> | |
| 247 ret <8 x i16> %res | |
| 248 | |
| 249 ; CHECK-LABEL: test_sext_v8i1_to_v8i16: | |
| 250 ; CHECK: psllw {{.*}}, 15 | |
| 251 ; CHECK: psraw {{.*}}, 15 | |
| 252 | |
| 253 ; OPTM1-LABEL: test_sext_v8i1_to_v8i16: | |
| 254 ; OPTM1: psllw {{.*}}, 15 | |
| 255 ; OPTM1: psraw {{.*}}, 15 | |
| 256 } | |
| 257 | |
| 258 define <4 x i32> @test_sext_v4i1_to_v4i32(<4 x i1> %arg) { | |
| 259 entry: | |
| 260 %res = sext <4 x i1> %arg to <4 x i32> | |
| 261 ret <4 x i32> %res | |
| 262 | |
| 263 ; CHECK-LABEL: test_sext_v4i1_to_v4i32: | |
| 264 ; CHECK: pslld {{.*}}, 31 | |
| 265 ; CHECK: psrad {{.*}}, 31 | |
| 266 | |
| 267 ; OPTM1-LABEL: test_sext_v4i1_to_v4i32: | |
| 268 ; OPTM1: pslld {{.*}}, 31 | |
| 269 ; OPTM1: psrad {{.*}}, 31 | |
| 270 } | |
| 271 | |
| 272 ; zext operations | |
| 273 | |
| 274 define <16 x i8> @test_zext_v16i1_to_v16i8(<16 x i1> %arg) { | |
| 275 entry: | |
| 276 %res = zext <16 x i1> %arg to <16 x i8> | |
| 277 ret <16 x i8> %res | |
| 278 | |
| 279 ; CHECK-LABEL: test_zext_v16i1_to_v16i8: | |
| 280 ; CHECK: pxor | |
| 281 ; CHECK: pcmpeqb | |
| 282 ; CHECK: psubb | |
| 283 ; CHECK: pand | |
| 284 | |
| 285 ; OPTM1-LABEL: test_zext_v16i1_to_v16i8: | |
| 286 ; OPTM1: pxor | |
| 287 ; OPTM1: pcmpeqb | |
| 288 ; OPTM1: psubb | |
| 289 ; OPTM1: pand | |
| 290 } | |
| 291 | |
| 292 define <8 x i16> @test_zext_v8i1_to_v8i16(<8 x i1> %arg) { | |
| 293 entry: | |
| 294 %res = zext <8 x i1> %arg to <8 x i16> | |
| 295 ret <8 x i16> %res | |
| 296 | |
| 297 ; CHECK-LABEL: test_zext_v8i1_to_v8i16: | |
| 298 ; CHECK: pxor | |
| 299 ; CHECK: pcmpeqw | |
| 300 ; CHECK: psubw | |
| 301 ; CHECK: pand | |
| 302 | |
| 303 ; OPTM1-LABEL: test_zext_v8i1_to_v8i16: | |
| 304 ; OPTM1: pxor | |
| 305 ; OPTM1: pcmpeqw | |
| 306 ; OPTM1: psubw | |
| 307 ; OPTM1: pand | |
| 308 } | |
| 309 | |
| 310 define <4 x i32> @test_zext_v4i1_to_v4i32(<4 x i1> %arg) { | |
| 311 entry: | |
| 312 %res = zext <4 x i1> %arg to <4 x i32> | |
| 313 ret <4 x i32> %res | |
| 314 | |
| 315 ; CHECK-LABEL: test_zext_v4i1_to_v4i32: | |
| 316 ; CHECK: pxor | |
| 317 ; CHECK: pcmpeqd | |
| 318 ; CHECK: psubd | |
| 319 ; CHECK: pand | |
| 320 | |
| 321 ; OPTM1-LABEL: test_zext_v4i1_to_v4i32: | |
| 322 ; OPTM1: pxor | |
| 323 ; OPTM1: pcmpeqd | |
| 324 ; OPTM1: psubd | |
| 325 ; OPTM1: pand | |
| 326 } | |
| 327 | |
| 328 ; trunc operations | |
| 329 | |
| 330 define <16 x i1> @test_trunc_v16i8_to_v16i1(<16 x i8> %arg) { | |
| 331 entry: | |
| 332 %res = trunc <16 x i8> %arg to <16 x i1> | |
| 333 ret <16 x i1> %res | |
| 334 | |
| 335 ; CHECK-LABEL: test_trunc_v16i8_to_v16i1: | |
| 336 ; CHECK: pxor | |
| 337 ; CHECK: pcmpeqb | |
| 338 ; CHECK: psubb | |
| 339 ; CHECK: pand | |
| 340 | |
| 341 ; OPTM1-LABEL: test_trunc_v16i8_to_v16i1: | |
| 342 ; OPTM1: pxor | |
| 343 ; OPTM1: pcmpeqb | |
| 344 ; OPTM1: psubb | |
| 345 ; OPTM1: pand | |
| 346 } | |
| 347 | |
| 348 define <8 x i1> @test_trunc_v8i16_to_v8i1(<8 x i16> %arg) { | |
| 349 entry: | |
| 350 %res = trunc <8 x i16> %arg to <8 x i1> | |
| 351 ret <8 x i1> %res | |
| 352 | |
| 353 ; CHECK-LABEL: test_trunc_v8i16_to_v8i1: | |
| 354 ; CHECK: pxor | |
| 355 ; CHECK: pcmpeqw | |
| 356 ; CHECK: psubw | |
| 357 ; CHECK: pand | |
| 358 | |
| 359 ; OPTM1-LABEL: test_trunc_v8i16_to_v8i1: | |
| 360 ; OPTM1: pxor | |
| 361 ; OPTM1: pcmpeqw | |
| 362 ; OPTM1: psubw | |
| 363 ; OPTM1: pand | |
| 364 } | |
| 365 | |
| 366 define <4 x i1> @test_trunc_v4i32_to_v4i1(<4 x i32> %arg) { | |
| 367 entry: | |
| 368 %res = trunc <4 x i32> %arg to <4 x i1> | |
| 369 ret <4 x i1> %res | |
| 370 | |
| 371 ; CHECK-LABEL: test_trunc_v4i32_to_v4i1: | |
| 372 ; CHECK: pxor | |
| 373 ; CHECK: pcmpeqd | |
| 374 ; CHECK: psubd | |
| 375 ; CHECK: pand | |
| 376 | |
| 377 ; OPTM1-LABEL: test_trunc_v4i32_to_v4i1: | |
| 378 ; OPTM1: pxor | |
| 379 ; OPTM1: pcmpeqd | |
| 380 ; OPTM1: psubd | |
| 381 ; OPTM1: pand | |
| 382 } | |
| 383 | |
| 384 ; fpto[us]i operations | |
| 385 | |
| 386 define <4 x i32> @test_fptosi_v4f32_to_v4i32(<4 x float> %arg) { | |
| 387 entry: | |
| 388 %res = fptosi <4 x float> %arg to <4 x i32> | |
| 389 ret <4 x i32> %res | |
| 390 | |
| 391 ; CHECK-LABEL: test_fptosi_v4f32_to_v4i32: | |
| 392 ; CHECK: cvtps2dq | |
| 393 | |
| 394 ; OPTM1-LABEL: test_fptosi_v4f32_to_v4i32: | |
| 395 ; OPTM1: cvtps2dq | |
| 396 } | |
| 397 | |
| 398 define <4 x i32> @test_fptoui_v4f32_to_v4i32(<4 x float> %arg) { | |
| 399 entry: | |
| 400 %res = fptoui <4 x float> %arg to <4 x i32> | |
| 401 ret <4 x i32> %res | |
| 402 | |
| 403 ; CHECK-LABEL: test_fptoui_v4f32_to_v4i32: | |
| 404 ; CHECK: call __fptoui_v4f32 | |
| 405 | |
| 406 ; OPTM1-LABEL: test_fptoui_v4f32_to_v4i32: | |
| 407 ; OPTM1: call __fptoui_v4f32 | |
| 408 } | |
| 409 | |
| 410 ; [su]itofp operations | |
| 411 | |
| 412 define <4 x float> @test_sitofp_v4i32_to_v4f32(<4 x i32> %arg) { | |
| 413 entry: | |
| 414 %res = sitofp <4 x i32> %arg to <4 x float> | |
| 415 ret <4 x float> %res | |
| 416 | |
| 417 ; CHECK-LABEL: test_sitofp_v4i32_to_v4f32: | |
| 418 ; CHECK: cvtdq2ps | |
| 419 | |
| 420 ; OPTM1-LABEL: test_sitofp_v4i32_to_v4f32: | |
| 421 ; OPTM1: cvtdq2ps | |
| 422 } | |
| 423 | |
| 424 define <4 x float> @test_uitofp_v4i32_to_v4f32(<4 x i32> %arg) { | |
| 425 entry: | |
| 426 %res = uitofp <4 x i32> %arg to <4 x float> | |
| 427 ret <4 x float> %res | |
| 428 | |
| 429 ; CHECK-LABEL: test_uitofp_v4i32_to_v4f32: | |
| 430 ; CHECK: call __uitofp_v4i32 | |
| 431 | |
| 432 ; OPTM1-LABEL: test_uitofp_v4i32_to_v4f32: | |
| 433 ; OPTM1: call __uitofp_v4i32 | |
| 434 } | |
| 435 | |
| 436 ; ERRORS-NOT: ICE translation error | |
| 437 ; DUMP-NOT: SZ | |
| OLD | NEW |