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

Side by Side Diff: test/Transforms/NaCl/globalize-constant-vectors.ll

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 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
1 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck %s 1 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck %s
2 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xi1 %s 2 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xi1 %s
3 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C8xi1 %s 3 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C8xi1 %s
4 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C16xi1 %s 4 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C16xi1 %s
5 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C16xi8 %s 5 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C16xi8 %s
6 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C8xi16 %s 6 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C8xi16 %s
7 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xi32 %s 7 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xi32 %s
8 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xfloat %s 8 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=C4xfloat %s
9 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=Cbranch % s 9 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=Cbranch % s
10 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=Cduplicat e %s 10 ; RUN: opt -globalize-constant-vectors %s -S | FileCheck -check-prefix=Cduplicat e %s
(...skipping 17 matching lines...) Expand all
28 28
29 ; 4xi1 vectors should get globalized. 29 ; 4xi1 vectors should get globalized.
30 define void @test4xi1(<4 x i1> %in) { 30 define void @test4xi1(<4 x i1> %in) {
31 %ft0 = and <4 x i1> %in, <i1 false, i1 true, i1 false, i1 true> 31 %ft0 = and <4 x i1> %in, <i1 false, i1 true, i1 false, i1 true>
32 %ft1 = and <4 x i1> <i1 true, i1 false, i1 true, i1 false>, %in 32 %ft1 = and <4 x i1> <i1 true, i1 false, i1 true, i1 false>, %in
33 ret void 33 ret void
34 } 34 }
35 ; C4xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i1> <i1 false, i1 true, i1 false, i1 true>, align 4 35 ; C4xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i1> <i1 false, i1 true, i1 false, i1 true>, align 4
36 ; C4xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i1> <i1 true, i1 false, i1 true, i1 false>, align 4 36 ; C4xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i1> <i1 true, i1 false, i1 true, i1 false>, align 4
37 ; C4xi1: define void @test4xi1(<4 x i1> %in) { 37 ; C4xi1: define void @test4xi1(<4 x i1> %in) {
38 ; C4xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i1>* @[[C1]], align 4 38 ; C4xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i1>, <4 x i1>* @[[C1]], align 4
39 ; C4xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i1>* @[[C2]], align 4 39 ; C4xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i1>, <4 x i1>* @[[C2]], align 4
40 ; C4xi1-NEXT: %ft0 = and <4 x i1> %in, %[[M1]] 40 ; C4xi1-NEXT: %ft0 = and <4 x i1> %in, %[[M1]]
41 ; C4xi1-NEXT: %ft1 = and <4 x i1> %[[M2]], %in 41 ; C4xi1-NEXT: %ft1 = and <4 x i1> %[[M2]], %in
42 ; C4xi1-NEXT: ret void 42 ; C4xi1-NEXT: ret void
43 43
44 ; 8xi1 vectors should get globalized. 44 ; 8xi1 vectors should get globalized.
45 define void @test8xi1(<8 x i1> %in) { 45 define void @test8xi1(<8 x i1> %in) {
46 %ft0 = and <8 x i1> %in, <i1 false, i1 true, i1 false, i1 true, i1 false, i1 t rue, i1 false, i1 true> 46 %ft0 = and <8 x i1> %in, <i1 false, i1 true, i1 false, i1 true, i1 false, i1 t rue, i1 false, i1 true>
47 %ft1 = and <8 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, %in 47 %ft1 = and <8 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, %in
48 ret void 48 ret void
49 } 49 }
50 ; C8xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i1> <i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>, align 8 50 ; C8xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i1> <i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>, align 8
51 ; C8xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, align 8 51 ; C8xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, align 8
52 ; C8xi1: define void @test8xi1(<8 x i1> %in) { 52 ; C8xi1: define void @test8xi1(<8 x i1> %in) {
53 ; C8xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i1>* @[[C1]], align 8 53 ; C8xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i1>, <8 x i1>* @[[C1]], align 8
54 ; C8xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <8 x i1>* @[[C2]], align 8 54 ; C8xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <8 x i1>, <8 x i1>* @[[C2]], align 8
55 ; C8xi1-NEXT: %ft0 = and <8 x i1> %in, %[[M1]] 55 ; C8xi1-NEXT: %ft0 = and <8 x i1> %in, %[[M1]]
56 ; C8xi1-NEXT: %ft1 = and <8 x i1> %[[M2]], %in 56 ; C8xi1-NEXT: %ft1 = and <8 x i1> %[[M2]], %in
57 ; C8xi1-NEXT: ret void 57 ; C8xi1-NEXT: ret void
58 58
59 ; 16xi1 vectors should get globalized. 59 ; 16xi1 vectors should get globalized.
60 define void @test16xi1(<16 x i1> %in) { 60 define void @test16xi1(<16 x i1> %in) {
61 %ft0 = and <16 x i1> %in, <i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true , i1 false, i1 true> 61 %ft0 = and <16 x i1> %in, <i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true , i1 false, i1 true>
62 %ft1 = and <16 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, %in 62 %ft1 = and <16 x i1> <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, %in
63 ret void 63 ret void
64 } 64 }
65 ; C16xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i1> <i1 fals e, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i 1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>, align 16 65 ; C16xi1: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i1> <i1 fals e, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i 1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>, align 16
66 ; C16xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i1> <i1 true , i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, align 16 66 ; C16xi1: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i1> <i1 true , i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>, align 16
67 ; C16xi1: define void @test16xi1(<16 x i1> %in) { 67 ; C16xi1: define void @test16xi1(<16 x i1> %in) {
68 ; C16xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <16 x i1>* @[[C1]], align 16 68 ; C16xi1-NEXT: %[[M1:[_a-z0-9]+]] = load <16 x i1>, <16 x i1>* @[[C1]], align 16
69 ; C16xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <16 x i1>* @[[C2]], align 16 69 ; C16xi1-NEXT: %[[M2:[_a-z0-9]+]] = load <16 x i1>, <16 x i1>* @[[C2]], align 16
70 ; C16xi1-NEXT: %ft0 = and <16 x i1> %in, %[[M1]] 70 ; C16xi1-NEXT: %ft0 = and <16 x i1> %in, %[[M1]]
71 ; C16xi1-NEXT: %ft1 = and <16 x i1> %[[M2]], %in 71 ; C16xi1-NEXT: %ft1 = and <16 x i1> %[[M2]], %in
72 ; C16xi1-NEXT: ret void 72 ; C16xi1-NEXT: ret void
73 73
74 ; 16xi8 vectors should get globalized. 74 ; 16xi8 vectors should get globalized.
75 define void @test16xi8(<16 x i8> %in) { 75 define void @test16xi8(<16 x i8> %in) {
76 %nonsquares = add <16 x i8> %in, <i8 2, i8 3, i8 5, i8 6, i8 7, i8 8, i8 10, i 8 11, i8 12, i8 13, i8 14, i8 15, i8 17, i8 18, i8 19, i8 20> 76 %nonsquares = add <16 x i8> %in, <i8 2, i8 3, i8 5, i8 6, i8 7, i8 8, i8 10, i 8 11, i8 12, i8 13, i8 14, i8 15, i8 17, i8 18, i8 19, i8 20>
77 %sort = add <16 x i8> <i8 0, i8 1, i8 3, i8 5, i8 9, i8 11, i8 14, i8 17, i8 2 5, i8 27, i8 30, i8 33, i8 38, i8 41, i8 45, i8 49>, %in 77 %sort = add <16 x i8> <i8 0, i8 1, i8 3, i8 5, i8 9, i8 11, i8 14, i8 17, i8 2 5, i8 27, i8 30, i8 33, i8 38, i8 41, i8 45, i8 49>, %in
78 ret void 78 ret void
79 } 79 }
80 ; C16xi8: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i8> <i8 2, i 8 3, i8 5, i8 6, i8 7, i8 8, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 17, i8 18, i8 19, i8 20>, align 4 80 ; C16xi8: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i8> <i8 2, i 8 3, i8 5, i8 6, i8 7, i8 8, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 17, i8 18, i8 19, i8 20>, align 4
81 ; C16xi8: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i8> <i8 0, i 8 1, i8 3, i8 5, i8 9, i8 11, i8 14, i8 17, i8 25, i8 27, i8 30, i8 33, i8 38, i 8 41, i8 45, i8 49>, align 4 81 ; C16xi8: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <16 x i8> <i8 0, i 8 1, i8 3, i8 5, i8 9, i8 11, i8 14, i8 17, i8 25, i8 27, i8 30, i8 33, i8 38, i 8 41, i8 45, i8 49>, align 4
82 ; C16xi8: define void @test16xi8(<16 x i8> %in) { 82 ; C16xi8: define void @test16xi8(<16 x i8> %in) {
83 ; C16xi8-NEXT: %[[M1:[_a-z0-9]+]] = load <16 x i8>* @[[C1]], align 4 83 ; C16xi8-NEXT: %[[M1:[_a-z0-9]+]] = load <16 x i8>, <16 x i8>* @[[C1]], align 4
84 ; C16xi8-NEXT: %[[M2:[_a-z0-9]+]] = load <16 x i8>* @[[C2]], align 4 84 ; C16xi8-NEXT: %[[M2:[_a-z0-9]+]] = load <16 x i8>, <16 x i8>* @[[C2]], align 4
85 ; C16xi8-NEXT: %nonsquares = add <16 x i8> %in, %[[M1]] 85 ; C16xi8-NEXT: %nonsquares = add <16 x i8> %in, %[[M1]]
86 ; C16xi8-NEXT: %sort = add <16 x i8> %[[M2]], %in 86 ; C16xi8-NEXT: %sort = add <16 x i8> %[[M2]], %in
87 ; C16xi8-NEXT: ret void 87 ; C16xi8-NEXT: ret void
88 88
89 ; 8xi16 vectors should get globalized. 89 ; 8xi16 vectors should get globalized.
90 define void @test8xi16(<8 x i16> %in) { 90 define void @test8xi16(<8 x i16> %in) {
91 %fib = add <8 x i16> %in, <i16 0, i16 1, i16 1, i16 2, i16 3, i16 5, i16 8, i1 6 13> 91 %fib = add <8 x i16> %in, <i16 0, i16 1, i16 1, i16 2, i16 3, i16 5, i16 8, i1 6 13>
92 %answer = add <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 4 2, i16 42>, %in 92 %answer = add <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 4 2, i16 42>, %in
93 ret void 93 ret void
94 } 94 }
95 ; C8xi16: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i16> <i16 0, i16 1, i16 1, i16 2, i16 3, i16 5, i16 8, i16 13>, align 4 95 ; C8xi16: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i16> <i16 0, i16 1, i16 1, i16 2, i16 3, i16 5, i16 8, i16 13>, align 4
96 ; C8xi16: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42>, align 4 96 ; C8xi16: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42>, align 4
97 ; C8xi16: define void @test8xi16(<8 x i16> %in) { 97 ; C8xi16: define void @test8xi16(<8 x i16> %in) {
98 ; C8xi16-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i16>* @[[C1]], align 4 98 ; C8xi16-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i16>, <8 x i16>* @[[C1]], align 4
99 ; C8xi16-NEXT: %[[M2:[_a-z0-9]+]] = load <8 x i16>* @[[C2]], align 4 99 ; C8xi16-NEXT: %[[M2:[_a-z0-9]+]] = load <8 x i16>, <8 x i16>* @[[C2]], align 4
100 ; C8xi16-NEXT: %fib = add <8 x i16> %in, %[[M1]] 100 ; C8xi16-NEXT: %fib = add <8 x i16> %in, %[[M1]]
101 ; C8xi16-NEXT: %answer = add <8 x i16> %[[M2]], %in 101 ; C8xi16-NEXT: %answer = add <8 x i16> %[[M2]], %in
102 ; C8xi16-NEXT: ret void 102 ; C8xi16-NEXT: ret void
103 103
104 ; 4xi32 vectors should get globalized. 104 ; 4xi32 vectors should get globalized.
105 define void @test4xi32(<4 x i32> %in) { 105 define void @test4xi32(<4 x i32> %in) {
106 %tetrahedral = add <4 x i32> %in, <i32 1, i32 4, i32 10, i32 20> 106 %tetrahedral = add <4 x i32> %in, <i32 1, i32 4, i32 10, i32 20>
107 %serauqs = add <4 x i32> <i32 1, i32 4, i32 9, i32 61>, %in 107 %serauqs = add <4 x i32> <i32 1, i32 4, i32 9, i32 61>, %in
108 ret void 108 ret void
109 } 109 }
110 ; C4xi32: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 4, i32 10, i32 20>, align 4 110 ; C4xi32: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 4, i32 10, i32 20>, align 4
111 ; C4xi32: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 4, i32 9, i32 61>, align 4 111 ; C4xi32: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 4, i32 9, i32 61>, align 4
112 ; C4xi32: define void @test4xi32(<4 x i32> %in) { 112 ; C4xi32: define void @test4xi32(<4 x i32> %in) {
113 ; C4xi32-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>* @[[C1]], align 4 113 ; C4xi32-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C1]], align 4
114 ; C4xi32-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i32>* @[[C2]], align 4 114 ; C4xi32-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C2]], align 4
115 ; C4xi32-NEXT: %tetrahedral = add <4 x i32> %in, %[[M1]] 115 ; C4xi32-NEXT: %tetrahedral = add <4 x i32> %in, %[[M1]]
116 ; C4xi32-NEXT: %serauqs = add <4 x i32> %[[M2]], %in 116 ; C4xi32-NEXT: %serauqs = add <4 x i32> %[[M2]], %in
117 ; C4xi32-NEXT: ret void 117 ; C4xi32-NEXT: ret void
118 118
119 ; 4xfloat vectors should get globalized. 119 ; 4xfloat vectors should get globalized.
120 define void @test4xfloat(<4 x float> %in) { 120 define void @test4xfloat(<4 x float> %in) {
121 %polyhex = fadd <4 x float> %in, <float 1., float 1., float 3., float 7.> 121 %polyhex = fadd <4 x float> %in, <float 1., float 1., float 3., float 7.>
122 %poset = fadd <4 x float> <float 1., float 1., float 3., float 19.>, %in 122 %poset = fadd <4 x float> <float 1., float 1., float 3., float 19.>, %in
123 ret void 123 ret void
124 } 124 }
125 ; C4xfloat: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x float> <flo at 1.000000e+00, float 1.000000e+00, float 3.000000e+00, float 7.000000e+00>, al ign 4 125 ; C4xfloat: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x float> <flo at 1.000000e+00, float 1.000000e+00, float 3.000000e+00, float 7.000000e+00>, al ign 4
126 ; C4xfloat: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x float> <flo at 1.000000e+00, float 1.000000e+00, float 3.000000e+00, float 1.900000e+01>, al ign 4 126 ; C4xfloat: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x float> <flo at 1.000000e+00, float 1.000000e+00, float 3.000000e+00, float 1.900000e+01>, al ign 4
127 ; C4xfloat: define void @test4xfloat(<4 x float> %in) { 127 ; C4xfloat: define void @test4xfloat(<4 x float> %in) {
128 ; C4xfloat-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x float>* @[[C1]], align 4 128 ; C4xfloat-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x float>, <4 x float>* @[[C1]], al ign 4
129 ; C4xfloat-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x float>* @[[C2]], align 4 129 ; C4xfloat-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x float>, <4 x float>* @[[C2]], al ign 4
130 ; C4xfloat-NEXT: %polyhex = fadd <4 x float> %in, %[[M1]] 130 ; C4xfloat-NEXT: %polyhex = fadd <4 x float> %in, %[[M1]]
131 ; C4xfloat-NEXT: %poset = fadd <4 x float> %[[M2]], %in 131 ; C4xfloat-NEXT: %poset = fadd <4 x float> %[[M2]], %in
132 ; C4xfloat-NEXT: ret void 132 ; C4xfloat-NEXT: ret void
133 133
134 ; Globalized constant loads have to dominate their use. 134 ; Globalized constant loads have to dominate their use.
135 define void @testbranch(i1 %cond, <4 x i32> %in) { 135 define void @testbranch(i1 %cond, <4 x i32> %in) {
136 br i1 %cond, label %lhs, label %rhs 136 br i1 %cond, label %lhs, label %rhs
137 lhs: 137 lhs:
138 %from_lhs = add <4 x i32> %in, <i32 1, i32 1, i32 2, i32 2> 138 %from_lhs = add <4 x i32> %in, <i32 1, i32 1, i32 2, i32 2>
139 br label %done 139 br label %done
140 rhs: 140 rhs:
141 %from_rhs = add <4 x i32> <i32 2, i32 2, i32 1, i32 1>, %in 141 %from_rhs = add <4 x i32> <i32 2, i32 2, i32 1, i32 1>, %in
142 br label %done 142 br label %done
143 done: 143 done:
144 %merged = phi <4 x i32> [ %from_lhs, %lhs ], [ %from_rhs, %rhs ] 144 %merged = phi <4 x i32> [ %from_lhs, %lhs ], [ %from_rhs, %rhs ]
145 ret void 145 ret void
146 } 146 }
147 ; Cbranch: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 1, i32 2, i32 2>, align 4 147 ; Cbranch: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 1, i32 2, i32 2>, align 4
148 ; Cbranch: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 2, i32 2, i32 1, i32 1>, align 4 148 ; Cbranch: @[[C2:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 2, i32 2, i32 1, i32 1>, align 4
149 ; Cbranch: define void @testbranch(i1 %cond, <4 x i32> %in) { 149 ; Cbranch: define void @testbranch(i1 %cond, <4 x i32> %in) {
150 ; Cbranch-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>* @[[C1]], align 4 150 ; Cbranch-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C1]], align 4
151 ; Cbranch-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i32>* @[[C2]], align 4 151 ; Cbranch-NEXT: %[[M2:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C2]], align 4
152 ; Cbranch-NEXT: br i1 %cond, label %lhs, label %rhs 152 ; Cbranch-NEXT: br i1 %cond, label %lhs, label %rhs
153 ; Cbranch: lhs: 153 ; Cbranch: lhs:
154 ; Cbranch-NEXT: %from_lhs = add <4 x i32> %in, %[[M1]] 154 ; Cbranch-NEXT: %from_lhs = add <4 x i32> %in, %[[M1]]
155 ; Cbranch-NEXT: br label %done 155 ; Cbranch-NEXT: br label %done
156 ; Cbranch: rhs: 156 ; Cbranch: rhs:
157 ; Cbranch-NEXT: %from_rhs = add <4 x i32> %[[M2]], %in 157 ; Cbranch-NEXT: %from_rhs = add <4 x i32> %[[M2]], %in
158 ; Cbranch-NEXT: br label %done 158 ; Cbranch-NEXT: br label %done
159 ; Cbranch: done: 159 ; Cbranch: done:
160 ; Cbranch-NEXT: %merged = phi <4 x i32> [ %from_lhs, %lhs ], [ %from_rhs, %rhs ] 160 ; Cbranch-NEXT: %merged = phi <4 x i32> [ %from_lhs, %lhs ], [ %from_rhs, %rhs ]
161 ; Cbranch-NEXT: ret void 161 ; Cbranch-NEXT: ret void
162 162
163 ; Globalizing redundant constants between functions should materialize 163 ; Globalizing redundant constants between functions should materialize
164 ; them in each function, but there should only be a single global. 164 ; them in each function, but there should only be a single global.
165 define void @testduplicate1() { 165 define void @testduplicate1() {
166 %foo = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, undef 166 %foo = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, undef
167 ret void 167 ret void
168 } 168 }
169 define void @testduplicate2() { 169 define void @testduplicate2() {
170 %foo = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, undef 170 %foo = add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, undef
171 ret void 171 ret void
172 } 172 }
173 ; Cduplicate: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 1, i32 1, i32 1>, align 4 173 ; Cduplicate: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x i32> <i32 1, i32 1, i32 1, i32 1>, align 4
174 ; Cduplicate: define void @testduplicate1() { 174 ; Cduplicate: define void @testduplicate1() {
175 ; Cduplicate-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>* @[[C1]], align 4 175 ; Cduplicate-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C1]], alig n 4
176 ; Cduplicate-NEXT: %foo = add <4 x i32> %[[M1]], undef 176 ; Cduplicate-NEXT: %foo = add <4 x i32> %[[M1]], undef
177 ; Cduplicate-NEXT: ret void 177 ; Cduplicate-NEXT: ret void
178 ; Cduplicate: define void @testduplicate2() { 178 ; Cduplicate: define void @testduplicate2() {
179 ; Cduplicate-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>* @[[C1]], align 4 179 ; Cduplicate-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x i32>, <4 x i32>* @[[C1]], alig n 4
180 ; Cduplicate-NEXT: %foo = add <4 x i32> %[[M1]], undef 180 ; Cduplicate-NEXT: %foo = add <4 x i32> %[[M1]], undef
181 ; Cduplicate-NEXT: ret void 181 ; Cduplicate-NEXT: ret void
182 182
183 ; zeroinitializer vectors should get globalized. 183 ; zeroinitializer vectors should get globalized.
184 define void @testzeroinitializer(<4 x float> %in) { 184 define void @testzeroinitializer(<4 x float> %in) {
185 %id = fadd <4 x float> %in, <float 0.0, float 0.0, float 0.0, float 0.0> 185 %id = fadd <4 x float> %in, <float 0.0, float 0.0, float 0.0, float 0.0>
186 ret void 186 ret void
187 } 187 }
188 ; Czeroinitializer: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x flo at> zeroinitializer, align 4 188 ; Czeroinitializer: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <4 x flo at> zeroinitializer, align 4
189 ; Czeroinitializer: define void @testzeroinitializer(<4 x float> %in) { 189 ; Czeroinitializer: define void @testzeroinitializer(<4 x float> %in) {
190 ; Czeroinitializer-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x float>* @[[C1]], align 4 190 ; Czeroinitializer-NEXT: %[[M1:[_a-z0-9]+]] = load <4 x float>, <4 x float>* @[[ C1]], align 4
191 ; Czeroinitializer-NEXT: %id = fadd <4 x float> %in, %[[M1]] 191 ; Czeroinitializer-NEXT: %id = fadd <4 x float> %in, %[[M1]]
192 ; Czeroinitializer-NEXT: ret void 192 ; Czeroinitializer-NEXT: ret void
193 193
194 ; Nested constant exprs are handled by running -expand-constant-expr first. 194 ; Nested constant exprs are handled by running -expand-constant-expr first.
195 define i64 @test_nested_const(i64 %x) { 195 define i64 @test_nested_const(i64 %x) {
196 %foo = add i64 bitcast (<8 x i8><i8 10, i8 20, i8 30, i8 40, i8 50, i8 60, i8 70, i8 80> to i64), %x 196 %foo = add i64 bitcast (<8 x i8><i8 10, i8 20, i8 30, i8 40, i8 50, i8 60, i8 70, i8 80> to i64), %x
197 ret i64 %foo 197 ret i64 %foo
198 } 198 }
199 ; Cnestedconst: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i8> <i8 10, i8 20, i8 30, i8 40, i8 50, i8 60, i8 70, i8 80>, align 8 199 ; Cnestedconst: @[[C1:[_a-z0-9]+]] = internal unnamed_addr constant <8 x i8> <i8 10, i8 20, i8 30, i8 40, i8 50, i8 60, i8 70, i8 80>, align 8
200 ; Cnestedconst: define i64 @test_nested_const(i64 %x) { 200 ; Cnestedconst: define i64 @test_nested_const(i64 %x) {
201 ; Cnestedconst-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i8>* @[[C1]], align 8 201 ; Cnestedconst-NEXT: %[[M1:[_a-z0-9]+]] = load <8 x i8>, <8 x i8>* @[[C1]], alig n 8
202 ; Cnestedconst-NEXT: %[[X1:[_a-z0-9]+]] = bitcast <8 x i8> %[[M1]] to i64 202 ; Cnestedconst-NEXT: %[[X1:[_a-z0-9]+]] = bitcast <8 x i8> %[[M1]] to i64
203 ; Cnestedconst-NEXT: add i64 %[[X1]], %x 203 ; Cnestedconst-NEXT: add i64 %[[X1]], %x
204 ; Cnestedconst-NEXT: ret i64 %foo 204 ; Cnestedconst-NEXT: ret i64 %foo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698