OLD | NEW |
(Empty) | |
| 1 ; RUN: opt -expand-shufflevector %s -S | \ |
| 2 ; RUN: opt -backend-canonicalize -S | FileCheck %s |
| 3 |
| 4 ; Test that shufflevector is re-created after having been expanded to |
| 5 ; insertelement / extractelement: shufflevector isn't part of the stable |
| 6 ; PNaCl ABI but insertelement / extractelement are. Re-creating |
| 7 ; shufflevector allows the backend to generate more efficient code. |
| 8 ; |
| 9 ; TODO(jfb) Narrow and widen aren't tested since the underlying types |
| 10 ; are currently not supported by the PNaCl ABI. |
| 11 |
| 12 ; The datalayout is needed to fold global constants. |
| 13 target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64
:64:64-p:32:32:32-v128:32:32" |
| 14 |
| 15 define <4 x i32> @test_splat_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 16 ; CHECK-LABEL: test_splat_lo_4xi32 |
| 17 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> undef, <
4 x i32> zeroinitializer |
| 18 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 0,
i32 0, i32 0> |
| 19 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 20 ret <4 x i32> %res |
| 21 } |
| 22 |
| 23 define <4 x i32> @test_splat_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 24 ; CHECK-LABEL: test_splat_hi_4xi32 |
| 25 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %rhs, <4 x i32> undef, <
4 x i32> zeroinitializer |
| 26 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 4,
i32 4, i32 4> |
| 27 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 28 ret <4 x i32> %res |
| 29 } |
| 30 |
| 31 define <4 x i32> @test_id_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 32 ; CHECK-LABEL: test_id_lo_4xi32 |
| 33 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> undef, <
4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 34 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 1,
i32 2, i32 3> |
| 35 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 36 ret <4 x i32> %res |
| 37 } |
| 38 |
| 39 define <4 x i32> @test_id_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 40 ; CHECK-LABEL: test_id_hi_4xi32 |
| 41 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %rhs, <4 x i32> undef, <
4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 42 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 5,
i32 6, i32 7> |
| 43 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 44 ret <4 x i32> %res |
| 45 } |
| 46 |
| 47 define <4 x i32> @test_interleave_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 48 ; CHECK-LABEL: test_interleave_lo_4xi32 |
| 49 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4
x i32> <i32 0, i32 4, i32 1, i32 5> |
| 50 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 4,
i32 1, i32 5> |
| 51 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 52 ret <4 x i32> %res |
| 53 } |
| 54 |
| 55 define <4 x i32> @test_interleave_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 56 ; CHECK-LABEL: test_interleave_hi_4xi32 |
| 57 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4
x i32> <i32 1, i32 5, i32 3, i32 7> |
| 58 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 1, i32 5,
i32 3, i32 7> |
| 59 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 60 ret <4 x i32> %res |
| 61 } |
| 62 |
| 63 define <4 x i32> @test_with_constant(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 64 ; CHECK-LABEL: test_with_constant |
| 65 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> <i32 0,
i32 -1, i32 undef, i32 undef>, <4 x i32> <i32 4, i32 0, i32 1, i32 5> |
| 66 %res = shufflevector <4 x i32> %lhs, <4 x i32> <i32 0, i32 -1, i32 undef, i32
undef>, <4 x i32> <i32 4, i32 0, i32 1, i32 5> |
| 67 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 68 ret <4 x i32> %res |
| 69 } |
OLD | NEW |