llvm-project

Форк
0
414 строк · 10.8 Кб
1
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2
; RUN: verify-uselistorder %s
3

4
@addr = external global i64
5
@addr_as1 = external addrspace(1) global i64
6

7
define i64 @add_unsigned(i64 %x, i64 %y) {
8
; CHECK: %z = add nuw i64 %x, %y
9
	%z = add nuw i64 %x, %y
10
	ret i64 %z
11
}
12

13
define i64 @sub_unsigned(i64 %x, i64 %y) {
14
; CHECK: %z = sub nuw i64 %x, %y
15
	%z = sub nuw i64 %x, %y
16
	ret i64 %z
17
}
18

19
define i64 @mul_unsigned(i64 %x, i64 %y) {
20
; CHECK: %z = mul nuw i64 %x, %y
21
	%z = mul nuw i64 %x, %y
22
	ret i64 %z
23
}
24

25
define i64 @add_signed(i64 %x, i64 %y) {
26
; CHECK: %z = add nsw i64 %x, %y
27
	%z = add nsw i64 %x, %y
28
	ret i64 %z
29
}
30

31
define i64 @sub_signed(i64 %x, i64 %y) {
32
; CHECK: %z = sub nsw i64 %x, %y
33
	%z = sub nsw i64 %x, %y
34
	ret i64 %z
35
}
36

37
define i64 @mul_signed(i64 %x, i64 %y) {
38
; CHECK: %z = mul nsw i64 %x, %y
39
	%z = mul nsw i64 %x, %y
40
	ret i64 %z
41
}
42

43
define i64 @add_plain(i64 %x, i64 %y) {
44
; CHECK: %z = add i64 %x, %y
45
	%z = add i64 %x, %y
46
	ret i64 %z
47
}
48

49
define i64 @sub_plain(i64 %x, i64 %y) {
50
; CHECK: %z = sub i64 %x, %y
51
	%z = sub i64 %x, %y
52
	ret i64 %z
53
}
54

55
define i64 @mul_plain(i64 %x, i64 %y) {
56
; CHECK: %z = mul i64 %x, %y
57
	%z = mul i64 %x, %y
58
	ret i64 %z
59
}
60

61
define i64 @add_both(i64 %x, i64 %y) {
62
; CHECK: %z = add nuw nsw i64 %x, %y
63
	%z = add nuw nsw i64 %x, %y
64
	ret i64 %z
65
}
66

67
define i64 @sub_both(i64 %x, i64 %y) {
68
; CHECK: %z = sub nuw nsw i64 %x, %y
69
	%z = sub nuw nsw i64 %x, %y
70
	ret i64 %z
71
}
72

73
define i64 @mul_both(i64 %x, i64 %y) {
74
; CHECK: %z = mul nuw nsw i64 %x, %y
75
	%z = mul nuw nsw i64 %x, %y
76
	ret i64 %z
77
}
78

79
define i64 @add_both_reversed(i64 %x, i64 %y) {
80
; CHECK: %z = add nuw nsw i64 %x, %y
81
	%z = add nsw nuw i64 %x, %y
82
	ret i64 %z
83
}
84

85
define i64 @sub_both_reversed(i64 %x, i64 %y) {
86
; CHECK: %z = sub nuw nsw i64 %x, %y
87
	%z = sub nsw nuw i64 %x, %y
88
	ret i64 %z
89
}
90

91
define i64 @mul_both_reversed(i64 %x, i64 %y) {
92
; CHECK: %z = mul nuw nsw i64 %x, %y
93
	%z = mul nsw nuw i64 %x, %y
94
	ret i64 %z
95
}
96

97
define i64 @shl_both(i64 %x, i64 %y) {
98
; CHECK: %z = shl nuw nsw i64 %x, %y
99
	%z = shl nuw nsw i64 %x, %y
100
	ret i64 %z
101
}
102

103
define i64 @sdiv_exact(i64 %x, i64 %y) {
104
; CHECK: %z = sdiv exact i64 %x, %y
105
	%z = sdiv exact i64 %x, %y
106
	ret i64 %z
107
}
108

109
define i64 @sdiv_plain(i64 %x, i64 %y) {
110
; CHECK: %z = sdiv i64 %x, %y
111
	%z = sdiv i64 %x, %y
112
	ret i64 %z
113
}
114

