Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: test/Transforms/NaCl/combine-shuffle-vector.ll

Issue 282553003: PNaCl translator: combine insertelement / extractelement patterns generated by the toolchain into s… (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Fix typo on canonicalization range. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 ; Note that CHECK-NEXT isn't used because the pass leaves dead code behind.
10 ;
11 ; TODO(jfb) Narrow and widen aren't tested since the underlying types
12 ; are currently not supported by the PNaCl ABI.
13
14 define <4 x i32> @test_splat_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
15 ; CHECK-LABEL: test_splat_lo_4xi32
16 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> undef, <4 x i 32> zeroinitializer
17 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
18 ; CHECK: ret <4 x i32> %[[R]]
19 ret <4 x i32> %res
20 }
21
22 define <4 x i32> @test_splat_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
23 ; CHECK-LABEL: test_splat_hi_4xi32
24 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %rhs, <4 x i32> undef, <4 x i 32> zeroinitializer
25 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 4, i32 4, i32 4>
26 ; CHECK: ret <4 x i32> %[[R]]
27 ret <4 x i32> %res
28 }
29
30 define <4 x i32> @test_id_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
31 ; CHECK-LABEL: test_id_lo_4xi32
32 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> undef, <4 x i 32> <i32 0, i32 1, i32 2, i32 3>
33 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
34 ; CHECK: ret <4 x i32> %[[R]]
35 ret <4 x i32> %res
36 }
37
38 define <4 x i32> @test_id_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
39 ; CHECK-LABEL: test_id_hi_4xi32
40 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %rhs, <4 x i32> undef, <4 x i 32> <i32 0, i32 1, i32 2, i32 3>
41 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
42 ; CHECK: ret <4 x i32> %[[R]]
43 ret <4 x i32> %res
44 }
45
46 define <4 x i32> @test_interleave_lo_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
47 ; CHECK-LABEL: test_interleave_lo_4xi32
48 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i3 2> <i32 0, i32 4, i32 1, i32 5>
49 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
50 ; CHECK: ret <4 x i32> %[[R]]
51 ret <4 x i32> %res
52 }
53
54 define <4 x i32> @test_interleave_hi_4xi32(<4 x i32> %lhs, <4 x i32> %rhs) {
55 ; CHECK-LABEL: test_interleave_hi_4xi32
56 ; CHECK: %[[R:[0-9]+]] = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i3 2> <i32 1, i32 5, i32 3, i32 7>
57 %res = shufflevector <4 x i32> %lhs, <4 x i32> %rhs, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
58 ; CHECK: ret <4 x i32> %[[R]]
59 ret <4 x i32> %res
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698