llvm.org GIT mirror llvm / 82e3e48
IR: Add a broad bitcode compatibility test Successive versions of LLVM should retain the ability to parse bitcode generated by old releases of the compiler. This adds a bitcode format compatibility test, which is intended to provide good (albeit not entirely exhaustive) coverage of the current LangRef. This also includes compatibility tests for LLVM 3.6. After every 3.X.0 release, the compatibility.ll file from the 3.X branch should be copied to compatibility-3.X.ll on trunk, and the 3.X.0 release used to generate a corresponding bitcode file. Patch by Vedant Kumar! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243779 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 4 years ago
4 changed file(s) with 2482 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
504504 * The textual format is not backwards compatible. We don't change it too often,
505505 but there are no specific promises.
506506
507 * The bitcode format produced by a X.Y release will be readable by all following
508 X.Z releases and the (X+1).0 release.
507 * Additions and changes to the IR should be reflected in
508 ``test/Bitcode/compatibility.ll``.
509
510 * The bitcode format produced by a X.Y release will be readable by all
511 following X.Z releases and the (X+1).0 release. To help ensure this, an X.Y
512 version of ``test/Bitcode/compatibility.ll`` should be assembled and
513 committed after each release.
509514
510515 * Newer releases can ignore features from older releases, but they cannot
511516 miscompile them. For example, if nsw is ever replaced with something else,
0 ; Bitcode compatibility test for llvm 3.6.2
1 ;
2 ; N.b: This is 3.6.2-compatible IR. The CHECK lines occasionally differ from
3 ; the IR used to generate the bitcode, and may need to be updated. These
4 ; locations are tagged with an 'XXX'.
5
6 ; RUN: llvm-dis < %s.bc | FileCheck %s
7
8 target datalayout = "E"
9 ; CHECK: target datalayout = "E"
10
11 target triple = "x86_64-apple-macosx10.10.0"
12 ; CHECK: target triple = "x86_64-apple-macosx10.10.0"
13
14 ;; Module-level assembly
15 module asm "beep boop"
16 ; CHECK: module asm "beep boop"
17
18 ;; Comdats
19 $comdat.any = comdat any
20 ; CHECK: $comdat.any = comdat any
21 $comdat.exactmatch = comdat exactmatch
22 ; CHECK: $comdat.exactmatch = comdat exactmatch
23 $comdat.largest = comdat largest
24 ; CHECK: $comdat.largest = comdat largest
25 $comdat.noduplicates = comdat noduplicates
26 ; CHECK: $comdat.noduplicates = comdat noduplicates
27 $comdat.samesize = comdat samesize
28 ; CHECK: $comdat.samesize = comdat samesize
29
30 ; Global Variables -- comdat
31 @comdat.any = global i32 0, comdat
32 ; CHECK: @comdat.any = global i32 0, comdat
33 @comdat.exactmatch = global i32 0, comdat
34 ; CHECK: @comdat.exactmatch = global i32 0, comdat
35 @comdat.largest = global i32 0, comdat
36 ; CHECK: @comdat.largest = global i32 0, comdat
37 @comdat.noduplicates = global i32 0, comdat
38 ; CHECK: @comdat.noduplicates = global i32 0, comdat
39 @comdat.samesize = global i32 0, comdat
40 ; CHECK: @comdat.samesize = global i32 0, comdat
41
42 ;; Constants
43 @const.true = constant i1 true
44 ; CHECK: @const.true = constant i1 true
45 @const.false = constant i1 false
46 ; CHECK: @const.false = constant i1 false
47 @const.int = constant i32 zeroinitializer
48 ; CHECK: @const.int = constant i32 0
49 @const.float = constant double 0.0
50 ; CHECK: @const.float = constant double 0.0
51 @const.null = constant i8* null
52 ; CHECK: @const.null = constant i8* null
53 %const.struct.type = type { i32, i8 }
54 %const.struct.type.packed = type <{ i32, i8 }>
55 @const.struct = constant %const.struct.type { i32 -1, i8 undef }
56 ; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef }
57 @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
58 ; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
59 @const.array = constant [2 x i32] [i32 -3, i32 -4]
60 ; CHECK: @const.array = constant [2 x i32] [i32 -3, i32 -4]
61 @const.vector = constant <2 x i32>
62 ; CHECK: @const.vector = constant <2 x i32>
63
64 ;; Global Variables
65 ; Format: [@ =] [Linkage] [Visibility] [DLLStorageClass]
66 ; [ThreadLocal] [unnamed_addr] [AddrSpace] [ExternallyInitialized]
67 ; []
68 ; [, section "name"] [, align ]
69
70 ; Global Variables -- Simple
71 @g1 = global i32 0
72 ; CHECK: @g1 = global i32 0
73 @g2 = constant i32 0
74 ; CHECK: @g2 = constant i32 0
75
76 ; Global Variables -- Linkage
77 @g.private = private global i32 0
78 ; CHECK: @g.private = private global i32 0
79 @g.internal = internal global i32 0
80 ; CHECK: @g.internal = internal global i32 0
81 @g.available_externally = available_externally global i32 0
82 ; CHECK: @g.available_externally = available_externally global i32 0
83 @g.linkonce = linkonce global i32 0
84 ; CHECK: @g.linkonce = linkonce global i32 0
85 @g.weak = weak global i32 0
86 ; CHECK: @g.weak = weak global i32 0
87 @g.common = common global i32 0
88 ; CHECK: @g.common = common global i32 0
89 @g.appending = appending global [4 x i8] c"test"
90 ; CHECK: @g.appending = appending global [4 x i8] c"test"
91 @g.extern_weak = extern_weak global i32
92 ; CHECK: @g.extern_weak = extern_weak global i32
93 @g.linkonce_odr = linkonce_odr global i32 0
94 ; CHECK: @g.linkonce_odr = linkonce_odr global i32 0
95 @g.weak_odr = weak_odr global i32 0
96 ; CHECK: @g.weak_odr = weak_odr global i32 0
97 @g.external = external global i32
98 ; CHECK: @g.external = external global i32
99
100 ; Global Variables -- Visibility
101 @g.default = default global i32 0
102 ; CHECK: @g.default = global i32 0
103 @g.hidden = hidden global i32 0
104 ; CHECK: @g.hidden = hidden global i32 0
105 @g.protected = protected global i32 0
106 ; CHECK: @g.protected = protected global i32 0
107
108 ; Global Variables -- DLLStorageClass
109 @g.dlldefault = default global i32 0
110 ; CHECK: @g.dlldefault = global i32 0
111 @g.dllimport = external dllimport global i32
112 ; CHECK: @g.dllimport = external dllimport global i32
113 @g.dllexport = dllexport global i32 0
114 ; CHECK: @g.dllexport = dllexport global i32 0
115
116 ; Global Variables -- ThreadLocal
117 @g.notthreadlocal = global i32 0
118 ; CHECK: @g.notthreadlocal = global i32 0
119 @g.generaldynamic = thread_local global i32 0
120 ; CHECK: @g.generaldynamic = thread_local global i32 0
121 @g.localdynamic = thread_local(localdynamic) global i32 0
122 ; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0
123 @g.initialexec = thread_local(initialexec) global i32 0
124 ; CHECK: @g.initialexec = thread_local(initialexec) global i32 0
125 @g.localexec = thread_local(localexec) global i32 0
126 ; CHECK: @g.localexec = thread_local(localexec) global i32 0
127
128 ; Global Variables -- unnamed_addr
129 @g.unnamed_addr = unnamed_addr global i32 0
130 ; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
131
132 ; Global Variables -- AddrSpace
133 @g.addrspace = addrspace(1) global i32 0
134 ; CHECK: @g.addrspace = addrspace(1) global i32 0
135
136 ; Global Variables -- ExternallyInitialized
137 @g.externally_initialized = external externally_initialized global i32
138 ; CHECK: @g.externally_initialized = external externally_initialized global i32
139
140 ; Global Variables -- section
141 @g.section = global i32 0, section "_DATA"
142 ; CHECK: @g.section = global i32 0, section "_DATA"
143
144 ; Global Variables -- align
145 @g.align = global i32 0, align 4
146 ; CHECK: @g.align = global i32 0, align 4
147
148 ; Global Variables -- Intrinsics
149 %pri.func.data = type { i32, void ()*, i8* }
150 @g.used1 = global i32 0
151 @g.used2 = global i32 0
152 @g.used3 = global i8 0
153 declare void @g.f1()
154 @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
155 ; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
156 @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
157 ; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
158 @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
159 ; CHECK: @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
160 @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
161 ; CHECK: @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
162
163 ;; Aliases
164 ; Format: @ = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
165 ; [unnamed_addr] alias @
166
167 ; Aliases -- Linkage
168 @a.private = private alias i32* @g.private
169 ; CHECK: @a.private = private alias i32* @g.private
170 @a.internal = internal alias i32* @g.internal
171 ; CHECK: @a.internal = internal alias i32* @g.internal
172 @a.linkonce = linkonce alias i32* @g.linkonce
173 ; CHECK: @a.linkonce = linkonce alias i32* @g.linkonce
174 @a.weak = weak alias i32* @g.weak
175 ; CHECK: @a.weak = weak alias i32* @g.weak
176 @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
177 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
178 @a.weak_odr = weak_odr alias i32* @g.weak_odr
179 ; CHECK: @a.weak_odr = weak_odr alias i32* @g.weak_odr
180 @a.external = external alias i32* @g1
181 ; CHECK: @a.external = alias i32* @g1
182
183 ; Aliases -- Visibility
184 @a.default = default alias i32* @g.default
185 ; CHECK: @a.default = alias i32* @g.default
186 @a.hidden = hidden alias i32* @g.hidden
187 ; CHECK: @a.hidden = hidden alias i32* @g.hidden
188 @a.protected = protected alias i32* @g.protected
189 ; CHECK: @a.protected = protected alias i32* @g.protected
190
191 ; Aliases -- DLLStorageClass
192 @a.dlldefault = default alias i32* @g.dlldefault
193 ; CHECK: @a.dlldefault = alias i32* @g.dlldefault
194 @a.dllimport = dllimport alias i32* @g1
195 ; CHECK: @a.dllimport = dllimport alias i32* @g1
196 @a.dllexport = dllexport alias i32* @g.dllexport
197 ; CHECK: @a.dllexport = dllexport alias i32* @g.dllexport
198
199 ; Aliases -- ThreadLocal
200 @a.notthreadlocal = alias i32* @g.notthreadlocal
201 ; CHECK: @a.notthreadlocal = alias i32* @g.notthreadlocal
202 @a.generaldynamic = thread_local alias i32* @g.generaldynamic
203 ; CHECK: @a.generaldynamic = thread_local alias i32* @g.generaldynamic
204 @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
205 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
206 @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
207 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
208 @a.localexec = thread_local(localexec) alias i32* @g.localexec
209 ; CHECK: @a.localexec = thread_local(localexec) alias i32* @g.localexec
210
211 ; Aliases -- unnamed_addr
212 @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
213 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
214
215 ;; Functions
216 ; Format: define [linkage] [visibility] [DLLStorageClass]
217 ; [cconv] [ret attrs]
218 ; @ ([argument list])
219 ; [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
220 ; [align N] [gc] [prefix Constant]
221 ; { ... }
222
223 ; Functions -- Simple
224 declare void @f1 ()
225 ; CHECK: declare void @f1()
226
227 define void @f2 () {
228 ; CHECK: define void @f2()
229 entry:
230 ret void
231 }
232
233 ; Functions -- linkage
234 define private void @f.private() {
235 ; CHECK: define private void @f.private()
236 entry:
237 ret void
238 }
239 define internal void @f.internal() {
240 ; CHECK: define internal void @f.internal()
241 entry:
242 ret void
243 }
244 define available_externally void @f.available_externally() {
245 ; CHECK: define available_externally void @f.available_externally()
246 entry:
247 ret void
248 }
249 define linkonce void @f.linkonce() {
250 ; CHECK: define linkonce void @f.linkonce()
251 entry:
252 ret void
253 }
254 define weak void @f.weak() {
255 ; CHECK: define weak void @f.weak()
256 entry:
257 ret void
258 }
259 define linkonce_odr void @f.linkonce_odr() {
260 ; CHECK: define linkonce_odr void @f.linkonce_odr()
261 entry:
262 ret void
263 }
264 define weak_odr void @f.weak_odr() {
265 ; CHECK: define weak_odr void @f.weak_odr()
266 entry:
267 ret void
268 }
269 declare external void @f.external()
270 ; CHECK: declare void @f.external()
271 declare extern_weak void @f.extern_weak()
272 ; CHECK: declare extern_weak void @f.extern_weak()
273
274 ; Functions -- visibility
275 declare default void @f.default()
276 ; CHECK: declare void @f.default()
277 declare hidden void @f.hidden()
278 ; CHECK: declare hidden void @f.hidden()
279 declare protected void @f.protected()
280 ; CHECK: declare protected void @f.protected()
281
282 ; Functions -- DLLStorageClass
283 declare dllimport void @f.dllimport()
284 ; CHECK: declare dllimport void @f.dllimport()
285 declare dllexport void @f.dllexport()
286 ; CHECK: declare dllexport void @f.dllexport()
287
288 ; Functions -- cconv (Calling conventions)
289 declare ccc void @f.ccc()
290 ; CHECK: declare void @f.ccc()
291 declare fastcc void @f.fastcc()
292 ; CHECK: declare fastcc void @f.fastcc()
293 declare coldcc void @f.coldcc()
294 ; CHECK: declare coldcc void @f.coldcc()
295 declare cc10 void @f.cc10()
296 ; CHECK: declare ghccc void @f.cc10()
297 declare ghccc void @f.ghccc()
298 ; CHECK: declare ghccc void @f.ghccc()
299 declare cc11 void @f.cc11()
300 ; CHECK: declare cc11 void @f.cc11()
301 declare webkit_jscc void @f.webkit_jscc()
302 ; CHECK: declare webkit_jscc void @f.webkit_jscc()
303 declare anyregcc void @f.anyregcc()
304 ; CHECK: declare anyregcc void @f.anyregcc()
305 declare preserve_mostcc void @f.preserve_mostcc()
306 ; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
307 declare preserve_allcc void @f.preserve_allcc()
308 ; CHECK: declare preserve_allcc void @f.preserve_allcc()
309 declare cc64 void @f.cc64()
310 ; CHECK: declare x86_stdcallcc void @f.cc64()
311 declare x86_stdcallcc void @f.x86_stdcallcc()
312 ; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
313 declare cc65 void @f.cc65()
314 ; CHECK: declare x86_fastcallcc void @f.cc65()
315 declare x86_fastcallcc void @f.x86_fastcallcc()
316 ; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
317 declare cc66 void @f.cc66()
318 ; CHECK: declare arm_apcscc void @f.cc66()
319 declare arm_apcscc void @f.arm_apcscc()
320 ; CHECK: declare arm_apcscc void @f.arm_apcscc()
321 declare cc67 void @f.cc67()
322 ; CHECK: declare arm_aapcscc void @f.cc67()
323 declare arm_aapcscc void @f.arm_aapcscc()
324 ; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
325 declare cc68 void @f.cc68()
326 ; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
327 declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
328 ; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
329 declare cc69 void @f.cc69()
330 ; CHECK: declare msp430_intrcc void @f.cc69()
331 declare msp430_intrcc void @f.msp430_intrcc()
332 ; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
333 declare cc70 void @f.cc70()
334 ; CHECK: declare x86_thiscallcc void @f.cc70()
335 declare x86_thiscallcc void @f.x86_thiscallcc()
336 ; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
337 declare cc71 void @f.cc71()
338 ; CHECK: declare ptx_kernel void @f.cc71()
339 declare ptx_kernel void @f.ptx_kernel()
340 ; CHECK: declare ptx_kernel void @f.ptx_kernel()
341 declare cc72 void @f.cc72()
342 ; CHECK: declare ptx_device void @f.cc72()
343 declare ptx_device void @f.ptx_device()
344 ; CHECK: declare ptx_device void @f.ptx_device()
345 declare cc75 void @f.cc75()
346 ; CHECK: declare spir_func void @f.cc75()
347 declare spir_func void @f.spir_func()
348 ; CHECK: declare spir_func void @f.spir_func()
349 declare cc76 void @f.cc76()
350 ; CHECK: declare spir_kernel void @f.cc76()
351 declare spir_kernel void @f.spir_kernel()
352 ; CHECK: declare spir_kernel void @f.spir_kernel()
353 declare cc77 void @f.cc77()
354 ; CHECK: declare intel_ocl_bicc void @f.cc77()
355 declare intel_ocl_bicc void @f.intel_ocl_bicc()
356 ; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
357 declare cc78 void @f.cc78()
358 ; CHECK: declare x86_64_sysvcc void @f.cc78()
359 declare x86_64_sysvcc void @f.x86_64_sysvcc()
360 ; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
361 declare cc79 void @f.cc79()
362 ; CHECK: declare x86_64_win64cc void @f.cc79()
363 declare x86_64_win64cc void @f.x86_64_win64cc()
364 ; CHECK: declare x86_64_win64cc void @f.x86_64_win64cc()
365 declare cc80 void @f.cc80()
366 ; CHECK: declare x86_vectorcallcc void @f.cc80()
367 declare x86_vectorcallcc void @f.x86_vectorcallcc()
368 ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
369 declare cc8191 void @f.cc8191()
370 ; CHECK: declare cc8191 void @f.cc8191()
371
372 ; Functions -- ret attrs (Return attributes)
373 declare zeroext i64 @f.zeroext()
374 ; CHECK: declare zeroext i64 @f.zeroext()
375 declare signext i64 @f.signext()
376 ; CHECK: declare signext i64 @f.signext()
377 declare inreg i32* @f.inreg()
378 ; CHECK: declare inreg i32* @f.inreg()
379 declare noalias i32* @f.noalias()
380 ; CHECK: declare noalias i32* @f.noalias()
381 declare nonnull i32* @f.nonnull()
382 ; CHECK: declare nonnull i32* @f.nonnull()
383 declare dereferenceable(4) i32* @f.dereferenceable4()
384 ; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
385 declare dereferenceable(8) i32* @f.dereferenceable8()
386 ; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
387 declare dereferenceable(16) i32* @f.dereferenceable16()
388 ; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
389
390 ; Functions -- Parameter attributes
391 declare void @f.param.zeroext(i8 zeroext)
392 ; CHECK: declare void @f.param.zeroext(i8 zeroext)
393 declare void @f.param.signext(i8 signext)
394 ; CHECK: declare void @f.param.signext(i8 signext)
395 declare void @f.param.inreg(i8 inreg)
396 ; CHECK: declare void @f.param.inreg(i8 inreg)
397 declare void @f.param.byval({ i8, i8 }* byval)
398 ; CHECK: declare void @f.param.byval({ i8, i8 }* byval)
399 declare void @f.param.inalloca(i8* inalloca)
400 ; CHECK: declare void @f.param.inalloca(i8* inalloca)
401 declare void @f.param.sret(i8* sret)
402 ; CHECK: declare void @f.param.sret(i8* sret)
403 declare void @f.param.noalias(i8* noalias)
404 ; CHECK: declare void @f.param.noalias(i8* noalias)
405 declare void @f.param.nocapture(i8* nocapture)
406 ; CHECK: declare void @f.param.nocapture(i8* nocapture)
407 declare void @f.param.nest(i8* nest)
408 ; CHECK: declare void @f.param.nest(i8* nest)
409 declare i8* @f.param.returned(i8* returned)
410 ; CHECK: declare i8* @f.param.returned(i8* returned)
411 declare void @f.param.nonnull(i8* nonnull)
412 ; CHECK: declare void @f.param.nonnull(i8* nonnull)
413 declare void @f.param.dereferenceable(i8* dereferenceable(4))
414 ; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
415
416 ; Functions -- unnamed_addr
417 declare void @f.unnamed_addr() unnamed_addr
418 ; CHECK: declare void @f.unnamed_addr() unnamed_addr
419
420 ; Functions -- fn Attrs (Function attributes)
421 declare void @f.alignstack4() alignstack(4)
422 ; CHECK: declare void @f.alignstack4() #0
423 declare void @f.alignstack8() alignstack(8)
424 ; CHECK: declare void @f.alignstack8() #1
425 declare void @f.alwaysinline() alwaysinline
426 ; CHECK: declare void @f.alwaysinline() #2
427 declare void @f.cold() cold
428 ; CHECK: declare void @f.cold() #3
429 declare void @f.inlinehint() inlinehint
430 ; CHECK: declare void @f.inlinehint() #4
431 declare void @f.jumptable() unnamed_addr jumptable
432 ; CHECK: declare void @f.jumptable() unnamed_addr #5
433 declare void @f.minsize() minsize
434 ; CHECK: declare void @f.minsize() #6
435 declare void @f.naked() naked
436 ; CHECK: declare void @f.naked() #7
437 declare void @f.nobuiltin() nobuiltin
438 ; CHECK: declare void @f.nobuiltin() #8
439 declare void @f.noduplicate() noduplicate
440 ; CHECK: declare void @f.noduplicate() #9
441 declare void @f.noimplicitfloat() noimplicitfloat
442 ; CHECK: declare void @f.noimplicitfloat() #10
443 declare void @f.noinline() noinline
444 ; CHECK: declare void @f.noinline() #11
445 declare void @f.nonlazybind() nonlazybind
446 ; CHECK: declare void @f.nonlazybind() #12
447 declare void @f.noredzone() noredzone
448 ; CHECK: declare void @f.noredzone() #13
449 declare void @f.noreturn() noreturn
450 ; CHECK: declare void @f.noreturn() #14
451 declare void @f.nounwind() nounwind
452 ; CHECK: declare void @f.nounwind() #15
453 declare void @f.optnone() noinline optnone
454 ; CHECK: declare void @f.optnone() #16
455 declare void @f.optsize() optsize
456 ; CHECK: declare void @f.optsize() #17
457 declare void @f.readnone() readnone
458 ; CHECK: declare void @f.readnone() #18
459 declare void @f.readonly() readonly
460 ; CHECK: declare void @f.readonly() #19
461 declare void @f.returns_twice() returns_twice
462 ; CHECK: declare void @f.returns_twice() #20
463 declare void @f.sanitize_address() sanitize_address
464 ; CHECK: declare void @f.sanitize_address() #21
465 declare void @f.sanitize_memory() sanitize_memory
466 ; CHECK: declare void @f.sanitize_memory() #22
467 declare void @f.sanitize_thread() sanitize_thread
468 ; CHECK: declare void @f.sanitize_thread() #23
469 declare void @f.ssp() ssp
470 ; CHECK: declare void @f.ssp() #24
471 declare void @f.sspreq() sspreq
472 ; CHECK: declare void @f.sspreq() #25
473 declare void @f.sspstrong() sspstrong
474 ; CHECK: declare void @f.sspstrong() #26
475 declare void @f.uwtable() uwtable
476 ; CHECK: declare void @f.uwtable() #27
477 declare void @f.kvpair() "cpu"="cortex-a8"
478 ; CHECK:declare void @f.kvpair() #28
479
480 ; Functions -- section
481 declare void @f.section() section "80"
482 ; CHECK: declare void @f.section() section "80"
483
484 ; Functions -- comdat
485 define void @f.comdat_any() comdat($comdat.any) {
486 ; CHECK: define void @f.comdat_any() comdat($comdat.any)
487 entry:
488 ret void
489 }
490 define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
491 ; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
492 entry:
493 ret void
494 }
495 define void @f.comdat_largest() comdat($comdat.largest) {
496 ; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
497 entry:
498 ret void
499 }
500 define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
501 ; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
502 entry:
503 ret void
504 }
505 define void @f.comdat_samesize() comdat($comdat.samesize) {
506 ; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
507 entry:
508 ret void
509 }
510
511 ; Functions -- align
512 declare void @f.align2() align 2
513 ; CHECK: declare void @f.align2() align 2
514 declare void @f.align4() align 4
515 ; CHECK: declare void @f.align4() align 4
516 declare void @f.align8() align 8
517 ; CHECK: declare void @f.align8() align 8
518
519 ; Functions -- GC
520 declare void @f.gcshadow() gc "shadow-stack"
521 ; CHECK: declare void @f.gcshadow() gc "shadow-stack"
522
523 ; Functions -- Prefix data
524 declare void @f.prefixi32() prefix i32 1684365668
525 ; CHECK: declare void @f.prefixi32() prefix i32 1684365668
526 declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
527 ; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
528
529 ;; Atomic Memory Ordering Constraints
530 define void @atomics(i32* %word) {
531 %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
532 ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
533 %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
534 ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
535 %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
536 ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
537 %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
538 ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
539 %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
540 ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
541 %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
542 ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
543 %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
544 ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
545 %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
546 ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
547 %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
548 ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
549 %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
550 ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
551 %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
552 ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
553 %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
554 ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
555 %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
556 ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
557 %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
558 ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
559 %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
560 ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
561 %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
562 ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
563 %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
564 ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
565 %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
566 ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
567 %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
568 ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
569 fence acquire
570 ; CHECK: fence acquire
571 fence release
572 ; CHECK: fence release
573 fence acq_rel
574 ; CHECK: fence acq_rel
575 fence singlethread seq_cst
576 ; CHECK: fence singlethread seq_cst
577
578 ; XXX: The parser spits out the load type here.
579 %ld.1 = load atomic i32* %word monotonic, align 4
580 ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
581 %ld.2 = load atomic volatile i32* %word acquire, align 8
582 ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
583 %ld.3 = load atomic volatile i32* %word singlethread seq_cst, align 16
584 ; CHECK: %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
585
586 store atomic i32 23, i32* %word monotonic, align 4
587 ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
588 store atomic volatile i32 24, i32* %word monotonic, align 4
589 ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
590 store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
591 ; CHECK: store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
592 ret void
593 }
594
595 ;; Fast Math Flags
596 define void @fastmathflags(float %op1, float %op2) {
597 %f.nnan = fadd nnan float %op1, %op2
598 ; CHECK: %f.nnan = fadd nnan float %op1, %op2
599 %f.ninf = fadd ninf float %op1, %op2
600 ; CHECK: %f.ninf = fadd ninf float %op1, %op2
601 %f.nsz = fadd nsz float %op1, %op2
602 ; CHECK: %f.nsz = fadd nsz float %op1, %op2
603 %f.arcp = fadd arcp float %op1, %op2
604 ; CHECK: %f.arcp = fadd arcp float %op1, %op2
605 %f.fast = fadd fast float %op1, %op2
606 ; CHECK: %f.fast = fadd fast float %op1, %op2
607 ret void
608 }
609
610 ;; Type System
611 %opaquety = type opaque
612 define void @typesystem() {
613 %p0 = bitcast i8* null to i32 (i32)*
614 ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
615 %p1 = bitcast i8* null to void (i8*)*
616 ; CHECK: %p1 = bitcast i8* null to void (i8*)*
617 %p2 = bitcast i8* null to i32 (i8*, ...)*
618 ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
619 %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
620 ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
621 %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
622 ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
623 %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
624 ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
625
626 %t0 = alloca i1942652
627 ; CHECK: %t0 = alloca i1942652
628 %t1 = alloca half
629 ; CHECK: %t1 = alloca half
630 %t2 = alloca float
631 ; CHECK: %t2 = alloca float
632 %t3 = alloca double
633 ; CHECK: %t3 = alloca double
634 %t4 = alloca fp128
635 ; CHECK: %t4 = alloca fp128
636 %t5 = alloca x86_fp80
637 ; CHECK: %t5 = alloca x86_fp80
638 %t6 = alloca ppc_fp128
639 ; CHECK: %t6 = alloca ppc_fp128
640 %t7 = alloca x86_mmx
641 ; CHECK: %t7 = alloca x86_mmx
642 %t8 = alloca %opaquety*
643 ; CHECK: %t8 = alloca %opaquety*
644
645 ret void
646 }
647
648 ;; Inline Assembler Expressions
649 define void @inlineasm(i32 %arg) {
650 call i32 asm "bswap $0", "=r,r"(i32 %arg)
651 ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
652 call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
653 ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
654 ret void
655 }
656
657 ;; Instructions
658
659 ; Instructions -- Terminators
660 define void @instructions.terminators(i8 %val) { ; XXX: landingpad changed.
661 ; CHECK: define void @instructions.terminators(i8 %val) personality i32 ()* @personality_handler
662
663 br i1 false, label %iftrue, label %iffalse
664 ; CHECK: br i1 false, label %iftrue, label %iffalse
665 br label %iftrue
666 ; CHECK: br label %iftrue
667 iftrue:
668 ret void
669 ; CHECK: ret void
670 iffalse:
671
672 switch i8 %val, label %defaultdest [
673 ; CHECK: switch i8 %val, label %defaultdest [
674 i8 0, label %defaultdest.0
675 ; CHECK: i8 0, label %defaultdest.0
676 i8 1, label %defaultdest.1
677 ; CHECK: i8 1, label %defaultdest.1
678 i8 2, label %defaultdest.2
679 ; CHECK: i8 2, label %defaultdest.2
680 ]
681 ; CHECK: ]
682 defaultdest:
683 ret void
684 defaultdest.0:
685 ret void
686 defaultdest.1:
687 ret void
688 defaultdest.2:
689
690 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
691 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
692 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
693 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
694
695 invoke fastcc void @f.fastcc()
696 ; CHECK: invoke fastcc void @f.fastcc()
697 to label %defaultdest unwind label %exc
698 ; CHECK: to label %defaultdest unwind label %exc
699 exc:
700 %cleanup = landingpad i32 personality i32()* @personality_handler cleanup
701
702 resume i32 undef
703 ; CHECK: resume i32 undef
704 unreachable
705 ; CHECK: unreachable
706
707 ret void
708 }
709
710 ; Instructions -- Binary Operations
711 define void @instructions.binops(i8 %op1, i8 %op2) {
712 ; nuw x nsw
713 add i8 %op1, %op2
714 ; CHECK: add i8 %op1, %op2
715 add nuw i8 %op1, %op2
716 ; CHECK: add nuw i8 %op1, %op2
717 add nsw i8 %op1, %op2
718 ; CHECK: add nsw i8 %op1, %op2
719 add nuw nsw i8 %op1, %op2
720 ; CHECK: add nuw nsw i8 %op1, %op2
721 sub i8 %op1, %op2
722 ; CHECK: sub i8 %op1, %op2
723 sub nuw i8 %op1, %op2
724 ; CHECK: sub nuw i8 %op1, %op2
725 sub nsw i8 %op1, %op2
726 ; CHECK: sub nsw i8 %op1, %op2
727 sub nuw nsw i8 %op1, %op2
728 ; CHECK: sub nuw nsw i8 %op1, %op2
729 mul i8 %op1, %op2
730 ; CHECK: mul i8 %op1, %op2
731 mul nuw i8 %op1, %op2
732 ; CHECK: mul nuw i8 %op1, %op2
733 mul nsw i8 %op1, %op2
734 ; CHECK: mul nsw i8 %op1, %op2
735 mul nuw nsw i8 %op1, %op2
736 ; CHECK: mul nuw nsw i8 %op1, %op2
737
738 ; exact
739 udiv i8 %op1, %op2
740 ; CHECK: udiv i8 %op1, %op2
741 udiv exact i8 %op1, %op2
742 ; CHECK: udiv exact i8 %op1, %op2
743 sdiv i8 %op1, %op2
744 ; CHECK: sdiv i8 %op1, %op2
745 sdiv exact i8 %op1, %op2
746 ; CHECK: sdiv exact i8 %op1, %op2
747
748 ; none
749 urem i8 %op1, %op2
750 ; CHECK: urem i8 %op1, %op2
751 srem i8 %op1, %op2
752 ; CHECK: srem i8 %op1, %op2
753
754 ret void
755 }
756
757 ; Instructions -- Bitwise Binary Operations
758 define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
759 ; nuw x nsw
760 shl i8 %op1, %op2
761 ; CHECK: shl i8 %op1, %op2
762 shl nuw i8 %op1, %op2
763 ; CHECK: shl nuw i8 %op1, %op2
764 shl nsw i8 %op1, %op2
765 ; CHECK: shl nsw i8 %op1, %op2
766 shl nuw nsw i8 %op1, %op2
767 ; CHECK: shl nuw nsw i8 %op1, %op2
768
769 ; exact
770 lshr i8 %op1, %op2
771 ; CHECK: lshr i8 %op1, %op2
772 lshr exact i8 %op1, %op2
773 ; CHECK: lshr exact i8 %op1, %op2
774 ashr i8 %op1, %op2
775 ; CHECK: ashr i8 %op1, %op2
776 ashr exact i8 %op1, %op2
777 ; CHECK: ashr exact i8 %op1, %op2
778
779 ; none
780 and i8 %op1, %op2
781 ; CHECK: and i8 %op1, %op2
782 or i8 %op1, %op2
783 ; CHECK: or i8 %op1, %op2
784 xor i8 %op1, %op2
785 ; CHECK: xor i8 %op1, %op2
786
787 ret void
788 }
789
790 ; Instructions -- Vector Operations
791 define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
792 extractelement <4 x float> %vec, i8 0
793 ; CHECK: extractelement <4 x float> %vec, i8 0
794 insertelement <4 x float> %vec, float 3.500000e+00, i8 0
795 ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
796 shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
797 ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
798
799 ret void
800 }
801
802 ; Instructions -- Aggregate Operations
803 define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
804 [3 x i8] %arr, { i8, { i32 }} %n,
805 <2 x i8*> %pvec, <2 x i64> %offsets) {
806 extractvalue { i8, i32 } %up, 0
807 ; CHECK: extractvalue { i8, i32 } %up, 0
808 extractvalue <{ i8, i32 }> %p, 1
809 ; CHECK: extractvalue <{ i8, i32 }> %p, 1
810 extractvalue [3 x i8] %arr, 2
811 ; CHECK: extractvalue [3 x i8] %arr, 2
812 extractvalue { i8, { i32 } } %n, 1, 0
813 ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
814
815 insertvalue { i8, i32 } %up, i8 1, 0
816 ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
817 insertvalue <{ i8, i32 }> %p, i32 2, 1
818 ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
819 insertvalue [3 x i8] %arr, i8 0, 0
820 ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
821 insertvalue { i8, { i32 } } %n, i32 0, 1, 0
822 ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
823
824 %up.ptr = alloca { i8, i32 }
825 %p.ptr = alloca <{ i8, i32 }>
826 %arr.ptr = alloca [3 x i8]
827 %n.ptr = alloca { i8, { i32 } }
828
829 ; XXX: The parser spits out the load type here.
830 getelementptr { i8, i32 }* %up.ptr, i8 0
831 ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
832 getelementptr <{ i8, i32 }>* %p.ptr, i8 1
833 ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
834 getelementptr [3 x i8]* %arr.ptr, i8 2
835 ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
836 getelementptr { i8, { i32 } }* %n.ptr, i32 0, i32 1
837 ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
838 getelementptr inbounds { i8, { i32 } }* %n.ptr, i32 1, i32 0
839 ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
840 getelementptr <2 x i8*> %pvec, <2 x i64> %offsets
841 ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
842
843 ret void
844 }
845
846 ; Instructions -- Memory Access and Addressing Operations
847 !7 = !{i32 1}
848 !8 = !{}
849 !9 = !{i64 4}
850 define void @instructions.memops(i32** %base) {
851 alloca i32, i8 4, align 4
852 ; CHECK: alloca i32, i8 4, align 4
853 alloca inalloca i32, i8 4, align 4
854 ; CHECK: alloca inalloca i32, i8 4, align 4
855
856 load i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
857 ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
858 load volatile i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
859 ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
860
861 store i32* null, i32** %base, align 4, !nontemporal !8
862 ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
863 store volatile i32* null, i32** %base, align 4, !nontemporal !8
864 ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
865
866 ret void
867 }
868
869 ; Instructions -- Conversion Operations
870 define void @instructions.conversions() {
871 trunc i32 -1 to i1
872 ; CHECK: trunc i32 -1 to i1
873 zext i32 -1 to i64
874 ; CHECK: zext i32 -1 to i64
875 sext i32 -1 to i64
876 ; CHECK: sext i32 -1 to i64
877 fptrunc float undef to half
878 ; CHECK: fptrunc float undef to half
879 fpext half undef to float
880 ; CHECK: fpext half undef to float
881 fptoui float undef to i32
882 ; CHECK: fptoui float undef to i32
883 fptosi float undef to i32
884 ; CHECK: fptosi float undef to i32
885 uitofp i32 1 to float
886 ; CHECK: uitofp i32 1 to float
887 sitofp i32 -1 to float
888 ; CHECK: sitofp i32 -1 to float
889 ptrtoint i8* null to i64
890 ; CHECK: ptrtoint i8* null to i64
891 inttoptr i64 0 to i8*
892 ; CHECK: inttoptr i64 0 to i8*
893 bitcast i32 0 to i32
894 ; CHECK: bitcast i32 0 to i32
895 addrspacecast i32* null to i32 addrspace(1)*
896 ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
897
898 ret void
899 }
900
901 ; Instructions -- Other Operations
902 define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
903 entry:
904 icmp eq i32 %op1, %op2
905 ; CHECK: icmp eq i32 %op1, %op2
906 icmp ne i32 %op1, %op2
907 ; CHECK: icmp ne i32 %op1, %op2
908 icmp ugt i32 %op1, %op2
909 ; CHECK: icmp ugt i32 %op1, %op2
910 icmp uge i32 %op1, %op2
911 ; CHECK: icmp uge i32 %op1, %op2
912 icmp ult i32 %op1, %op2
913 ; CHECK: icmp ult i32 %op1, %op2
914 icmp ule i32 %op1, %op2
915 ; CHECK: icmp ule i32 %op1, %op2
916 icmp sgt i32 %op1, %op2
917 ; CHECK: icmp sgt i32 %op1, %op2
918 icmp sge i32 %op1, %op2
919 ; CHECK: icmp sge i32 %op1, %op2
920 icmp slt i32 %op1, %op2
921 ; CHECK: icmp slt i32 %op1, %op2
922 icmp sle i32 %op1, %op2
923 ; CHECK: icmp sle i32 %op1, %op2
924
925 fcmp false half %fop1, %fop2
926 ; CHECK: fcmp false half %fop1, %fop2
927 fcmp oeq half %fop1, %fop2
928 ; CHECK: fcmp oeq half %fop1, %fop2
929 fcmp ogt half %fop1, %fop2
930 ; CHECK: fcmp ogt half %fop1, %fop2
931 fcmp oge half %fop1, %fop2
932 ; CHECK: fcmp oge half %fop1, %fop2
933 fcmp olt half %fop1, %fop2
934 ; CHECK: fcmp olt half %fop1, %fop2
935 fcmp ole half %fop1, %fop2
936 ; CHECK: fcmp ole half %fop1, %fop2
937 fcmp one half %fop1, %fop2
938 ; CHECK: fcmp one half %fop1, %fop2
939 fcmp ord half %fop1, %fop2
940 ; CHECK: fcmp ord half %fop1, %fop2
941 fcmp ueq half %fop1, %fop2
942 ; CHECK: fcmp ueq half %fop1, %fop2
943 fcmp ugt half %fop1, %fop2
944 ; CHECK: fcmp ugt half %fop1, %fop2
945 fcmp uge half %fop1, %fop2
946 ; CHECK: fcmp uge half %fop1, %fop2
947 fcmp ult half %fop1, %fop2
948 ; CHECK: fcmp ult half %fop1, %fop2
949 fcmp ule half %fop1, %fop2
950 ; CHECK: fcmp ule half %fop1, %fop2
951 fcmp une half %fop1, %fop2
952 ; CHECK: fcmp une half %fop1, %fop2
953 fcmp uno half %fop1, %fop2
954 ; CHECK: fcmp uno half %fop1, %fop2
955 fcmp true half %fop1, %fop2
956 ; CHECK: fcmp true half %fop1, %fop2
957
958 br label %exit
959 L1:
960 %v1 = add i32 %op1, %op2
961 br label %exit
962 L2:
963 %v2 = add i32 %op1, %op2
964 br label %exit
965 exit:
966 phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
967 ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
968
969 select i1 true, i32 0, i32 1
970 ; CHECK: select i1 true, i32 0, i32 1
971 select <2 x i1> , <2 x i8> , <2 x i8>
972 ; CHECK: select <2 x i1> , <2 x i8> , <2 x i8>
973
974 call void @f.nobuiltin() builtin
975 ; CHECK: call void @f.nobuiltin() #31
976
977 call fastcc noalias i32* @f.noalias() noinline
978 ; CHECK: call fastcc noalias i32* @f.noalias() #11
979 tail call ghccc nonnull i32* @f.nonnull() minsize
980 ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #6
981
982 ret void
983 }
984
985 define void @instructions.call_musttail(i8* inalloca %val) {
986 musttail call void @f.param.inalloca(i8* inalloca %val)
987 ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
988
989 ret void
990 }
991
992 declare void @llvm.donothing() nounwind readnone
993
994 declare i32 @personality_handler()
995
996 define void @instructions.landingpad() {
997 ; CHECK: define void @instructions.landingpad() personality i32 ()* @personality_handler
998
999 invoke void @llvm.donothing() to label %proceed unwind label %catch1
1000 invoke void @llvm.donothing() to label %proceed unwind label %catch2
1001 invoke void @llvm.donothing() to label %proceed unwind label %catch3
1002 invoke void @llvm.donothing() to label %proceed unwind label %catch4
1003
1004 catch1:
1005 landingpad i32
1006 ; CHECK: landingpad i32
1007 personality i32()* @personality_handler
1008 cleanup
1009 ; CHECK: cleanup
1010 br label %proceed
1011
1012 catch2:
1013 landingpad i32
1014 ; CHECK: landingpad i32
1015 personality i32()* @personality_handler
1016 cleanup
1017 ; CHECK: cleanup
1018 catch i32* null
1019 ; CHECK: catch i32* null
1020 br label %proceed
1021
1022 catch3:
1023 landingpad i32
1024 ; CHECK: landingpad i32
1025 personality i32()* @personality_handler
1026 cleanup
1027 ; CHECK: cleanup
1028 catch i32* null
1029 ; CHECK: catch i32* null
1030 catch i32* null
1031 ; CHECK: catch i32* null
1032 br label %proceed
1033
1034 catch4:
1035 landingpad i32
1036 ; CHECK: landingpad i32
1037 personality i32()* @personality_handler
1038 filter [2 x i32] zeroinitializer
1039 ; CHECK: filter [2 x i32] zeroinitializer
1040 br label %proceed
1041
1042 proceed:
1043 ret void
1044 }
1045
1046 ;; Intrinsic Functions
1047
1048 ; Intrinsic Functions -- Variable Argument Handling
1049 declare void @llvm.va_start(i8*)
1050 declare void @llvm.va_copy(i8*, i8*)
1051 declare void @llvm.va_end(i8*)
1052 define void @instructions.va_arg(i8* %v, ...) {
1053 %ap = alloca i8*
1054 %ap2 = bitcast i8** %ap to i8*
1055
1056 call void @llvm.va_start(i8* %ap2)
1057 ; CHECK: call void @llvm.va_start(i8* %ap2)
1058
1059 va_arg i8* %ap2, i32
1060 ; CHECK: va_arg i8* %ap2, i32
1061
1062 call void @llvm.va_copy(i8* %v, i8* %ap2)
1063 ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
1064
1065 call void @llvm.va_end(i8* %ap2)
1066 ; CHECK: call void @llvm.va_end(i8* %ap2)
1067
1068 ret void
1069 }
1070
1071 ; Intrinsic Functions -- Accurate Garbage Collection
1072 declare void @llvm.gcroot(i8**, i8*)
1073 declare i8* @llvm.gcread(i8*, i8**)
1074 declare void @llvm.gcwrite(i8*, i8*, i8**)
1075 define void @intrinsics.gc() gc "shadow-stack" {
1076 %ptrloc = alloca i8*
1077 call void @llvm.gcroot(i8** %ptrloc, i8* null)
1078 ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
1079
1080 call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1081 ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1082
1083 %ref = alloca i8
1084 call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1085 ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1086
1087 ret void
1088 }
1089
1090 ; Intrinsic Functions -- Code Generation
1091 declare i8* @llvm.returnaddress(i32)
1092 declare i8* @llvm.frameaddress(i32)
1093 declare i32 @llvm.read_register.i32(metadata)
1094 declare i64 @llvm.read_register.i64(metadata)
1095 declare void @llvm.write_register.i32(metadata, i32)
1096 declare void @llvm.write_register.i64(metadata, i64)
1097 declare i8* @llvm.stacksave()
1098 declare void @llvm.stackrestore(i8*)
1099 declare void @llvm.prefetch(i8*, i32, i32, i32)
1100 declare void @llvm.pcmarker(i32)
1101 declare i64 @llvm.readcyclecounter()
1102 declare void @llvm.clear_cache(i8*, i8*)
1103 declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
1104
1105 !10 = !{!"rax"}
1106 define void @intrinsics.codegen() {
1107 call i8* @llvm.returnaddress(i32 1)
1108 ; CHECK: call i8* @llvm.returnaddress(i32 1)
1109 call i8* @llvm.frameaddress(i32 1)
1110 ; CHECK: call i8* @llvm.frameaddress(i32 1)
1111
1112 call i32 @llvm.read_register.i32(metadata !10)
1113 ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
1114 call i64 @llvm.read_register.i64(metadata !10)
1115 ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
1116 call void @llvm.write_register.i32(metadata !10, i32 0)
1117 ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
1118 call void @llvm.write_register.i64(metadata !10, i64 0)
1119 ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
1120
1121 %stack = call i8* @llvm.stacksave()
1122 ; CHECK: %stack = call i8* @llvm.stacksave()
1123 call void @llvm.stackrestore(i8* %stack)
1124 ; CHECK: call void @llvm.stackrestore(i8* %stack)
1125
1126 call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1127 ; CHECK: call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1128
1129 call void @llvm.pcmarker(i32 1)
1130 ; CHECK: call void @llvm.pcmarker(i32 1)
1131
1132 call i64 @llvm.readcyclecounter()
1133 ; CHECK: call i64 @llvm.readcyclecounter()
1134
1135 call void @llvm.clear_cache(i8* null, i8* null)
1136 ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
1137
1138 call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1139 ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1140
1141 ret void
1142 }
1143
1144 ; CHECK: attributes #0 = { alignstack=4 }
1145 ; CHECK: attributes #1 = { alignstack=8 }
1146 ; CHECK: attributes #2 = { alwaysinline }
1147 ; CHECK: attributes #3 = { cold }
1148 ; CHECK: attributes #4 = { inlinehint }
1149 ; CHECK: attributes #5 = { jumptable }
1150 ; CHECK: attributes #6 = { minsize }
1151 ; CHECK: attributes #7 = { naked }
1152 ; CHECK: attributes #8 = { nobuiltin }
1153 ; CHECK: attributes #9 = { noduplicate }
1154 ; CHECK: attributes #10 = { noimplicitfloat }
1155 ; CHECK: attributes #11 = { noinline }
1156 ; CHECK: attributes #12 = { nonlazybind }
1157 ; CHECK: attributes #13 = { noredzone }
1158 ; CHECK: attributes #14 = { noreturn }
1159 ; CHECK: attributes #15 = { nounwind }
1160 ; CHECK: attributes #16 = { noinline optnone }
1161 ; CHECK: attributes #17 = { optsize }
1162 ; CHECK: attributes #18 = { readnone }
1163 ; CHECK: attributes #19 = { readonly }
1164 ; CHECK: attributes #20 = { returns_twice }
1165 ; CHECK: attributes #21 = { sanitize_address }
1166 ; CHECK: attributes #22 = { sanitize_memory }
1167 ; CHECK: attributes #23 = { sanitize_thread }
1168 ; CHECK: attributes #24 = { ssp }
1169 ; CHECK: attributes #25 = { sspreq }
1170 ; CHECK: attributes #26 = { sspstrong }
1171 ; CHECK: attributes #27 = { uwtable }
1172 ; CHECK: attributes #28 = { "cpu"="cortex-a8" }
1173 ; CHECK: attributes #31 = { builtin }
1174
1175 ;; Metadata
1176
1177 ; Metadata -- Module flags
1178 !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1179 ; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1180
1181 !0 = !{i32 1, !"mod1", i32 0}
1182 ; CHECK: !0 = !{i32 1, !"mod1", i32 0}
1183 !1 = !{i32 2, !"mod2", i32 0}
1184 ; CHECK: !1 = !{i32 2, !"mod2", i32 0}
1185 !2 = !{i32 3, !"mod3", !3}
1186 ; CHECK: !2 = !{i32 3, !"mod3", !3}
1187 !3 = !{!"mod6", !0}
1188 ; CHECK: !3 = !{!"mod6", !0}
1189 !4 = !{i32 4, !"mod4", i32 0}
1190 ; CHECK: !4 = !{i32 4, !"mod4", i32 0}
1191 !5 = !{i32 5, !"mod5", !0}
1192 ; CHECK: !5 = !{i32 5, !"mod5", !0}
1193 !6 = !{i32 6, !"mod6", !0}
1194 ; CHECK: !6 = !{i32 6, !"mod6", !0}
0 ; Bitcode compatibility test for llvm
1 ;
2 ; Please update this file when making any IR changes. Information on the
3 ; release process for this file is available here:
4 ;
5 ; http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility
6
7 ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
8 ; RUN: verify-uselistorder < %s
9
10 target datalayout = "E"
11 ; CHECK: target datalayout = "E"
12
13 target triple = "x86_64-apple-macosx10.10.0"
14 ; CHECK: target triple = "x86_64-apple-macosx10.10.0"
15
16 ;; Module-level assembly
17 module asm "beep boop"
18 ; CHECK: module asm "beep boop"
19
20 ;; Comdats
21 $comdat.any = comdat any
22 ; CHECK: $comdat.any = comdat any
23 $comdat.exactmatch = comdat exactmatch
24 ; CHECK: $comdat.exactmatch = comdat exactmatch
25 $comdat.largest = comdat largest
26 ; CHECK: $comdat.largest = comdat largest
27 $comdat.noduplicates = comdat noduplicates
28 ; CHECK: $comdat.noduplicates = comdat noduplicates
29 $comdat.samesize = comdat samesize
30 ; CHECK: $comdat.samesize = comdat samesize
31
32 ;; Constants
33 @const.true = constant i1 true
34 ; CHECK: @const.true = constant i1 true
35 @const.false = constant i1 false
36 ; CHECK: @const.false = constant i1 false
37 @const.int = constant i32 zeroinitializer
38 ; CHECK: @const.int = constant i32 0
39 @const.float = constant double 0.0
40 ; CHECK: @const.float = constant double 0.0
41 @const.null = constant i8* null
42 ; CHECK: @const.null = constant i8* null
43 %const.struct.type = type { i32, i8 }
44 %const.struct.type.packed = type <{ i32, i8 }>
45 @const.struct = constant %const.struct.type { i32 -1, i8 undef }
46 ; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef }
47 @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
48 ; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
49 @const.array = constant [2 x i32] [i32 -3, i32 -4]
50 ; CHECK: @const.array = constant [2 x i32] [i32 -3, i32 -4]
51 @const.vector = constant <2 x i32>
52 ; CHECK: @const.vector = constant <2 x i32>
53
54 ;; Global Variables
55 ; Format: [@ =] [Linkage] [Visibility] [DLLStorageClass]
56 ; [ThreadLocal] [unnamed_addr] [AddrSpace] [ExternallyInitialized]
57 ; []
58 ; [, section "name"] [, comdat [($name)]] [, align ]
59
60 ; Global Variables -- Simple
61 @g1 = global i32 0
62 ; CHECK: @g1 = global i32 0
63 @g2 = constant i32 0
64 ; CHECK: @g2 = constant i32 0
65
66 ; Global Variables -- Linkage
67 @g.private = private global i32 0
68 ; CHECK: @g.private = private global i32 0
69 @g.internal = internal global i32 0
70 ; CHECK: @g.internal = internal global i32 0
71 @g.available_externally = available_externally global i32 0
72 ; CHECK: @g.available_externally = available_externally global i32 0
73 @g.linkonce = linkonce global i32 0
74 ; CHECK: @g.linkonce = linkonce global i32 0
75 @g.weak = weak global i32 0
76 ; CHECK: @g.weak = weak global i32 0
77 @g.common = common global i32 0
78 ; CHECK: @g.common = common global i32 0
79 @g.appending = appending global [4 x i8] c"test"
80 ; CHECK: @g.appending = appending global [4 x i8] c"test"
81 @g.extern_weak = extern_weak global i32
82 ; CHECK: @g.extern_weak = extern_weak global i32
83 @g.linkonce_odr = linkonce_odr global i32 0
84 ; CHECK: @g.linkonce_odr = linkonce_odr global i32 0
85 @g.weak_odr = weak_odr global i32 0
86 ; CHECK: @g.weak_odr = weak_odr global i32 0
87 @g.external = external global i32
88 ; CHECK: @g.external = external global i32
89
90 ; Global Variables -- Visibility
91 @g.default = default global i32 0
92 ; CHECK: @g.default = global i32 0
93 @g.hidden = hidden global i32 0
94 ; CHECK: @g.hidden = hidden global i32 0
95 @g.protected = protected global i32 0
96 ; CHECK: @g.protected = protected global i32 0
97
98 ; Global Variables -- DLLStorageClass
99 @g.dlldefault = default global i32 0
100 ; CHECK: @g.dlldefault = global i32 0
101 @g.dllimport = external dllimport global i32
102 ; CHECK: @g.dllimport = external dllimport global i32
103 @g.dllexport = dllexport global i32 0
104 ; CHECK: @g.dllexport = dllexport global i32 0
105
106 ; Global Variables -- ThreadLocal
107 @g.notthreadlocal = global i32 0
108 ; CHECK: @g.notthreadlocal = global i32 0
109 @g.generaldynamic = thread_local global i32 0
110 ; CHECK: @g.generaldynamic = thread_local global i32 0
111 @g.localdynamic = thread_local(localdynamic) global i32 0
112 ; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0
113 @g.initialexec = thread_local(initialexec) global i32 0
114 ; CHECK: @g.initialexec = thread_local(initialexec) global i32 0
115 @g.localexec = thread_local(localexec) global i32 0
116 ; CHECK: @g.localexec = thread_local(localexec) global i32 0
117
118 ; Global Variables -- unnamed_addr
119 @g.unnamed_addr = unnamed_addr global i32 0
120 ; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
121
122 ; Global Variables -- AddrSpace
123 @g.addrspace = addrspace(1) global i32 0
124 ; CHECK: @g.addrspace = addrspace(1) global i32 0
125
126 ; Global Variables -- ExternallyInitialized
127 @g.externally_initialized = external externally_initialized global i32
128 ; CHECK: @g.externally_initialized = external externally_initialized global i32
129
130 ; Global Variables -- section
131 @g.section = global i32 0, section "_DATA"
132 ; CHECK: @g.section = global i32 0, section "_DATA"
133
134 ; Global Variables -- comdat
135 @comdat.any = global i32 0, comdat
136 ; CHECK: @comdat.any = global i32 0, comdat
137 @comdat.exactmatch = global i32 0, comdat
138 ; CHECK: @comdat.exactmatch = global i32 0, comdat
139 @comdat.largest = global i32 0, comdat
140 ; CHECK: @comdat.largest = global i32 0, comdat
141 @comdat.noduplicates = global i32 0, comdat
142 ; CHECK: @comdat.noduplicates = global i32 0, comdat
143 @comdat.samesize = global i32 0, comdat
144 ; CHECK: @comdat.samesize = global i32 0, comdat
145
146 ; Force two globals from different comdats into sections with the same name.
147 $comdat1 = comdat any
148 $comdat2 = comdat any
149 @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
150 ; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
151 @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
152 ; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
153
154 ; Global Variables -- align
155 @g.align = global i32 0, align 4
156 ; CHECK: @g.align = global i32 0, align 4
157
158 ; Global Variables -- Intrinsics
159 %pri.func.data = type { i32, void ()*, i8* }
160 @g.used1 = global i32 0
161 @g.used2 = global i32 0
162 @g.used3 = global i8 0
163 declare void @g.f1()
164 @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
165 ; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
166 @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
167 ; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
168 @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
169 ; CHECK: @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
170 @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
171 ; CHECK: @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
172
173 ;; Aliases
174 ; Format: @ = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
175 ; [unnamed_addr] alias @
176
177 ; Aliases -- Linkage
178 @a.private = private alias i32* @g.private
179 ; CHECK: @a.private = private alias i32* @g.private
180 @a.internal = internal alias i32* @g.internal
181 ; CHECK: @a.internal = internal alias i32* @g.internal
182 @a.linkonce = linkonce alias i32* @g.linkonce
183 ; CHECK: @a.linkonce = linkonce alias i32* @g.linkonce
184 @a.weak = weak alias i32* @g.weak
185 ; CHECK: @a.weak = weak alias i32* @g.weak
186 @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
187 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
188 @a.weak_odr = weak_odr alias i32* @g.weak_odr
189 ; CHECK: @a.weak_odr = weak_odr alias i32* @g.weak_odr
190 @a.external = external alias i32* @g1
191 ; CHECK: @a.external = alias i32* @g1
192
193 ; Aliases -- Visibility
194 @a.default = default alias i32* @g.default
195 ; CHECK: @a.default = alias i32* @g.default
196 @a.hidden = hidden alias i32* @g.hidden
197 ; CHECK: @a.hidden = hidden alias i32* @g.hidden
198 @a.protected = protected alias i32* @g.protected
199 ; CHECK: @a.protected = protected alias i32* @g.protected
200
201 ; Aliases -- DLLStorageClass
202 @a.dlldefault = default alias i32* @g.dlldefault
203 ; CHECK: @a.dlldefault = alias i32* @g.dlldefault
204 @a.dllimport = dllimport alias i32* @g1
205 ; CHECK: @a.dllimport = dllimport alias i32* @g1
206 @a.dllexport = dllexport alias i32* @g.dllexport
207 ; CHECK: @a.dllexport = dllexport alias i32* @g.dllexport
208
209 ; Aliases -- ThreadLocal
210 @a.notthreadlocal = alias i32* @g.notthreadlocal
211 ; CHECK: @a.notthreadlocal = alias i32* @g.notthreadlocal
212 @a.generaldynamic = thread_local alias i32* @g.generaldynamic
213 ; CHECK: @a.generaldynamic = thread_local alias i32* @g.generaldynamic
214 @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
215 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
216 @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
217 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
218 @a.localexec = thread_local(localexec) alias i32* @g.localexec
219 ; CHECK: @a.localexec = thread_local(localexec) alias i32* @g.localexec
220
221 ; Aliases -- unnamed_addr
222 @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
223 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
224
225 ;; Functions
226 ; Format: define [linkage] [visibility] [DLLStorageClass]
227 ; [cconv] [ret attrs]
228 ; @ ([argument list])
229 ; [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
230 ; [align N] [gc] [prefix Constant] [prologue Constant]
231 ; [personality Constant] { ... }
232
233 ; Functions -- Simple
234 declare void @f1 ()
235 ; CHECK: declare void @f1()
236
237 define void @f2 () {
238 ; CHECK: define void @f2()
239 entry:
240 ret void
241 }
242
243 ; Functions -- linkage
244 define private void @f.private() {
245 ; CHECK: define private void @f.private()
246 entry:
247 ret void
248 }
249 define internal void @f.internal() {
250 ; CHECK: define internal void @f.internal()
251 entry:
252 ret void
253 }
254 define available_externally void @f.available_externally() {
255 ; CHECK: define available_externally void @f.available_externally()
256 entry:
257 ret void
258 }
259 define linkonce void @f.linkonce() {
260 ; CHECK: define linkonce void @f.linkonce()
261 entry:
262 ret void
263 }
264 define weak void @f.weak() {
265 ; CHECK: define weak void @f.weak()
266 entry:
267 ret void
268 }
269 define linkonce_odr void @f.linkonce_odr() {
270 ; CHECK: define linkonce_odr void @f.linkonce_odr()
271 entry:
272 ret void
273 }
274 define weak_odr void @f.weak_odr() {
275 ; CHECK: define weak_odr void @f.weak_odr()
276 entry:
277 ret void
278 }
279 declare external void @f.external()
280 ; CHECK: declare void @f.external()
281 declare extern_weak void @f.extern_weak()
282 ; CHECK: declare extern_weak void @f.extern_weak()
283
284 ; Functions -- visibility
285 declare default void @f.default()
286 ; CHECK: declare void @f.default()
287 declare hidden void @f.hidden()
288 ; CHECK: declare hidden void @f.hidden()
289 declare protected void @f.protected()
290 ; CHECK: declare protected void @f.protected()
291
292 ; Functions -- DLLStorageClass
293 declare dllimport void @f.dllimport()
294 ; CHECK: declare dllimport void @f.dllimport()
295 declare dllexport void @f.dllexport()
296 ; CHECK: declare dllexport void @f.dllexport()
297
298 ; Functions -- cconv (Calling conventions)
299 declare ccc void @f.ccc()
300 ; CHECK: declare void @f.ccc()
301 declare fastcc void @f.fastcc()
302 ; CHECK: declare fastcc void @f.fastcc()
303 declare coldcc void @f.coldcc()
304 ; CHECK: declare coldcc void @f.coldcc()
305 declare cc10 void @f.cc10()
306 ; CHECK: declare ghccc void @f.cc10()
307 declare ghccc void @f.ghccc()
308 ; CHECK: declare ghccc void @f.ghccc()
309 declare cc11 void @f.cc11()
310 ; CHECK: declare cc11 void @f.cc11()
311 declare webkit_jscc void @f.webkit_jscc()
312 ; CHECK: declare webkit_jscc void @f.webkit_jscc()
313 declare anyregcc void @f.anyregcc()
314 ; CHECK: declare anyregcc void @f.anyregcc()
315 declare preserve_mostcc void @f.preserve_mostcc()
316 ; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
317 declare preserve_allcc void @f.preserve_allcc()
318 ; CHECK: declare preserve_allcc void @f.preserve_allcc()
319 declare cc64 void @f.cc64()
320 ; CHECK: declare x86_stdcallcc void @f.cc64()
321 declare x86_stdcallcc void @f.x86_stdcallcc()
322 ; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
323 declare cc65 void @f.cc65()
324 ; CHECK: declare x86_fastcallcc void @f.cc65()
325 declare x86_fastcallcc void @f.x86_fastcallcc()
326 ; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
327 declare cc66 void @f.cc66()
328 ; CHECK: declare arm_apcscc void @f.cc66()
329 declare arm_apcscc void @f.arm_apcscc()
330 ; CHECK: declare arm_apcscc void @f.arm_apcscc()
331 declare cc67 void @f.cc67()
332 ; CHECK: declare arm_aapcscc void @f.cc67()
333 declare arm_aapcscc void @f.arm_aapcscc()
334 ; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
335 declare cc68 void @f.cc68()
336 ; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
337 declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
338 ; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
339 declare cc69 void @f.cc69()
340 ; CHECK: declare msp430_intrcc void @f.cc69()
341 declare msp430_intrcc void @f.msp430_intrcc()
342 ; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
343 declare cc70 void @f.cc70()
344 ; CHECK: declare x86_thiscallcc void @f.cc70()
345 declare x86_thiscallcc void @f.x86_thiscallcc()
346 ; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
347 declare cc71 void @f.cc71()
348 ; CHECK: declare ptx_kernel void @f.cc71()
349 declare ptx_kernel void @f.ptx_kernel()
350 ; CHECK: declare ptx_kernel void @f.ptx_kernel()
351 declare cc72 void @f.cc72()
352 ; CHECK: declare ptx_device void @f.cc72()
353 declare ptx_device void @f.ptx_device()
354 ; CHECK: declare ptx_device void @f.ptx_device()
355 declare cc75 void @f.cc75()
356 ; CHECK: declare spir_func void @f.cc75()
357 declare spir_func void @f.spir_func()
358 ; CHECK: declare spir_func void @f.spir_func()
359 declare cc76 void @f.cc76()
360 ; CHECK: declare spir_kernel void @f.cc76()
361 declare spir_kernel void @f.spir_kernel()
362 ; CHECK: declare spir_kernel void @f.spir_kernel()
363 declare cc77 void @f.cc77()
364 ; CHECK: declare intel_ocl_bicc void @f.cc77()
365 declare intel_ocl_bicc void @f.intel_ocl_bicc()
366 ; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
367 declare cc78 void @f.cc78()
368 ; CHECK: declare x86_64_sysvcc void @f.cc78()
369 declare x86_64_sysvcc void @f.x86_64_sysvcc()
370 ; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
371 declare cc79 void @f.cc79()
372 ; CHECK: declare x86_64_win64cc void @f.cc79()
373 declare x86_64_win64cc void @f.x86_64_win64cc()
374 ; CHECK: declare x86_64_win64cc void @f.x86_64_win64cc()
375 declare cc80 void @f.cc80()
376 ; CHECK: declare x86_vectorcallcc void @f.cc80()
377 declare x86_vectorcallcc void @f.x86_vectorcallcc()
378 ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
379 declare cc8191 void @f.cc8191()
380 ; CHECK: declare cc8191 void @f.cc8191()
381
382 ; Functions -- ret attrs (Return attributes)
383 declare zeroext i64 @f.zeroext()
384 ; CHECK: declare zeroext i64 @f.zeroext()
385 declare signext i64 @f.signext()
386 ; CHECK: declare signext i64 @f.signext()
387 declare inreg i32* @f.inreg()
388 ; CHECK: declare inreg i32* @f.inreg()
389 declare noalias i32* @f.noalias()
390 ; CHECK: declare noalias i32* @f.noalias()
391 declare nonnull i32* @f.nonnull()
392 ; CHECK: declare nonnull i32* @f.nonnull()
393 declare dereferenceable(4) i32* @f.dereferenceable4()
394 ; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
395 declare dereferenceable(8) i32* @f.dereferenceable8()
396 ; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
397 declare dereferenceable(16) i32* @f.dereferenceable16()
398 ; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
399 declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
400 ; CHECK: declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
401 declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
402 ; CHECK: declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
403 declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
404 ; CHECK: declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
405
406 ; Functions -- Parameter attributes
407 declare void @f.param.zeroext(i8 zeroext)
408 ; CHECK: declare void @f.param.zeroext(i8 zeroext)
409 declare void @f.param.signext(i8 signext)
410 ; CHECK: declare void @f.param.signext(i8 signext)
411 declare void @f.param.inreg(i8 inreg)
412 ; CHECK: declare void @f.param.inreg(i8 inreg)
413 declare void @f.param.byval({ i8, i8 }* byval)
414 ; CHECK: declare void @f.param.byval({ i8, i8 }* byval)
415 declare void @f.param.inalloca(i8* inalloca)
416 ; CHECK: declare void @f.param.inalloca(i8* inalloca)
417 declare void @f.param.sret(i8* sret)
418 ; CHECK: declare void @f.param.sret(i8* sret)
419 declare void @f.param.noalias(i8* noalias)
420 ; CHECK: declare void @f.param.noalias(i8* noalias)
421 declare void @f.param.nocapture(i8* nocapture)
422 ; CHECK: declare void @f.param.nocapture(i8* nocapture)
423 declare void @f.param.nest(i8* nest)
424 ; CHECK: declare void @f.param.nest(i8* nest)
425 declare i8* @f.param.returned(i8* returned)
426 ; CHECK: declare i8* @f.param.returned(i8* returned)
427 declare void @f.param.nonnull(i8* nonnull)
428 ; CHECK: declare void @f.param.nonnull(i8* nonnull)
429 declare void @f.param.dereferenceable(i8* dereferenceable(4))
430 ; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
431 declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
432 ; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
433
434 ; Functions -- unnamed_addr
435 declare void @f.unnamed_addr() unnamed_addr
436 ; CHECK: declare void @f.unnamed_addr() unnamed_addr
437
438 ; Functions -- fn Attrs (Function attributes)
439 declare void @f.alignstack4() alignstack(4)
440 ; CHECK: declare void @f.alignstack4() #0
441 declare void @f.alignstack8() alignstack(8)
442 ; CHECK: declare void @f.alignstack8() #1
443 declare void @f.alwaysinline() alwaysinline
444 ; CHECK: declare void @f.alwaysinline() #2
445 declare void @f.cold() cold
446 ; CHECK: declare void @f.cold() #3
447 declare void @f.convergent() convergent
448 ; CHECK: declare void @f.convergent() #4
449 declare void @f.inlinehint() inlinehint
450 ; CHECK: declare void @f.inlinehint() #5
451 declare void @f.jumptable() unnamed_addr jumptable
452 ; CHECK: declare void @f.jumptable() unnamed_addr #6
453 declare void @f.minsize() minsize
454 ; CHECK: declare void @f.minsize() #7
455 declare void @f.naked() naked
456 ; CHECK: declare void @f.naked() #8
457 declare void @f.nobuiltin() nobuiltin
458 ; CHECK: declare void @f.nobuiltin() #9
459 declare void @f.noduplicate() noduplicate
460 ; CHECK: declare void @f.noduplicate() #10
461 declare void @f.noimplicitfloat() noimplicitfloat
462 ; CHECK: declare void @f.noimplicitfloat() #11
463 declare void @f.noinline() noinline
464 ; CHECK: declare void @f.noinline() #12
465 declare void @f.nonlazybind() nonlazybind
466 ; CHECK: declare void @f.nonlazybind() #13
467 declare void @f.noredzone() noredzone
468 ; CHECK: declare void @f.noredzone() #14
469 declare void @f.noreturn() noreturn
470 ; CHECK: declare void @f.noreturn() #15
471 declare void @f.nounwind() nounwind
472 ; CHECK: declare void @f.nounwind() #16
473 declare void @f.optnone() noinline optnone
474 ; CHECK: declare void @f.optnone() #17
475 declare void @f.optsize() optsize
476 ; CHECK: declare void @f.optsize() #18
477 declare void @f.readnone() readnone
478 ; CHECK: declare void @f.readnone() #19
479 declare void @f.readonly() readonly
480 ; CHECK: declare void @f.readonly() #20
481 declare void @f.returns_twice() returns_twice
482 ; CHECK: declare void @f.returns_twice() #21
483 declare void @f.safestack() safestack
484 ; CHECK: declare void @f.safestack() #22
485 declare void @f.sanitize_address() sanitize_address
486 ; CHECK: declare void @f.sanitize_address() #23
487 declare void @f.sanitize_memory() sanitize_memory
488 ; CHECK: declare void @f.sanitize_memory() #24
489 declare void @f.sanitize_thread() sanitize_thread
490 ; CHECK: declare void @f.sanitize_thread() #25
491 declare void @f.ssp() ssp
492 ; CHECK: declare void @f.ssp() #26
493 declare void @f.sspreq() sspreq
494 ; CHECK: declare void @f.sspreq() #27
495 declare void @f.sspstrong() sspstrong
496 ; CHECK: declare void @f.sspstrong() #28
497 declare void @f.thunk() "thunk"
498 ; CHECK: declare void @f.thunk() #29
499 declare void @f.uwtable() uwtable
500 ; CHECK: declare void @f.uwtable() #30
501 declare void @f.kvpair() "cpu"="cortex-a8"
502 ; CHECK:declare void @f.kvpair() #31
503
504 ; Functions -- section
505 declare void @f.section() section "80"
506 ; CHECK: declare void @f.section() section "80"
507
508 ; Functions -- comdat
509 define void @f.comdat_any() comdat($comdat.any) {
510 ; CHECK: define void @f.comdat_any() comdat($comdat.any)
511 entry:
512 ret void
513 }
514 define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
515 ; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
516 entry:
517 ret void
518 }
519 define void @f.comdat_largest() comdat($comdat.largest) {
520 ; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
521 entry:
522 ret void
523 }
524 define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
525 ; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
526 entry:
527 ret void
528 }
529 define void @f.comdat_samesize() comdat($comdat.samesize) {
530 ; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
531 entry:
532 ret void
533 }
534
535 ; Functions -- align
536 declare void @f.align2() align 2
537 ; CHECK: declare void @f.align2() align 2
538 declare void @f.align4() align 4
539 ; CHECK: declare void @f.align4() align 4
540 declare void @f.align8() align 8
541 ; CHECK: declare void @f.align8() align 8
542
543 ; Functions -- GC
544 declare void @f.gcshadow() gc "shadow-stack"
545 ; CHECK: declare void @f.gcshadow() gc "shadow-stack"
546
547 ; Functions -- Prefix data
548 declare void @f.prefixi32() prefix i32 1684365668
549 ; CHECK: declare void @f.prefixi32() prefix i32 1684365668
550 declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
551 ; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
552
553 ; Functions -- Prologue data
554 declare void @f.prologuei32() prologue i32 1684365669
555 ; CHECK: declare void @f.prologuei32() prologue i32 1684365669
556 declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
557 ; CHECK: declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
558
559 ; Functions -- Personality constant
560 declare void @llvm.donothing() nounwind readnone
561 ; CHECK: declare void @llvm.donothing() #32
562 define void @f.no_personality() personality i8 3 {
563 ; CHECK: define void @f.no_personality() personality i8 3
564 invoke void @llvm.donothing() to label %normal unwind label %exception
565 exception:
566 %cleanup = landingpad i8 cleanup
567 br label %normal
568 normal:
569 ret void
570 }
571
572 declare i32 @f.personality_handler()
573 ; CHECK: declare i32 @f.personality_handler()
574 define void @f.personality() personality i32 ()* @f.personality_handler {
575 ; CHECK: define void @f.personality() personality i32 ()* @f.personality_handler
576 invoke void @llvm.donothing() to label %normal unwind label %exception
577 exception:
578 %cleanup = landingpad i32 cleanup
579 br label %normal
580 normal:
581 ret void
582 }
583
584 ;; Atomic Memory Ordering Constraints
585 define void @atomics(i32* %word) {
586 %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
587 ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
588 %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
589 ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
590 %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
591 ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
592 %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
593 ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
594 %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
595 ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
596 %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
597 ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
598 %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
599 ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
600 %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
601 ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
602 %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
603 ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
604 %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
605 ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
606 %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
607 ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
608 %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
609 ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
610 %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
611 ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
612 %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
613 ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
614 %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
615 ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
616 %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
617 ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
618 %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
619 ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
620 %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
621 ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
622 %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
623 ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
624 fence acquire
625 ; CHECK: fence acquire
626 fence release
627 ; CHECK: fence release
628 fence acq_rel
629 ; CHECK: fence acq_rel
630 fence singlethread seq_cst
631 ; CHECK: fence singlethread seq_cst
632
633 %ld.1 = load atomic i32, i32* %word monotonic, align 4
634 ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
635 %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
636 ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
637 %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
638 ; CHECK: %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
639
640 store atomic i32 23, i32* %word monotonic, align 4
641 ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
642 store atomic volatile i32 24, i32* %word monotonic, align 4
643 ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
644 store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
645 ; CHECK: store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
646 ret void
647 }
648
649 ;; Fast Math Flags
650 define void @fastmathflags(float %op1, float %op2) {
651 %f.nnan = fadd nnan float %op1, %op2
652 ; CHECK: %f.nnan = fadd nnan float %op1, %op2
653 %f.ninf = fadd ninf float %op1, %op2
654 ; CHECK: %f.ninf = fadd ninf float %op1, %op2
655 %f.nsz = fadd nsz float %op1, %op2
656 ; CHECK: %f.nsz = fadd nsz float %op1, %op2
657 %f.arcp = fadd arcp float %op1, %op2
658 ; CHECK: %f.arcp = fadd arcp float %op1, %op2
659 %f.fast = fadd fast float %op1, %op2
660 ; CHECK: %f.fast = fadd fast float %op1, %op2
661 ret void
662 }
663
664 ;; Type System
665 %opaquety = type opaque
666 define void @typesystem() {
667 %p0 = bitcast i8* null to i32 (i32)*
668 ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
669 %p1 = bitcast i8* null to void (i8*)*
670 ; CHECK: %p1 = bitcast i8* null to void (i8*)*
671 %p2 = bitcast i8* null to i32 (i8*, ...)*
672 ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
673 %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
674 ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
675 %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
676 ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
677 %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
678 ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
679
680 %t0 = alloca i1942652
681 ; CHECK: %t0 = alloca i1942652
682 %t1 = alloca half
683 ; CHECK: %t1 = alloca half
684 %t2 = alloca float
685 ; CHECK: %t2 = alloca float
686 %t3 = alloca double
687 ; CHECK: %t3 = alloca double
688 %t4 = alloca fp128
689 ; CHECK: %t4 = alloca fp128
690 %t5 = alloca x86_fp80
691 ; CHECK: %t5 = alloca x86_fp80
692 %t6 = alloca ppc_fp128
693 ; CHECK: %t6 = alloca ppc_fp128
694 %t7 = alloca x86_mmx
695 ; CHECK: %t7 = alloca x86_mmx
696 %t8 = alloca %opaquety*
697 ; CHECK: %t8 = alloca %opaquety*
698
699 ret void
700 }
701
702 ;; Inline Assembler Expressions
703 define void @inlineasm(i32 %arg) {
704 call i32 asm "bswap $0", "=r,r"(i32 %arg)
705 ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
706 call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
707 ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
708 ret void
709 }
710
711 ;; Instructions
712
713 ; Instructions -- Terminators
714 define void @instructions.terminators(i8 %val) personality i32 -10 {
715 br i1 false, label %iftrue, label %iffalse
716 ; CHECK: br i1 false, label %iftrue, label %iffalse
717 br label %iftrue
718 ; CHECK: br label %iftrue
719 iftrue:
720 ret void
721 ; CHECK: ret void
722 iffalse:
723
724 switch i8 %val, label %defaultdest [
725 ; CHECK: switch i8 %val, label %defaultdest [
726 i8 0, label %defaultdest.0
727 ; CHECK: i8 0, label %defaultdest.0
728 i8 1, label %defaultdest.1
729 ; CHECK: i8 1, label %defaultdest.1
730 i8 2, label %defaultdest.2
731 ; CHECK: i8 2, label %defaultdest.2
732 ]
733 ; CHECK: ]
734 defaultdest:
735 ret void
736 defaultdest.0:
737 ret void
738 defaultdest.1:
739 ret void
740 defaultdest.2:
741
742 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
743 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
744 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
745 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
746
747 invoke fastcc void @f.fastcc()
748 ; CHECK: invoke fastcc void @f.fastcc()
749 to label %defaultdest unwind label %exc
750 ; CHECK: to label %defaultdest unwind label %exc
751 exc:
752 %cleanup = landingpad i32 cleanup
753
754 resume i32 undef
755 ; CHECK: resume i32 undef
756 unreachable
757 ; CHECK: unreachable
758
759 ret void
760 }
761
762 ; Instructions -- Binary Operations
763 define void @instructions.binops(i8 %op1, i8 %op2) {
764 ; nuw x nsw
765 add i8 %op1, %op2
766 ; CHECK: add i8 %op1, %op2
767 add nuw i8 %op1, %op2
768 ; CHECK: add nuw i8 %op1, %op2
769 add nsw i8 %op1, %op2
770 ; CHECK: add nsw i8 %op1, %op2
771 add nuw nsw i8 %op1, %op2
772 ; CHECK: add nuw nsw i8 %op1, %op2
773 sub i8 %op1, %op2
774 ; CHECK: sub i8 %op1, %op2
775 sub nuw i8 %op1, %op2
776 ; CHECK: sub nuw i8 %op1, %op2
777 sub nsw i8 %op1, %op2
778 ; CHECK: sub nsw i8 %op1, %op2
779 sub nuw nsw i8 %op1, %op2
780 ; CHECK: sub nuw nsw i8 %op1, %op2
781 mul i8 %op1, %op2
782 ; CHECK: mul i8 %op1, %op2
783 mul nuw i8 %op1, %op2
784 ; CHECK: mul nuw i8 %op1, %op2
785 mul nsw i8 %op1, %op2
786 ; CHECK: mul nsw i8 %op1, %op2
787 mul nuw nsw i8 %op1, %op2
788 ; CHECK: mul nuw nsw i8 %op1, %op2
789
790 ; exact
791 udiv i8 %op1, %op2
792 ; CHECK: udiv i8 %op1, %op2
793 udiv exact i8 %op1, %op2
794 ; CHECK: udiv exact i8 %op1, %op2
795 sdiv i8 %op1, %op2
796 ; CHECK: sdiv i8 %op1, %op2
797 sdiv exact i8 %op1, %op2
798 ; CHECK: sdiv exact i8 %op1, %op2
799
800 ; none
801 urem i8 %op1, %op2
802 ; CHECK: urem i8 %op1, %op2
803 srem i8 %op1, %op2
804 ; CHECK: srem i8 %op1, %op2
805
806 ret void
807 }
808
809 ; Instructions -- Bitwise Binary Operations
810 define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
811 ; nuw x nsw
812 shl i8 %op1, %op2
813 ; CHECK: shl i8 %op1, %op2
814 shl nuw i8 %op1, %op2
815 ; CHECK: shl nuw i8 %op1, %op2
816 shl nsw i8 %op1, %op2
817 ; CHECK: shl nsw i8 %op1, %op2
818 shl nuw nsw i8 %op1, %op2
819 ; CHECK: shl nuw nsw i8 %op1, %op2
820
821 ; exact
822 lshr i8 %op1, %op2
823 ; CHECK: lshr i8 %op1, %op2
824 lshr exact i8 %op1, %op2
825 ; CHECK: lshr exact i8 %op1, %op2
826 ashr i8 %op1, %op2
827 ; CHECK: ashr i8 %op1, %op2
828 ashr exact i8 %op1, %op2
829 ; CHECK: ashr exact i8 %op1, %op2
830
831 ; none
832 and i8 %op1, %op2
833 ; CHECK: and i8 %op1, %op2
834 or i8 %op1, %op2
835 ; CHECK: or i8 %op1, %op2
836 xor i8 %op1, %op2
837 ; CHECK: xor i8 %op1, %op2
838
839 ret void
840 }
841
842 ; Instructions -- Vector Operations
843 define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
844 extractelement <4 x float> %vec, i8 0
845 ; CHECK: extractelement <4 x float> %vec, i8 0
846 insertelement <4 x float> %vec, float 3.500000e+00, i8 0
847 ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
848 shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
849 ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
850
851 ret void
852 }
853
854 ; Instructions -- Aggregate Operations
855 define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
856 [3 x i8] %arr, { i8, { i32 }} %n,
857 <2 x i8*> %pvec, <2 x i64> %offsets) {
858 extractvalue { i8, i32 } %up, 0
859 ; CHECK: extractvalue { i8, i32 } %up, 0
860 extractvalue <{ i8, i32 }> %p, 1
861 ; CHECK: extractvalue <{ i8, i32 }> %p, 1
862 extractvalue [3 x i8] %arr, 2
863 ; CHECK: extractvalue [3 x i8] %arr, 2
864 extractvalue { i8, { i32 } } %n, 1, 0
865 ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
866
867 insertvalue { i8, i32 } %up, i8 1, 0
868 ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
869 insertvalue <{ i8, i32 }> %p, i32 2, 1
870 ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
871 insertvalue [3 x i8] %arr, i8 0, 0
872 ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
873 insertvalue { i8, { i32 } } %n, i32 0, 1, 0
874 ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
875
876 %up.ptr = alloca { i8, i32 }
877 %p.ptr = alloca <{ i8, i32 }>
878 %arr.ptr = alloca [3 x i8]
879 %n.ptr = alloca { i8, { i32 } }
880
881 getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
882 ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
883 getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
884 ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
885 getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
886 ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
887 getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
888 ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
889 getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
890 ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
891 getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
892 ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
893
894 ret void
895 }
896
897 ; Instructions -- Memory Access and Addressing Operations
898 !7 = !{i32 1}
899 !8 = !{}
900 !9 = !{i64 4}
901 define void @instructions.memops(i32** %base) {
902 alloca i32, i8 4, align 4
903 ; CHECK: alloca i32, i8 4, align 4
904 alloca inalloca i32, i8 4, align 4
905 ; CHECK: alloca inalloca i32, i8 4, align 4
906
907 load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
908 ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
909 load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
910 ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
911
912 store i32* null, i32** %base, align 4, !nontemporal !8
913 ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
914 store volatile i32* null, i32** %base, align 4, !nontemporal !8
915 ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
916
917 ret void
918 }
919
920 ; Instructions -- Conversion Operations
921 define void @instructions.conversions() {
922 trunc i32 -1 to i1
923 ; CHECK: trunc i32 -1 to i1
924 zext i32 -1 to i64
925 ; CHECK: zext i32 -1 to i64
926 sext i32 -1 to i64
927 ; CHECK: sext i32 -1 to i64
928 fptrunc float undef to half
929 ; CHECK: fptrunc float undef to half
930 fpext half undef to float
931 ; CHECK: fpext half undef to float
932 fptoui float undef to i32
933 ; CHECK: fptoui float undef to i32
934 fptosi float undef to i32
935 ; CHECK: fptosi float undef to i32
936 uitofp i32 1 to float
937 ; CHECK: uitofp i32 1 to float
938 sitofp i32 -1 to float
939 ; CHECK: sitofp i32 -1 to float
940 ptrtoint i8* null to i64
941 ; CHECK: ptrtoint i8* null to i64
942 inttoptr i64 0 to i8*
943 ; CHECK: inttoptr i64 0 to i8*
944 bitcast i32 0 to i32
945 ; CHECK: bitcast i32 0 to i32
946 addrspacecast i32* null to i32 addrspace(1)*
947 ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
948
949 ret void
950 }
951
952 ; Instructions -- Other Operations
953 define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
954 entry:
955 icmp eq i32 %op1, %op2
956 ; CHECK: icmp eq i32 %op1, %op2
957 icmp ne i32 %op1, %op2
958 ; CHECK: icmp ne i32 %op1, %op2
959 icmp ugt i32 %op1, %op2
960 ; CHECK: icmp ugt i32 %op1, %op2
961 icmp uge i32 %op1, %op2
962 ; CHECK: icmp uge i32 %op1, %op2
963 icmp ult i32 %op1, %op2
964 ; CHECK: icmp ult i32 %op1, %op2
965 icmp ule i32 %op1, %op2
966 ; CHECK: icmp ule i32 %op1, %op2
967 icmp sgt i32 %op1, %op2
968 ; CHECK: icmp sgt i32 %op1, %op2
969 icmp sge i32 %op1, %op2
970 ; CHECK: icmp sge i32 %op1, %op2
971 icmp slt i32 %op1, %op2
972 ; CHECK: icmp slt i32 %op1, %op2
973 icmp sle i32 %op1, %op2
974 ; CHECK: icmp sle i32 %op1, %op2
975
976 fcmp false half %fop1, %fop2
977 ; CHECK: fcmp false half %fop1, %fop2
978 fcmp oeq half %fop1, %fop2
979 ; CHECK: fcmp oeq half %fop1, %fop2
980 fcmp ogt half %fop1, %fop2
981 ; CHECK: fcmp ogt half %fop1, %fop2
982 fcmp oge half %fop1, %fop2
983 ; CHECK: fcmp oge half %fop1, %fop2
984 fcmp olt half %fop1, %fop2
985 ; CHECK: fcmp olt half %fop1, %fop2
986 fcmp ole half %fop1, %fop2
987 ; CHECK: fcmp ole half %fop1, %fop2
988 fcmp one half %fop1, %fop2
989 ; CHECK: fcmp one half %fop1, %fop2
990 fcmp ord half %fop1, %fop2
991 ; CHECK: fcmp ord half %fop1, %fop2
992 fcmp ueq half %fop1, %fop2
993 ; CHECK: fcmp ueq half %fop1, %fop2
994 fcmp ugt half %fop1, %fop2
995 ; CHECK: fcmp ugt half %fop1, %fop2
996 fcmp uge half %fop1, %fop2
997 ; CHECK: fcmp uge half %fop1, %fop2
998 fcmp ult half %fop1, %fop2
999 ; CHECK: fcmp ult half %fop1, %fop2
1000 fcmp ule half %fop1, %fop2
1001 ; CHECK: fcmp ule half %fop1, %fop2
1002 fcmp une half %fop1, %fop2
1003 ; CHECK: fcmp une half %fop1, %fop2
1004 fcmp uno half %fop1, %fop2
1005 ; CHECK: fcmp uno half %fop1, %fop2
1006 fcmp true half %fop1, %fop2
1007 ; CHECK: fcmp true half %fop1, %fop2
1008
1009 br label %exit
1010 L1:
1011 %v1 = add i32 %op1, %op2
1012 br label %exit
1013 L2:
1014 %v2 = add i32 %op1, %op2
1015 br label %exit
1016 exit:
1017 phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1018 ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1019
1020 select i1 true, i32 0, i32 1
1021 ; CHECK: select i1 true, i32 0, i32 1
1022 select <2 x i1> , <2 x i8> , <2 x i8>
1023 ; CHECK: select <2 x i1> , <2 x i8> , <2 x i8>
1024
1025 call void @f.nobuiltin() builtin
1026 ; CHECK: call void @f.nobuiltin() #34
1027
1028 call fastcc noalias i32* @f.noalias() noinline
1029 ; CHECK: call fastcc noalias i32* @f.noalias() #12
1030 tail call ghccc nonnull i32* @f.nonnull() minsize
1031 ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #7
1032
1033 ret void
1034 }
1035
1036 define void @instructions.call_musttail(i8* inalloca %val) {
1037 musttail call void @f.param.inalloca(i8* inalloca %val)
1038 ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
1039
1040 ret void
1041 }
1042
1043 define void @instructions.landingpad() personality i32 -2 {
1044 invoke void @llvm.donothing() to label %proceed unwind label %catch1
1045 invoke void @llvm.donothing() to label %proceed unwind label %catch2
1046 invoke void @llvm.donothing() to label %proceed unwind label %catch3
1047 invoke void @llvm.donothing() to label %proceed unwind label %catch4
1048
1049 catch1:
1050 landingpad i32
1051 ; CHECK: landingpad i32
1052 cleanup
1053 ; CHECK: cleanup
1054 br label %proceed
1055
1056 catch2:
1057 landingpad i32
1058 ; CHECK: landingpad i32
1059 cleanup
1060 ; CHECK: cleanup
1061 catch i32* null
1062 ; CHECK: catch i32* null
1063 br label %proceed
1064
1065 catch3:
1066 landingpad i32
1067 ; CHECK: landingpad i32
1068 cleanup
1069 ; CHECK: cleanup
1070 catch i32* null
1071 ; CHECK: catch i32* null
1072 catch i32* null
1073 ; CHECK: catch i32* null
1074 br label %proceed
1075
1076 catch4:
1077 landingpad i32
1078 ; CHECK: landingpad i32
1079 filter [2 x i32] zeroinitializer
1080 ; CHECK: filter [2 x i32] zeroinitializer
1081 br label %proceed
1082
1083 proceed:
1084 ret void
1085 }
1086
1087 ;; Intrinsic Functions
1088
1089 ; Intrinsic Functions -- Variable Argument Handling
1090 declare void @llvm.va_start(i8*)
1091 declare void @llvm.va_copy(i8*, i8*)
1092 declare void @llvm.va_end(i8*)
1093 define void @instructions.va_arg(i8* %v, ...) {
1094 %ap = alloca i8*
1095 %ap2 = bitcast i8** %ap to i8*
1096
1097 call void @llvm.va_start(i8* %ap2)
1098 ; CHECK: call void @llvm.va_start(i8* %ap2)
1099
1100 va_arg i8* %ap2, i32
1101 ; CHECK: va_arg i8* %ap2, i32
1102
1103 call void @llvm.va_copy(i8* %v, i8* %ap2)
1104 ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
1105
1106 call void @llvm.va_end(i8* %ap2)
1107 ; CHECK: call void @llvm.va_end(i8* %ap2)
1108
1109 ret void
1110 }
1111
1112 ; Intrinsic Functions -- Accurate Garbage Collection
1113 declare void @llvm.gcroot(i8**, i8*)
1114 declare i8* @llvm.gcread(i8*, i8**)
1115 declare void @llvm.gcwrite(i8*, i8*, i8**)
1116 define void @intrinsics.gc() gc "shadow-stack" {
1117 %ptrloc = alloca i8*
1118 call void @llvm.gcroot(i8** %ptrloc, i8* null)
1119 ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
1120
1121 call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1122 ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1123
1124 %ref = alloca i8
1125 call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1126 ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1127
1128 ret void
1129 }
1130
1131 ; Intrinsic Functions -- Code Generation
1132 declare i8* @llvm.returnaddress(i32)
1133 declare i8* @llvm.frameaddress(i32)
1134 declare i32 @llvm.read_register.i32(metadata)
1135 declare i64 @llvm.read_register.i64(metadata)
1136 declare void @llvm.write_register.i32(metadata, i32)
1137 declare void @llvm.write_register.i64(metadata, i64)
1138 declare i8* @llvm.stacksave()
1139 declare void @llvm.stackrestore(i8*)
1140 declare void @llvm.prefetch(i8*, i32, i32, i32)
1141 declare void @llvm.pcmarker(i32)
1142 declare i64 @llvm.readcyclecounter()
1143 declare void @llvm.clear_cache(i8*, i8*)
1144 declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
1145
1146 !10 = !{!"rax"}
1147 define void @intrinsics.codegen() {
1148 call i8* @llvm.returnaddress(i32 1)
1149 ; CHECK: call i8* @llvm.returnaddress(i32 1)
1150 call i8* @llvm.frameaddress(i32 1)
1151 ; CHECK: call i8* @llvm.frameaddress(i32 1)
1152
1153 call i32 @llvm.read_register.i32(metadata !10)
1154 ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
1155 call i64 @llvm.read_register.i64(metadata !10)
1156 ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
1157 call void @llvm.write_register.i32(metadata !10, i32 0)
1158 ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
1159 call void @llvm.write_register.i64(metadata !10, i64 0)
1160 ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
1161
1162 %stack = call i8* @llvm.stacksave()
1163 ; CHECK: %stack = call i8* @llvm.stacksave()
1164 call void @llvm.stackrestore(i8* %stack)
1165 ; CHECK: call void @llvm.stackrestore(i8* %stack)
1166
1167 call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1168 ; CHECK: call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1169
1170 call void @llvm.pcmarker(i32 1)
1171 ; CHECK: call void @llvm.pcmarker(i32 1)
1172
1173 call i64 @llvm.readcyclecounter()
1174 ; CHECK: call i64 @llvm.readcyclecounter()
1175
1176 call void @llvm.clear_cache(i8* null, i8* null)
1177 ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
1178
1179 call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1180 ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1181
1182 ret void
1183 }
1184
1185 declare void @llvm.localescape(...)
1186 declare i8* @llvm.localrecover(i8* %func, i8* %fp, i32 %idx)
1187 define void @intrinsics.localescape() {
1188 %static.alloca = alloca i32
1189 call void (...) @llvm.localescape(i32* %static.alloca)
1190 ; CHECK: call void (...) @llvm.localescape(i32* %static.alloca)
1191
1192 call void @intrinsics.localrecover()
1193
1194 ret void
1195 }
1196 define void @intrinsics.localrecover() {
1197 %func = bitcast void ()* @intrinsics.localescape to i8*
1198 %fp = call i8* @llvm.frameaddress(i32 1)
1199 call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1200 ; CHECK: call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1201
1202 ret void
1203 }
1204
1205 ; We need this function to provide `uses' for some metadata tests.
1206 define void @misc.metadata() {
1207 call void @f1(), !srcloc !11
1208 call void @f1(), !srcloc !12
1209 call void @f1(), !srcloc !13
1210 call void @f1(), !srcloc !14
1211 ret void
1212 }
1213
1214 ; CHECK: attributes #0 = { alignstack=4 }
1215 ; CHECK: attributes #1 = { alignstack=8 }
1216 ; CHECK: attributes #2 = { alwaysinline }
1217 ; CHECK: attributes #3 = { cold }
1218 ; CHECK: attributes #4 = { convergent }
1219 ; CHECK: attributes #5 = { inlinehint }
1220 ; CHECK: attributes #6 = { jumptable }
1221 ; CHECK: attributes #7 = { minsize }
1222 ; CHECK: attributes #8 = { naked }
1223 ; CHECK: attributes #9 = { nobuiltin }
1224 ; CHECK: attributes #10 = { noduplicate }
1225 ; CHECK: attributes #11 = { noimplicitfloat }
1226 ; CHECK: attributes #12 = { noinline }
1227 ; CHECK: attributes #13 = { nonlazybind }
1228 ; CHECK: attributes #14 = { noredzone }
1229 ; CHECK: attributes #15 = { noreturn }
1230 ; CHECK: attributes #16 = { nounwind }
1231 ; CHECK: attributes #17 = { noinline optnone }
1232 ; CHECK: attributes #18 = { optsize }
1233 ; CHECK: attributes #19 = { readnone }
1234 ; CHECK: attributes #20 = { readonly }
1235 ; CHECK: attributes #21 = { returns_twice }
1236 ; CHECK: attributes #22 = { safestack }
1237 ; CHECK: attributes #23 = { sanitize_address }
1238 ; CHECK: attributes #24 = { sanitize_memory }
1239 ; CHECK: attributes #25 = { sanitize_thread }
1240 ; CHECK: attributes #26 = { ssp }
1241 ; CHECK: attributes #27 = { sspreq }
1242 ; CHECK: attributes #28 = { sspstrong }
1243 ; CHECK: attributes #29 = { "thunk" }
1244 ; CHECK: attributes #30 = { uwtable }
1245 ; CHECK: attributes #31 = { "cpu"="cortex-a8" }
1246 ; CHECK: attributes #32 = { nounwind readnone }
1247 ; CHECK: attributes #33 = { nounwind readonly }
1248 ; CHECK: attributes #34 = { builtin }
1249
1250 ;; Metadata
1251
1252 ; Metadata -- Module flags
1253 !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1254 ; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1255
1256 !0 = !{i32 1, !"mod1", i32 0}
1257 ; CHECK: !0 = !{i32 1, !"mod1", i32 0}
1258 !1 = !{i32 2, !"mod2", i32 0}
1259 ; CHECK: !1 = !{i32 2, !"mod2", i32 0}
1260 !2 = !{i32 3, !"mod3", !3}
1261 ; CHECK: !2 = !{i32 3, !"mod3", !3}
1262 !3 = !{!"mod6", !0}
1263 ; CHECK: !3 = !{!"mod6", !0}
1264 !4 = !{i32 4, !"mod4", i32 0}
1265 ; CHECK: !4 = !{i32 4, !"mod4", i32 0}
1266 !5 = !{i32 5, !"mod5", !0}
1267 ; CHECK: !5 = !{i32 5, !"mod5", !0}
1268 !6 = !{i32 6, !"mod6", !0}
1269 ; CHECK: !6 = !{i32 6, !"mod6", !0}
1270
1271 ; Metadata -- Check `distinct'
1272 !11 = distinct !{}
1273 ; CHECK: !11 = distinct !{}
1274 !12 = distinct !{}
1275 ; CHECK: !12 = distinct !{}
1276 !13 = !{!11}
1277 ; CHECK: !13 = !{!11}
1278 !14 = !{!12}
1279 ; CHECK: !14 = !{!12}