115
define i64 @udiv_exact(i64 %x, i64 %y) {
116
; CHECK: %z = udiv exact i64 %x, %y
117
	%z = udiv exact i64 %x, %y
118
	ret i64 %z
119
}
120

121
define i64 @udiv_plain(i64 %x, i64 %y) {
122
; CHECK: %z = udiv i64 %x, %y
123
	%z = udiv i64 %x, %y
124
	ret i64 %z
125
}
126

127
define i64 @ashr_plain(i64 %x, i64 %y) {
128
; CHECK: %z = ashr i64 %x, %y
129
	%z = ashr i64 %x, %y
130
	ret i64 %z
131
}
132

133
define i64 @ashr_exact(i64 %x, i64 %y) {
134
; CHECK: %z = ashr exact i64 %x, %y
135
	%z = ashr exact i64 %x, %y
136
	ret i64 %z
137
}
138

139
define i64 @lshr_plain(i64 %x, i64 %y) {
140
; CHECK: %z = lshr i64 %x, %y
141
	%z = lshr i64 %x, %y
142
	ret i64 %z
143
}
144

145
define i64 @lshr_exact(i64 %x, i64 %y) {
146
; CHECK: %z = lshr exact i64 %x, %y
147
	%z = lshr exact i64 %x, %y
148
	ret i64 %z
149
}
150

151
define ptr @gep_nw(ptr %p, i64 %x) {
152
; CHECK: %z = getelementptr inbounds i64, ptr %p, i64 %x
153
	%z = getelementptr inbounds i64, ptr %p, i64 %x
154
        ret ptr %z
155
}
156

157
define ptr @gep_plain(ptr %p, i64 %x) {
158
; CHECK: %z = getelementptr i64, ptr %p, i64 %x
159
	%z = getelementptr i64, ptr %p, i64 %x
160
        ret ptr %z
161
}
162

163
define i64 @add_both_ce() {
164
; CHECK: ret i64 add nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
165
	ret i64 add nsw nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
166
}
167

168
define i64 @sub_both_ce() {
169
; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
170
	ret i64 sub nsw nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
171
}
172

173
define i64 @mul_both_ce() {
174
; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
175
	ret i64 mul nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
176
}
177

178
define ptr @gep_nw_ce() {
179
; CHECK: ret ptr getelementptr inbounds (i64, ptr @addr, i64 171)
180
        ret ptr getelementptr inbounds (i64, ptr @addr, i64 171)
181
}
182

183
define i64 @add_plain_ce() {
184
; CHECK: ret i64 add (i64 ptrtoint (ptr @addr to i64), i64 91)
185
	ret i64 add (i64 ptrtoint (ptr @addr to i64), i64 91)
186
}
187

188
define i64 @sub_plain_ce() {
189
; CHECK: ret i64 sub (i64 ptrtoint (ptr @addr to i64), i64 91)
190
	ret i64 sub (i64 ptrtoint (ptr @addr to i64), i64 91)
191
}
192

193
define i64 @mul_plain_ce() {
194
; CHECK: ret i64 mul (i64 ptrtoint (ptr @addr to i64), i64 91)
195
	ret i64 mul (i64 ptrtoint (ptr @addr to i64), i64 91)
196
}
197

198
define ptr @gep_plain_ce() {
199
; CHECK: ret ptr getelementptr (i64, ptr @addr, i64 171)
200
        ret ptr getelementptr (i64, ptr @addr, i64 171)
201
}
202

203
define i64 @add_both_reversed_ce() {
204
; CHECK: ret i64 add nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
205
	ret i64 add nsw nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
206
}
207

208
define i64 @sub_both_reversed_ce() {
209
; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
210
	ret i64 sub nsw nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
211
}
212

213
define i64 @mul_both_reversed_ce() {
214
; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
215
	ret i64 mul nsw nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
216
}
217

218
define i64 @add_signed_ce() {
219
; CHECK: ret i64 add nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
220
	ret i64 add nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
221
}
222

223
define i64 @sub_signed_ce() {
224
; CHECK: ret i64 sub nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
225
	ret i64 sub nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
226
}
227

228
define i64 @mul_signed_ce() {
229
; CHECK: ret i64 mul nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
230
	ret i64 mul nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
231
}
232

