memInstructions.3.2.ll
14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: verify-uselistorder < %s.bc
; memOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread memory related instructions of
; older bitcode files.
define void @alloca(){
entry:
; CHECK: %res1 = alloca i8
%res1 = alloca i8
; CHECK-NEXT: %res2 = alloca i8, i32 2
%res2 = alloca i8, i32 2
; CHECK-NEXT: %res3 = alloca i8, i32 2, align 4
%res3 = alloca i8, i32 2, align 4
; CHECK-NEXT: %res4 = alloca i8, align 4
%res4 = alloca i8, align 4
ret void
}
define void @load(){
entry:
%ptr1 = alloca i8
store i8 2, i8* %ptr1
; CHECK: %res1 = load i8, i8* %ptr1
%res1 = load i8, i8* %ptr1
; CHECK-NEXT: %res2 = load volatile i8, i8* %ptr1
%res2 = load volatile i8, i8* %ptr1
; CHECK-NEXT: %res3 = load i8, i8* %ptr1, align 1
%res3 = load i8, i8* %ptr1, align 1
; CHECK-NEXT: %res4 = load volatile i8, i8* %ptr1, align 1
%res4 = load volatile i8, i8* %ptr1, align 1
; CHECK-NEXT: %res5 = load i8, i8* %ptr1, !nontemporal !0
%res5 = load i8, i8* %ptr1, !nontemporal !0
; CHECK-NEXT: %res6 = load volatile i8, i8* %ptr1, !nontemporal !0
%res6 = load volatile i8, i8* %ptr1, !nontemporal !0
; CHECK-NEXT: %res7 = load i8, i8* %ptr1, align 1, !nontemporal !0
%res7 = load i8, i8* %ptr1, align 1, !nontemporal !0
; CHECK-NEXT: %res8 = load volatile i8, i8* %ptr1, align 1, !nontemporal !0
%res8 = load volatile i8, i8* %ptr1, align 1, !nontemporal !0
; CHECK-NEXT: %res9 = load i8, i8* %ptr1, !invariant.load !1
%res9 = load i8, i8* %ptr1, !invariant.load !1
; CHECK-NEXT: %res10 = load volatile i8, i8* %ptr1, !invariant.load !1
%res10 = load volatile i8, i8* %ptr1, !invariant.load !1
; CHECK-NEXT: %res11 = load i8, i8* %ptr1, align 1, !invariant.load !1
%res11 = load i8, i8* %ptr1, align 1, !invariant.load !1
; CHECK-NEXT: %res12 = load volatile i8, i8* %ptr1, align 1, !invariant.load !1
%res12 = load volatile i8, i8* %ptr1, align 1, !invariant.load !1
; CHECK-NEXT: %res13 = load i8, i8* %ptr1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
%res13 = load i8, i8* %ptr1, !nontemporal !0, !invariant.load !1
; CHECK-NEXT: %res14 = load volatile i8, i8* %ptr1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
%res14 = load volatile i8, i8* %ptr1, !nontemporal !0, !invariant.load !1
; CHECK-NEXT: %res15 = load i8, i8* %ptr1, align 1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
%res15 = load i8, i8* %ptr1, align 1, !nontemporal !0, !invariant.load !1
; CHECK-NEXT: %res16 = load volatile i8, i8* %ptr1, align 1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
%res16 = load volatile i8, i8* %ptr1, align 1, !nontemporal !0, !invariant.load !1
ret void
}
define void @loadAtomic(){
entry:
%ptr1 = alloca i8
store i8 2, i8* %ptr1
; CHECK: %res1 = load atomic i8, i8* %ptr1 unordered, align 1
%res1 = load atomic i8, i8* %ptr1 unordered, align 1
; CHECK-NEXT: %res2 = load atomic i8, i8* %ptr1 monotonic, align 1
%res2 = load atomic i8, i8* %ptr1 monotonic, align 1
; CHECK-NEXT: %res3 = load atomic i8, i8* %ptr1 acquire, align 1
%res3 = load atomic i8, i8* %ptr1 acquire, align 1
; CHECK-NEXT: %res4 = load atomic i8, i8* %ptr1 seq_cst, align 1
%res4 = load atomic i8, i8* %ptr1 seq_cst, align 1
; CHECK-NEXT: %res5 = load atomic volatile i8, i8* %ptr1 unordered, align 1
%res5 = load atomic volatile i8, i8* %ptr1 unordered, align 1
; CHECK-NEXT: %res6 = load atomic volatile i8, i8* %ptr1 monotonic, align 1
%res6 = load atomic volatile i8, i8* %ptr1 monotonic, align 1
; CHECK-NEXT: %res7 = load atomic volatile i8, i8* %ptr1 acquire, align 1
%res7 = load atomic volatile i8, i8* %ptr1 acquire, align 1
; CHECK-NEXT: %res8 = load atomic volatile i8, i8* %ptr1 seq_cst, align 1
%res8 = load atomic volatile i8, i8* %ptr1 seq_cst, align 1
; CHECK-NEXT: %res9 = load atomic i8, i8* %ptr1 syncscope("singlethread") unordered, align 1
%res9 = load atomic i8, i8* %ptr1 syncscope("singlethread") unordered, align 1
; CHECK-NEXT: %res10 = load atomic i8, i8* %ptr1 syncscope("singlethread") monotonic, align 1
%res10 = load atomic i8, i8* %ptr1 syncscope("singlethread") monotonic, align 1
; CHECK-NEXT: %res11 = load atomic i8, i8* %ptr1 syncscope("singlethread") acquire, align 1
%res11 = load atomic i8, i8* %ptr1 syncscope("singlethread") acquire, align 1
; CHECK-NEXT: %res12 = load atomic i8, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
%res12 = load atomic i8, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
; CHECK-NEXT: %res13 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") unordered, align 1
%res13 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") unordered, align 1
; CHECK-NEXT: %res14 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") monotonic, align 1
%res14 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") monotonic, align 1
; CHECK-NEXT: %res15 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") acquire, align 1
%res15 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") acquire, align 1
; CHECK-NEXT: %res16 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
%res16 = load atomic volatile i8, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
ret void
}
define void @store(){
entry:
%ptr1 = alloca i8
; CHECK: store i8 2, i8* %ptr1
store i8 2, i8* %ptr1
; CHECK-NEXT: store volatile i8 2, i8* %ptr1
store volatile i8 2, i8* %ptr1
; CHECK-NEXT: store i8 2, i8* %ptr1, align 1
store i8 2, i8* %ptr1, align 1
; CHECK-NEXT: store volatile i8 2, i8* %ptr1, align 1
store volatile i8 2, i8* %ptr1, align 1
; CHECK-NEXT: store i8 2, i8* %ptr1, !nontemporal !0
store i8 2, i8* %ptr1, !nontemporal !0
; CHECK-NEXT: store volatile i8 2, i8* %ptr1, !nontemporal !0
store volatile i8 2, i8* %ptr1, !nontemporal !0
; CHECK-NEXT: store i8 2, i8* %ptr1, align 1, !nontemporal !0
store i8 2, i8* %ptr1, align 1, !nontemporal !0
; CHECK-NEXT: store volatile i8 2, i8* %ptr1, align 1, !nontemporal !0
store volatile i8 2, i8* %ptr1, align 1, !nontemporal !0
ret void
}
define void @storeAtomic(){
entry:
%ptr1 = alloca i8
; CHECK: store atomic i8 2, i8* %ptr1 unordered, align 1
store atomic i8 2, i8* %ptr1 unordered, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 monotonic, align 1
store atomic i8 2, i8* %ptr1 monotonic, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 release, align 1
store atomic i8 2, i8* %ptr1 release, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 seq_cst, align 1
store atomic i8 2, i8* %ptr1 seq_cst, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 unordered, align 1
store atomic volatile i8 2, i8* %ptr1 unordered, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 monotonic, align 1
store atomic volatile i8 2, i8* %ptr1 monotonic, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 release, align 1
store atomic volatile i8 2, i8* %ptr1 release, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 seq_cst, align 1
store atomic volatile i8 2, i8* %ptr1 seq_cst, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 syncscope("singlethread") unordered, align 1
store atomic i8 2, i8* %ptr1 syncscope("singlethread") unordered, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 syncscope("singlethread") monotonic, align 1
store atomic i8 2, i8* %ptr1 syncscope("singlethread") monotonic, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 syncscope("singlethread") release, align 1
store atomic i8 2, i8* %ptr1 syncscope("singlethread") release, align 1
; CHECK-NEXT: store atomic i8 2, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
store atomic i8 2, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") unordered, align 1
store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") unordered, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") monotonic, align 1
store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") monotonic, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") release, align 1
store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") release, align 1
; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
store atomic volatile i8 2, i8* %ptr1 syncscope("singlethread") seq_cst, align 1
ret void
}
define void @cmpxchg(i32* %ptr,i32 %cmp,i32 %new){
entry:
;cmpxchg [volatile] <ty>* <pointer>, <ty> <cmp>, <ty> <new> [singlethread] <ordering>
; CHECK: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
; CHECK-NEXT: %res1 = extractvalue { i32, i1 } [[TMP]], 0
%res1 = cmpxchg i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
; CHECK-NEXT: %res2 = extractvalue { i32, i1 } [[TMP]], 0
%res2 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") monotonic monotonic
; CHECK-NEXT: %res3 = extractvalue { i32, i1 } [[TMP]], 0
%res3 = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") monotonic monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") monotonic monotonic
; CHECK-NEXT: %res4 = extractvalue { i32, i1 } [[TMP]], 0
%res4 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") monotonic monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new acquire acquire
; CHECK-NEXT: %res5 = extractvalue { i32, i1 } [[TMP]], 0
%res5 = cmpxchg i32* %ptr, i32 %cmp, i32 %new acquire acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acquire acquire
; CHECK-NEXT: %res6 = extractvalue { i32, i1 } [[TMP]], 0
%res6 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acquire acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acquire acquire
; CHECK-NEXT: %res7 = extractvalue { i32, i1 } [[TMP]], 0
%res7 = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acquire acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acquire acquire
; CHECK-NEXT: %res8 = extractvalue { i32, i1 } [[TMP]], 0
%res8 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acquire acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new release monotonic
; CHECK-NEXT: %res9 = extractvalue { i32, i1 } [[TMP]], 0
%res9 = cmpxchg i32* %ptr, i32 %cmp, i32 %new release monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new release monotonic
; CHECK-NEXT: %res10 = extractvalue { i32, i1 } [[TMP]], 0
%res10 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new release monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") release monotonic
; CHECK-NEXT: %res11 = extractvalue { i32, i1 } [[TMP]], 0
%res11 = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") release monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") release monotonic
; CHECK-NEXT: %res12 = extractvalue { i32, i1 } [[TMP]], 0
%res12 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") release monotonic
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
; CHECK-NEXT: %res13 = extractvalue { i32, i1 } [[TMP]], 0
%res13 = cmpxchg i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
; CHECK-NEXT: %res14 = extractvalue { i32, i1 } [[TMP]], 0
%res14 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acq_rel acquire
; CHECK-NEXT: %res15 = extractvalue { i32, i1 } [[TMP]], 0
%res15 = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acq_rel acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acq_rel acquire
; CHECK-NEXT: %res16 = extractvalue { i32, i1 } [[TMP]], 0
%res16 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") acq_rel acquire
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
; CHECK-NEXT: %res17 = extractvalue { i32, i1 } [[TMP]], 0
%res17 = cmpxchg i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
; CHECK-NEXT: %res18 = extractvalue { i32, i1 } [[TMP]], 0
%res18 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") seq_cst seq_cst
; CHECK-NEXT: %res19 = extractvalue { i32, i1 } [[TMP]], 0
%res19 = cmpxchg i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") seq_cst seq_cst
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") seq_cst seq_cst
; CHECK-NEXT: %res20 = extractvalue { i32, i1 } [[TMP]], 0
%res20 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new syncscope("singlethread") seq_cst seq_cst
ret void
}
define void @getelementptr({i8, i8}, {i8, i8}* %s, <4 x i8*> %ptrs, <4 x i64> %offsets ){
entry:
; CHECK: %res1 = getelementptr { i8, i8 }, { i8, i8 }* %s, i32 1, i32 1
%res1 = getelementptr {i8, i8}, {i8, i8}* %s, i32 1, i32 1
; CHECK-NEXT: %res2 = getelementptr inbounds { i8, i8 }, { i8, i8 }* %s, i32 1, i32 1
%res2 = getelementptr inbounds {i8, i8}, {i8, i8}* %s, i32 1, i32 1
; CHECK-NEXT: %res3 = getelementptr i8, <4 x i8*> %ptrs, <4 x i64> %offsets
%res3 = getelementptr i8, <4 x i8*> %ptrs, <4 x i64> %offsets
ret void
}
!0 = metadata !{ i32 1 }
!1 = metadata !{}