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

Side by Side Diff: test/Transforms/NaCl/fix-vector-load-store-alignment.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « test/Transforms/NaCl/expand-varargs-struct.ll ('k') | test/Transforms/NaCl/flatten-globals.ll » ('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 -fix-vector-load-store-alignment %s -S | FileCheck %s
2
3 ; Test that vector load/store are always element-aligned when possible, and get
4 ; converted to scalar load/store when not.
5
6 ; The datalayout is needed to determine the alignment of the load/stores.
7 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"
8
9 ; Load =========================================================================
10
11 define <4 x i1> @test_load_4xi1(<4 x i1>* %loc) {
12 ; CHECK-LABEL: test_load_4xi1
13 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i1>* %loc to i1*
14 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 0
15 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i1* %[[GEP0]], align 4
16 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <4 x i1> undef, i1 %[[LD0]], i3 2 0
17 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 1
18 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i1* %[[GEP1]], align 1
19 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <4 x i1> %[[INS0]], i1 %[[LD1]] , i32 1
20 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 2
21 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i1* %[[GEP2]], align 2
22 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <4 x i1> %[[INS1]], i1 %[[LD2]] , i32 2
23 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 3
24 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i1* %[[GEP3]], align 1
25 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <4 x i1> %[[INS2]], i1 %[[LD3]] , i32 3
26 ; CHECK-NEXT: ret <4 x i1> %[[INS3]]
27 %loaded = load <4 x i1>* %loc
28 ret <4 x i1> %loaded
29 }
30
31 define <8 x i1> @test_load_8xi1(<8 x i1>* %loc) {
32 ; CHECK-LABEL: test_load_8xi1
33 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <8 x i1>* %loc to i1*
34 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 0
35 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i1* %[[GEP0]], align 8
36 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <8 x i1> undef, i1 %[[LD0]], i3 2 0
37 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 1
38 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i1* %[[GEP1]], align 1
39 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <8 x i1> %[[INS0]], i1 %[[LD1]] , i32 1
40 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 2
41 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i1* %[[GEP2]], align 2
42 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <8 x i1> %[[INS1]], i1 %[[LD2]] , i32 2
43 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 3
44 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i1* %[[GEP3]], align 1
45 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <8 x i1> %[[INS2]], i1 %[[LD3]] , i32 3
46 ; CHECK-NEXT: %[[GEP4:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 4
47 ; CHECK-NEXT: %[[LD4:[0-9]+]] = load i1* %[[GEP4]], align 4
48 ; CHECK-NEXT: %[[INS4:[0-9]+]] = insertelement <8 x i1> %[[INS3]], i1 %[[LD4]] , i32 4
49 ; CHECK-NEXT: %[[GEP5:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 5
50 ; CHECK-NEXT: %[[LD5:[0-9]+]] = load i1* %[[GEP5]], align 1
51 ; CHECK-NEXT: %[[INS5:[0-9]+]] = insertelement <8 x i1> %[[INS4]], i1 %[[LD5]] , i32 5
52 ; CHECK-NEXT: %[[GEP6:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 6
53 ; CHECK-NEXT: %[[LD6:[0-9]+]] = load i1* %[[GEP6]], align 2
54 ; CHECK-NEXT: %[[INS6:[0-9]+]] = insertelement <8 x i1> %[[INS5]], i1 %[[LD6]] , i32 6
55 ; CHECK-NEXT: %[[GEP7:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 7
56 ; CHECK-NEXT: %[[LD7:[0-9]+]] = load i1* %[[GEP7]], align 1
57 ; CHECK-NEXT: %[[INS7:[0-9]+]] = insertelement <8 x i1> %[[INS6]], i1 %[[LD7]] , i32 7
58 ; CHECK-NEXT: ret <8 x i1> %[[INS7]]
59 %loaded = load <8 x i1>* %loc
60 ret <8 x i1> %loaded
61 }
62
63 define <16 x i1> @test_load_16xi1(<16 x i1>* %loc) {
64 ; CHECK-LABEL: test_load_16xi1
65 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <16 x i1>* %loc to i1*
66 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 0
67 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i1* %[[GEP0]], align 16
68 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <16 x i1> undef, i1 %[[LD0]], i 32 0
69 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 1
70 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i1* %[[GEP1]], align 1
71 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <16 x i1> %[[INS0]], i1 %[[LD1] ], i32 1
72 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 2
73 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i1* %[[GEP2]], align 2
74 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <16 x i1> %[[INS1]], i1 %[[LD2] ], i32 2
75 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 3
76 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i1* %[[GEP3]], align 1
77 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <16 x i1> %[[INS2]], i1 %[[LD3] ], i32 3
78 ; CHECK-NEXT: %[[GEP4:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 4
79 ; CHECK-NEXT: %[[LD4:[0-9]+]] = load i1* %[[GEP4]], align 4
80 ; CHECK-NEXT: %[[INS4:[0-9]+]] = insertelement <16 x i1> %[[INS3]], i1 %[[LD4] ], i32 4
81 ; CHECK-NEXT: %[[GEP5:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 5
82 ; CHECK-NEXT: %[[LD5:[0-9]+]] = load i1* %[[GEP5]], align 1
83 ; CHECK-NEXT: %[[INS5:[0-9]+]] = insertelement <16 x i1> %[[INS4]], i1 %[[LD5] ], i32 5
84 ; CHECK-NEXT: %[[GEP6:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 6
85 ; CHECK-NEXT: %[[LD6:[0-9]+]] = load i1* %[[GEP6]], align 2
86 ; CHECK-NEXT: %[[INS6:[0-9]+]] = insertelement <16 x i1> %[[INS5]], i1 %[[LD6] ], i32 6
87 ; CHECK-NEXT: %[[GEP7:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 7
88 ; CHECK-NEXT: %[[LD7:[0-9]+]] = load i1* %[[GEP7]], align 1
89 ; CHECK-NEXT: %[[INS7:[0-9]+]] = insertelement <16 x i1> %[[INS6]], i1 %[[LD7] ], i32 7
90 ; CHECK-NEXT: %[[GEP8:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 8
91 ; CHECK-NEXT: %[[LD8:[0-9]+]] = load i1* %[[GEP8]], align 8
92 ; CHECK-NEXT: %[[INS8:[0-9]+]] = insertelement <16 x i1> %[[INS7]], i1 %[[LD8] ], i32 8
93 ; CHECK-NEXT: %[[GEP9:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 9
94 ; CHECK-NEXT: %[[LD9:[0-9]+]] = load i1* %[[GEP9]], align 1
95 ; CHECK-NEXT: %[[INS9:[0-9]+]] = insertelement <16 x i1> %[[INS8]], i1 %[[LD9] ], i32 9
96 ; CHECK-NEXT: %[[GEP10:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 10
97 ; CHECK-NEXT: %[[LD10:[0-9]+]] = load i1* %[[GEP10]], align 2
98 ; CHECK-NEXT: %[[INS10:[0-9]+]] = insertelement <16 x i1> %[[INS9]], i1 %[[LD1 0]], i32 10
99 ; CHECK-NEXT: %[[GEP11:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 11
100 ; CHECK-NEXT: %[[LD11:[0-9]+]] = load i1* %[[GEP11]], align 1
101 ; CHECK-NEXT: %[[INS11:[0-9]+]] = insertelement <16 x i1> %[[INS10]], i1 %[[LD 11]], i32 11
102 ; CHECK-NEXT: %[[GEP12:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 12
103 ; CHECK-NEXT: %[[LD12:[0-9]+]] = load i1* %[[GEP12]], align 4
104 ; CHECK-NEXT: %[[INS12:[0-9]+]] = insertelement <16 x i1> %[[INS11]], i1 %[[LD 12]], i32 12
105 ; CHECK-NEXT: %[[GEP13:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 13
106 ; CHECK-NEXT: %[[LD13:[0-9]+]] = load i1* %[[GEP13]], align 1
107 ; CHECK-NEXT: %[[INS13:[0-9]+]] = insertelement <16 x i1> %[[INS12]], i1 %[[LD 13]], i32 13
108 ; CHECK-NEXT: %[[GEP14:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 14
109 ; CHECK-NEXT: %[[LD14:[0-9]+]] = load i1* %[[GEP14]], align 2
110 ; CHECK-NEXT: %[[INS14:[0-9]+]] = insertelement <16 x i1> %[[INS13]], i1 %[[LD 14]], i32 14
111 ; CHECK-NEXT: %[[GEP15:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 15
112 ; CHECK-NEXT: %[[LD15:[0-9]+]] = load i1* %[[GEP15]], align 1
113 ; CHECK-NEXT: %[[INS15:[0-9]+]] = insertelement <16 x i1> %[[INS14]], i1 %[[LD 15]], i32 15
114 ; CHECK-NEXT: ret <16 x i1> %[[INS15]]
115 %loaded = load <16 x i1>* %loc
116 ret <16 x i1> %loaded
117 }
118
119 define <4 x i32> @test_load_4xi32_align0(<4 x i32>* %loc) {
120 ; CHECK-LABEL: test_load_4xi32_align0
121 ; CHECK-NEXT: %loaded = load <4 x i32>* %loc, align 4
122 ; CHECK-NEXT: ret <4 x i32> %loaded
123 %loaded = load <4 x i32>* %loc
124 ret <4 x i32> %loaded
125 }
126
127 define <4 x i32> @test_load_4xi32_align1(<4 x i32>* %loc) {
128 ; CHECK-LABEL: test_load_4xi32_align1
129 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i32>* %loc to i32*
130 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 0
131 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i32* %[[GEP0]], align 1
132 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <4 x i32> undef, i32 %[[LD0]], i32 0
133 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 1
134 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i32* %[[GEP1]], align 1
135 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <4 x i32> %[[INS0]], i32 %[[LD1 ]], i32 1
136 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 2
137 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i32* %[[GEP2]], align 1
138 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <4 x i32> %[[INS1]], i32 %[[LD2 ]], i32 2
139 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 3
140 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i32* %[[GEP3]], align 1
141 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <4 x i32> %[[INS2]], i32 %[[LD3 ]], i32 3
142 ; CHECK-NEXT: ret <4 x i32> %[[INS3]]
143 %loaded = load <4 x i32>* %loc, align 1
144 ret <4 x i32> %loaded
145 }
146
147 define <4 x i32> @test_load_4xi32_align2(<4 x i32>* %loc) {
148 ; CHECK-LABEL: test_load_4xi32_align2
149 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i32>* %loc to i32*
150 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 0
151 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i32* %[[GEP0]], align 2
152 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <4 x i32> undef, i32 %[[LD0]], i32 0
153 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 1
154 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i32* %[[GEP1]], align 2
155 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <4 x i32> %[[INS0]], i32 %[[LD1 ]], i32 1
156 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 2
157 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i32* %[[GEP2]], align 2
158 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <4 x i32> %[[INS1]], i32 %[[LD2 ]], i32 2
159 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 3
160 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i32* %[[GEP3]], align 2
161 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <4 x i32> %[[INS2]], i32 %[[LD3 ]], i32 3
162 ; CHECK-NEXT: ret <4 x i32> %[[INS3]]
163 %loaded = load <4 x i32>* %loc, align 2
164 ret <4 x i32> %loaded
165 }
166
167 define <4 x i32> @test_load_4xi32_align4(<4 x i32>* %loc) {
168 ; CHECK-LABEL: test_load_4xi32_align4
169 ; CHECK-NEXT: %loaded = load <4 x i32>* %loc, align 4
170 ; CHECK-NEXT: ret <4 x i32> %loaded
171 %loaded = load <4 x i32>* %loc, align 4
172 ret <4 x i32> %loaded
173 }
174
175 define <4 x i32> @test_load_4xi32_align8(<4 x i32>* %loc) {
176 ; CHECK-LABEL: test_load_4xi32_align8
177 ; CHECK-NEXT: %loaded = load <4 x i32>* %loc, align 4
178 ; CHECK-NEXT: ret <4 x i32> %loaded
179 %loaded = load <4 x i32>* %loc, align 8
180 ret <4 x i32> %loaded
181 }
182
183 define <4 x i32> @test_load_4xi32_align16(<4 x i32>* %loc) {
184 ; CHECK-LABEL: test_load_4xi32_align16
185 ; CHECK-NEXT: %loaded = load <4 x i32>* %loc, align 4
186 ; CHECK-NEXT: ret <4 x i32> %loaded
187 %loaded = load <4 x i32>* %loc, align 16
188 ret <4 x i32> %loaded
189 }
190
191 define <4 x i32> @test_load_4xi32_align32(<4 x i32>* %loc) {
192 ; CHECK-LABEL: test_load_4xi32_align32
193 ; CHECK-NEXT: %loaded = load <4 x i32>* %loc, align 4
194 ; CHECK-NEXT: ret <4 x i32> %loaded
195 %loaded = load <4 x i32>* %loc, align 32
196 ret <4 x i32> %loaded
197 }
198
199 define <4 x float> @test_load_4xfloat_align0(<4 x float>* %loc) {
200 ; CHECK-LABEL: test_load_4xfloat_align0
201 ; CHECK-NEXT: %loaded = load <4 x float>* %loc, align 4
202 ; CHECK-NEXT: ret <4 x float> %loaded
203 %loaded = load <4 x float>* %loc
204 ret <4 x float> %loaded
205 }
206
207 define <4 x float> @test_load_4xfloat_align2(<4 x float>* %loc) {
208 ; CHECK-LABEL: test_load_4xfloat_align2
209 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x float>* %loc to float*
210 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds float* %[[BASE]], i32 0
211 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load float* %[[GEP0]], align 2
212 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <4 x float> undef, float %[[LD0 ]], i32 0
213 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds float* %[[BASE]], i32 1
214 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load float* %[[GEP1]], align 2
215 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <4 x float> %[[INS0]], float %[ [LD1]], i32 1
216 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds float* %[[BASE]], i32 2
217 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load float* %[[GEP2]], align 2
218 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <4 x float> %[[INS1]], float %[ [LD2]], i32 2
219 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds float* %[[BASE]], i32 3
220 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load float* %[[GEP3]], align 2
221 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <4 x float> %[[INS2]], float %[ [LD3]], i32 3
222 ; CHECK-NEXT: ret <4 x float> %[[INS3]]
223 %loaded = load <4 x float>* %loc, align 2
224 ret <4 x float> %loaded
225 }
226
227 define <4 x float> @test_load_4xfloat_align4(<4 x float>* %loc) {
228 ; CHECK-LABEL: test_load_4xfloat_align4
229 ; CHECK-NEXT: %loaded = load <4 x float>* %loc, align 4
230 ; CHECK-NEXT: ret <4 x float> %loaded
231 %loaded = load <4 x float>* %loc, align 4
232 ret <4 x float> %loaded
233 }
234
235 define <8 x i16> @test_load_8xi16_align0(<8 x i16>* %loc) {
236 ; CHECK-LABEL: test_load_8xi16_align0
237 ; CHECK-NEXT: %loaded = load <8 x i16>* %loc, align 2
238 ; CHECK-NEXT: ret <8 x i16> %loaded
239 %loaded = load <8 x i16>* %loc
240 ret <8 x i16> %loaded
241 }
242
243 define <8 x i16> @test_load_8xi16_align1(<8 x i16>* %loc) {
244 ; CHECK-LABEL: test_load_8xi16_align1
245 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <8 x i16>* %loc to i16*
246 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 0
247 ; CHECK-NEXT: %[[LD0:[0-9]+]] = load i16* %[[GEP0]], align 1
248 ; CHECK-NEXT: %[[INS0:[0-9]+]] = insertelement <8 x i16> undef, i16 %[[LD0]], i32 0
249 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 1
250 ; CHECK-NEXT: %[[LD1:[0-9]+]] = load i16* %[[GEP1]], align 1
251 ; CHECK-NEXT: %[[INS1:[0-9]+]] = insertelement <8 x i16> %[[INS0]], i16 %[[LD1 ]], i32 1
252 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 2
253 ; CHECK-NEXT: %[[LD2:[0-9]+]] = load i16* %[[GEP2]], align 1
254 ; CHECK-NEXT: %[[INS2:[0-9]+]] = insertelement <8 x i16> %[[INS1]], i16 %[[LD2 ]], i32 2
255 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 3
256 ; CHECK-NEXT: %[[LD3:[0-9]+]] = load i16* %[[GEP3]], align 1
257 ; CHECK-NEXT: %[[INS3:[0-9]+]] = insertelement <8 x i16> %[[INS2]], i16 %[[LD3 ]], i32 3
258 ; CHECK-NEXT: %[[GEP4:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 4
259 ; CHECK-NEXT: %[[LD4:[0-9]+]] = load i16* %[[GEP4]], align 1
260 ; CHECK-NEXT: %[[INS4:[0-9]+]] = insertelement <8 x i16> %[[INS3]], i16 %[[LD4 ]], i32 4
261 ; CHECK-NEXT: %[[GEP5:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 5
262 ; CHECK-NEXT: %[[LD5:[0-9]+]] = load i16* %[[GEP5]], align 1
263 ; CHECK-NEXT: %[[INS5:[0-9]+]] = insertelement <8 x i16> %[[INS4]], i16 %[[LD5 ]], i32 5
264 ; CHECK-NEXT: %[[GEP6:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 6
265 ; CHECK-NEXT: %[[LD6:[0-9]+]] = load i16* %[[GEP6]], align 1
266 ; CHECK-NEXT: %[[INS6:[0-9]+]] = insertelement <8 x i16> %[[INS5]], i16 %[[LD6 ]], i32 6
267 ; CHECK-NEXT: %[[GEP7:[0-9]+]] = getelementptr inbounds i16* %[[BASE]], i32 7
268 ; CHECK-NEXT: %[[LD7:[0-9]+]] = load i16* %[[GEP7]], align 1
269 ; CHECK-NEXT: %[[INS7:[0-9]+]] = insertelement <8 x i16> %[[INS6]], i16 %[[LD7 ]], i32 7
270 ; CHECK-NEXT: ret <8 x i16> %[[INS7]]
271 %loaded = load <8 x i16>* %loc, align 1
272 ret <8 x i16> %loaded
273 }
274
275 define <8 x i16> @test_load_8xi16_align2(<8 x i16>* %loc) {
276 ; CHECK-LABEL: test_load_8xi16_align2
277 ; CHECK-NEXT: %loaded = load <8 x i16>* %loc, align 2
278 ; CHECK-NEXT: ret <8 x i16> %loaded
279 %loaded = load <8 x i16>* %loc, align 2
280 ret <8 x i16> %loaded
281 }
282
283 define <16 x i8> @test_load_16xi8_align0(<16 x i8>* %loc) {
284 ; CHECK-LABEL: test_load_16xi8_align0
285 ; CHECK-NEXT: %loaded = load <16 x i8>* %loc, align 1
286 ; CHECK-NEXT: ret <16 x i8> %loaded
287 %loaded = load <16 x i8>* %loc
288 ret <16 x i8> %loaded
289 }
290
291 define <16 x i8> @test_load_16xi8_align1(<16 x i8>* %loc) {
292 ; CHECK-LABEL: test_load_16xi8_align1
293 ; CHECK-NEXT: %loaded = load <16 x i8>* %loc, align 1
294 ; CHECK-NEXT: ret <16 x i8> %loaded
295 %loaded = load <16 x i8>* %loc, align 1
296 ret <16 x i8> %loaded
297 }
298
299
300 ; Store ========================================================================
301
302 define void @test_store_4xi1(<4 x i1> %val, <4 x i1>* %loc) {
303 ; CHECK-LABEL: test_store_4xi1
304 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i1>* %loc to i1*
305 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 0
306 ; CHECK-NEXT: %[[EXT0:[0-9]+]] = extractelement <4 x i1> %val, i32 0
307 ; CHECK-NEXT: store i1 %[[EXT0]], i1* %[[GEP0]], align 4
308 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 1
309 ; CHECK-NEXT: %[[EXT1:[0-9]+]] = extractelement <4 x i1> %val, i32 1
310 ; CHECK-NEXT: store i1 %[[EXT1]], i1* %[[GEP1]], align 1
311 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 2
312 ; CHECK-NEXT: %[[EXT2:[0-9]+]] = extractelement <4 x i1> %val, i32 2
313 ; CHECK-NEXT: store i1 %[[EXT2]], i1* %[[GEP2]], align 2
314 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i1* %[[BASE]], i32 3
315 ; CHECK-NEXT: %[[EXT3:[0-9]+]] = extractelement <4 x i1> %val, i32 3
316 ; CHECK-NEXT: store i1 %[[EXT3]], i1* %[[GEP3]], align 1
317 ; CHECK-NEXT: ret void
318 store <4 x i1> %val, <4 x i1>* %loc
319 ret void
320 }
321
322 define void @test_store_4xi32_align0(<4 x i32> %val, <4 x i32>* %loc) {
323 ; CHECK-LABEL: test_store_4xi32_align0
324 ; CHECK-NEXT: store <4 x i32> %val, <4 x i32>* %loc, align 4
325 ; CHECK-NEXT: ret void
326 store <4 x i32> %val, <4 x i32>* %loc
327 ret void
328 }
329
330 define void @test_store_4xi32_align1(<4 x i32> %val, <4 x i32>* %loc) {
331 ; CHECK-LABEL: test_store_4xi32_align1
332 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i32>* %loc to i32*
333 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 0
334 ; CHECK-NEXT: %[[EXT0:[0-9]+]] = extractelement <4 x i32> %val, i32 0
335 ; CHECK-NEXT: store i32 %[[EXT0]], i32* %[[GEP0]], align 1
336 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 1
337 ; CHECK-NEXT: %[[EXT1:[0-9]+]] = extractelement <4 x i32> %val, i32 1
338 ; CHECK-NEXT: store i32 %[[EXT1]], i32* %[[GEP1]], align 1
339 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 2
340 ; CHECK-NEXT: %[[EXT2:[0-9]+]] = extractelement <4 x i32> %val, i32 2
341 ; CHECK-NEXT: store i32 %[[EXT2]], i32* %[[GEP2]], align 1
342 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 3
343 ; CHECK-NEXT: %[[EXT3:[0-9]+]] = extractelement <4 x i32> %val, i32 3
344 ; CHECK-NEXT: store i32 %[[EXT3]], i32* %[[GEP3]], align 1
345 ; CHECK-NEXT: ret void
346 store <4 x i32> %val, <4 x i32>* %loc, align 1
347 ret void
348 }
349
350 define void @test_store_4xi32_align2(<4 x i32> %val, <4 x i32>* %loc) {
351 ; CHECK-LABEL: test_store_4xi32_align2
352 ; CHECK-NEXT: %[[BASE:[0-9]+]] = bitcast <4 x i32>* %loc to i32*
353 ; CHECK-NEXT: %[[GEP0:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 0
354 ; CHECK-NEXT: %[[EXT0:[0-9]+]] = extractelement <4 x i32> %val, i32 0
355 ; CHECK-NEXT: store i32 %[[EXT0]], i32* %[[GEP0]], align 2
356 ; CHECK-NEXT: %[[GEP1:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 1
357 ; CHECK-NEXT: %[[EXT1:[0-9]+]] = extractelement <4 x i32> %val, i32 1
358 ; CHECK-NEXT: store i32 %[[EXT1]], i32* %[[GEP1]], align 2
359 ; CHECK-NEXT: %[[GEP2:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 2
360 ; CHECK-NEXT: %[[EXT2:[0-9]+]] = extractelement <4 x i32> %val, i32 2
361 ; CHECK-NEXT: store i32 %[[EXT2]], i32* %[[GEP2]], align 2
362 ; CHECK-NEXT: %[[GEP3:[0-9]+]] = getelementptr inbounds i32* %[[BASE]], i32 3
363 ; CHECK-NEXT: %[[EXT3:[0-9]+]] = extractelement <4 x i32> %val, i32 3
364 ; CHECK-NEXT: store i32 %[[EXT3]], i32* %[[GEP3]], align 2
365 ; CHECK-NEXT: ret void
366 store <4 x i32> %val, <4 x i32>* %loc, align 2
367 ret void
368 }
369
370 define void @test_store_4xi32_align4(<4 x i32> %val, <4 x i32>* %loc) {
371 ; CHECK-LABEL: test_store_4xi32_align4
372 ; CHECK-NEXT: store <4 x i32> %val, <4 x i32>* %loc, align 4
373 ; CHECK-NEXT: ret void
374 store <4 x i32> %val, <4 x i32>* %loc, align 4
375 ret void
376 }
377
378 define void @test_store_4xi32_align8(<4 x i32> %val, <4 x i32>* %loc) {
379 ; CHECK-LABEL: test_store_4xi32_align8
380 ; CHECK-NEXT: store <4 x i32> %val, <4 x i32>* %loc, align 4
381 ; CHECK-NEXT: ret void
382 store <4 x i32> %val, <4 x i32>* %loc, align 8
383 ret void
384 }
385
386 define void @test_store_4xi32_align16(<4 x i32> %val, <4 x i32>* %loc) {
387 ; CHECK-LABEL: test_store_4xi32_align16
388 ; CHECK-NEXT: store <4 x i32> %val, <4 x i32>* %loc, align 4
389 ; CHECK-NEXT: ret void
390 store <4 x i32> %val, <4 x i32>* %loc, align 16
391 ret void
392 }
393
394 define void @test_store_4xi32_align32(<4 x i32> %val, <4 x i32>* %loc) {
395 ; CHECK-LABEL: test_store_4xi32_align32
396 ; CHECK-NEXT: store <4 x i32> %val, <4 x i32>* %loc, align 4
397 ; CHECK-NEXT: ret void
398 store <4 x i32> %val, <4 x i32>* %loc, align 32
399 ret void
400 }
401
402 define void @test_store_4xfloat_align0(<4 x float> %val, <4 x float>* %loc) {
403 ; CHECK-LABEL: test_store_4xfloat_align0
404 ; CHECK-NEXT: store <4 x float> %val, <4 x float>* %loc, align 4
405 ; CHECK-NEXT: ret void
406 store <4 x float> %val, <4 x float>* %loc
407 ret void
408 }
409
410
411 ; Volatile =====================================================================
412
413 define <4 x i32> @test_volatile_load_4xi32_align0(<4 x i32>* %loc) {
414 ; CHECK-LABEL: test_volatile_load_4xi32_align0
415 ; CHECK-NEXT: %loaded = load volatile <4 x i32>* %loc, align 4
416 ; CHECK-NEXT: ret <4 x i32> %loaded
417 %loaded = load volatile <4 x i32>* %loc
418 ret <4 x i32> %loaded
419 }
420
421 define <4 x i32> @test_volatile_load_4xi32_align4(<4 x i32>* %loc) {
422 ; CHECK-LABEL: test_volatile_load_4xi32_align4
423 ; CHECK-NEXT: %loaded = load volatile <4 x i32>* %loc, align 4
424 ; CHECK-NEXT: ret <4 x i32> %loaded
425 %loaded = load volatile <4 x i32>* %loc, align 4
426 ret <4 x i32> %loaded
427 }
428
429 define void @test_volatile_store_4xi32_align0(<4 x i32> %val, <4 x i32>* %loc) {
430 ; CHECK-LABEL: test_volatile_store_4xi32_align0
431 ; CHECK-NEXT: store volatile <4 x i32> %val, <4 x i32>* %loc, align 4
432 ; CHECK-NEXT: ret void
433 store volatile <4 x i32> %val, <4 x i32>* %loc
434 ret void
435 }
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/expand-varargs-struct.ll ('k') | test/Transforms/NaCl/flatten-globals.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698