233
define i64 @add_unsigned_ce() {
234
; CHECK: ret i64 add nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
235
	ret i64 add nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
236
}
237

238
define i64 @sub_unsigned_ce() {
239
; CHECK: ret i64 sub nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
240
	ret i64 sub nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
241
}
242

243
define i64 @mul_unsigned_ce() {
244
; CHECK: ret i64 mul nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
245
	ret i64 mul nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
246
}
247

248
define i64 @test_zext(i32 %a) {
249
; CHECK: %res = zext nneg i32 %a to i64
250
  %res = zext nneg i32 %a to i64
251
  ret i64 %res
252
}
253

254
define float @test_uitofp(i32 %a) {
255
; CHECK: %res = uitofp nneg i32 %a to float
256
  %res = uitofp nneg i32 %a to float
257
  ret float %res
258
}
259

260

261
define i64 @test_or(i64 %a, i64 %b) {
262
; CHECK: %res = or disjoint i64 %a, %b
263
  %res = or disjoint i64 %a, %b
264
  ret i64 %res
265
}
266

267
define i32 @test_trunc_signed(i64 %a) {
268
; CHECK: %res = trunc nsw i64 %a to i32
269
  %res = trunc nsw i64 %a to i32
270
  ret i32 %res
271
}
272

273
define i32 @test_trunc_unsigned(i64 %a) {
274
; CHECK: %res = trunc nuw i64 %a to i32
275
  %res = trunc nuw i64 %a to i32
276
  ret i32 %res
277
}
278

279
define i32 @test_trunc_both(i64 %a) {
280
; CHECK: %res = trunc nuw nsw i64 %a to i32
281
  %res = trunc nuw nsw i64 %a to i32
282
  ret i32 %res
283
}
284

285
define i32 @test_trunc_both_reversed(i64 %a) {
286
; CHECK: %res = trunc nuw nsw i64 %a to i32
287
  %res = trunc nsw nuw i64 %a to i32
288
  ret i32 %res
289
}
290

291
define <2 x i32> @test_trunc_signed_vector(<2 x i64> %a) {
292
; CHECK: %res = trunc nsw <2 x i64> %a to <2 x i32>
293
  %res = trunc nsw <2 x i64> %a to <2 x i32>
294
  ret <2 x i32> %res
295
}
296

297
define <2 x i32> @test_trunc_unsigned_vector(<2 x i64> %a) {
298
; CHECK: %res = trunc nuw <2 x i64> %a to <2 x i32>
299
  %res = trunc nuw <2 x i64> %a to <2 x i32>
300
  ret <2 x i32> %res
301
}
302

303
define <2 x i32> @test_trunc_both_vector(<2 x i64> %a) {
304
; CHECK: %res = trunc nuw nsw <2 x i64> %a to <2 x i32>
305
  %res = trunc nuw nsw <2 x i64> %a to <2 x i32>
306
  ret <2 x i32> %res
307
}
308

309
define <2 x i32> @test_trunc_both_reversed_vector(<2 x i64> %a) {
310
; CHECK: %res = trunc nuw nsw <2 x i64> %a to <2 x i32>
311
  %res = trunc nsw nuw <2 x i64> %a to <2 x i32>
312
  ret <2 x i32> %res
313
}
314

315
define ptr @gep_nuw(ptr %p, i64 %idx) {
316
; CHECK: %gep = getelementptr nuw i8, ptr %p, i64 %idx
317
  %gep = getelementptr nuw i8, ptr %p, i64 %idx
318
  ret ptr %gep
319
}
320

321
define ptr @gep_inbounds_nuw(ptr %p, i64 %idx) {
322
; CHECK: %gep = getelementptr inbounds nuw i8, ptr %p, i64 %idx
323
  %gep = getelementptr inbounds nuw i8, ptr %p, i64 %idx
324
  ret ptr %gep
325
}
326

327
define ptr @gep_nusw(ptr %p, i64 %idx) {
328
; CHECK: %gep = getelementptr nusw i8, ptr %p, i64 %idx
329
  %gep = getelementptr nusw i8, ptr %p, i64 %idx
330
  ret ptr %gep
331
}
332

