| OLD | NEW |
| (Empty) | |
| 1 ; RUN: opt -expand-shufflevector %s -S | \ |
| 2 ; RUN: opt -combine-vector-instructions -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 define <4 x i32> @test_splat_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 13 ; CHECK-LABEL: test_splat_lo_4xi32 |
| 14 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> undef, <
4 x i32> zeroinitializer |
| 15 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 0,
i32 0, i32 0> |
| 16 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 17 ret <4 x i32> %res |
| 18 } |
| 19 |
| 20 define <4 x i32> @test_splat_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 21 ; CHECK-LABEL: test_splat_hi_4xi32 |
| 22 ; CHECK-NEXT: %[[R:[0-9]+]] = shufflevector <4 x i32> %rhs, <4 x i32> undef, <
4 x i32> zeroinitializer |
| 23 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 4,
i32 4, i32 4> |
| 24 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 25 ret <4 x i32> %res |
| 26 } |
| 27 |
| 28 define <4 x i32> @test_id_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 29 ; CHECK-LABEL: test_id_lo_4xi32 |
| 30 ; 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> |
| 31 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 1,
i32 2, i32 3> |
| 32 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 33 ret <4 x i32> %res |
| 34 } |
| 35 |
| 36 define <4 x i32> @test_id_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 37 ; CHECK-LABEL: test_id_hi_4xi32 |
| 38 ; 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> |
| 39 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 5,
i32 6, i32 7> |
| 40 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 41 ret <4 x i32> %res |
| 42 } |
| 43 |
| 44 define <4 x i32> @test_interleave_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 45 ; CHECK-LABEL: test_interleave_lo_4xi32 |
| 46 ; 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> |
| 47 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 4,
i32 1, i32 5> |
| 48 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 49 ret <4 x i32> %res |
| 50 } |
| 51 |
| 52 define <4 x i32> @test_interleave_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) { |
| 53 ; CHECK-LABEL: test_interleave_hi_4xi32 |
| 54 ; 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> |
| 55 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 1, i32 5,
i32 3, i32 7> |
| 56 ; CHECK-NEXT: ret <4 x i32> %[[R]] |
| 57 ret <4 x i32> %res |
| 58 } |
| OLD | NEW |