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

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: Add DCE, address dschuff's comments. 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
« no previous file with comments | « lib/Transforms/NaCl/ExpandShuffleVector.cpp ('k') | tools/opt/opt.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ; 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 }
OLDNEW
« no previous file with comments | « lib/Transforms/NaCl/ExpandShuffleVector.cpp ('k') | tools/opt/opt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698