333
; inbounds implies nusw, so the flag is not printed back.
334
define ptr @gep_inbounds_nusw(ptr %p, i64 %idx) {
335
; CHECK: %gep = getelementptr inbounds i8, ptr %p, i64 %idx
336
  %gep = getelementptr inbounds nusw i8, ptr %p, i64 %idx
337
  ret ptr %gep
338
}
339

340
define ptr @gep_nusw_nuw(ptr %p, i64 %idx) {
341
; CHECK: %gep = getelementptr nusw nuw i8, ptr %p, i64 %idx
342
  %gep = getelementptr nusw nuw i8, ptr %p, i64 %idx
343
  ret ptr %gep
344
}
345

346
define ptr @gep_inbounds_nusw_nuw(ptr %p, i64 %idx) {
347
; CHECK: %gep = getelementptr inbounds nuw i8, ptr %p, i64 %idx
348
  %gep = getelementptr inbounds nusw nuw i8, ptr %p, i64 %idx
349
  ret ptr %gep
350
}
351

352
define ptr @gep_nuw_nusw_inbounds(ptr %p, i64 %idx) {
353
; CHECK: %gep = getelementptr inbounds nuw i8, ptr %p, i64 %idx
354
  %gep = getelementptr nuw nusw inbounds i8, ptr %p, i64 %idx
355
  ret ptr %gep
356
}
357

358
define ptr addrspace(1) @gep_nusw_nuw_as1(ptr addrspace(1) %p, i64 %idx) {
359
; CHECK: %gep = getelementptr nusw nuw i8, ptr addrspace(1) %p, i64 %idx
360
  %gep = getelementptr nusw nuw i8, ptr addrspace(1) %p, i64 %idx
361
  ret ptr addrspace(1) %gep
362
}
363

364
define <2 x ptr> @gep_nusw_nuw_vec(<2 x ptr> %p, i64 %idx) {
365
; CHECK: %gep = getelementptr nusw nuw i8, <2 x ptr> %p, i64 %idx
366
  %gep = getelementptr nusw nuw i8, <2 x ptr> %p, i64 %idx
367
  ret <2 x ptr> %gep
368
}
369

370
define ptr @const_gep_nuw() {
371
; CHECK: ret ptr getelementptr nuw (i8, ptr @addr, i64 100)
372
  ret ptr getelementptr nuw (i8, ptr @addr, i64 100)
373
}
374

375
define ptr @const_gep_inbounds_nuw() {
376
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
377
  ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
378
}
379

380
define ptr @const_gep_nusw() {
381
; CHECK: ret ptr getelementptr nusw (i8, ptr @addr, i64 100)
382
  ret ptr getelementptr nusw (i8, ptr @addr, i64 100)
383
}
384

385
; inbounds implies nusw, so the flag is not printed back.
386
define ptr @const_gep_inbounds_nusw() {
387
; CHECK: ret ptr getelementptr inbounds (i8, ptr @addr, i64 100)
388
  ret ptr getelementptr inbounds nusw (i8, ptr @addr, i64 100)
389
}
390

391
define ptr @const_gep_nusw_nuw() {
392
; CHECK: ret ptr getelementptr nusw nuw (i8, ptr @addr, i64 100)
393
  ret ptr getelementptr nusw nuw (i8, ptr @addr, i64 100)
394
}
395

396
define ptr @const_gep_inbounds_nusw_nuw() {
397
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
398
  ret ptr getelementptr inbounds nusw nuw (i8, ptr @addr, i64 100)
399
}
400

401
define ptr @const_gep_nuw_nusw_inbounds() {
402
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
403
  ret ptr getelementptr nuw nusw inbounds (i8, ptr @addr, i64 100)
404
}
405

406
define ptr @const_gep_nuw_inrange() {
407
; CHECK: ret ptr getelementptr nuw inrange(-8, 16) (i8, ptr @addr, i64 100)
408
  ret ptr getelementptr nuw inrange(-8, 16) (i8, ptr @addr, i64 100)
409
}
410

411
define ptr addrspace(1) @const_gep_nusw_nuw_as1() {
412
; CHECK: ret ptr addrspace(1) getelementptr nusw nuw (i8, ptr addrspace(1) @addr_as1, i64 100)
413
  ret ptr addrspace(1) getelementptr nusw nuw (i8, ptr addrspace(1) @addr_as1, i64 100)
414
}
415

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.