1 ; Bitcode compatibility test for llvm
3 ; Please update this file when making any IR changes. Information on the
4 ; release process for this file is available here:
6 ; http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility
8 ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
9 ; RUN-PR24755: verify-uselistorder < %s
11 target datalayout = "E"
12 ; CHECK: target datalayout = "E"
14 target triple = "x86_64-apple-macosx10.10.0"
15 ; CHECK: target triple = "x86_64-apple-macosx10.10.0"
17 ;; Module-level assembly
18 module asm "beep boop"
19 ; CHECK: module asm "beep boop"
22 $comdat.any = comdat any
23 ; CHECK: $comdat.any = comdat any
24 $comdat.exactmatch = comdat exactmatch
25 ; CHECK: $comdat.exactmatch = comdat exactmatch
26 $comdat.largest = comdat largest
27 ; CHECK: $comdat.largest = comdat largest
28 $comdat.noduplicates = comdat noduplicates
29 ; CHECK: $comdat.noduplicates = comdat noduplicates
30 $comdat.samesize = comdat samesize
31 ; CHECK: $comdat.samesize = comdat samesize
34 @const.true = constant i1 true
35 ; CHECK: @const.true = constant i1 true
36 @const.false = constant i1 false
37 ; CHECK: @const.false = constant i1 false
38 @const.int = constant i32 zeroinitializer
39 ; CHECK: @const.int = constant i32 0
40 @const.float = constant double 0.0
41 ; CHECK: @const.float = constant double 0.0
42 @const.null = constant i8* null
43 ; CHECK: @const.null = constant i8* null
44 %const.struct.type = type { i32, i8 }
45 %const.struct.type.packed = type <{ i32, i8 }>
46 @const.struct = constant %const.struct.type { i32 -1, i8 undef }
47 ; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef }
48 @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
49 ; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
51 ; CHECK: @constant.array.i8 = constant [3 x i8] c"\00\01\00"
52 @constant.array.i8 = constant [3 x i8] [i8 -0, i8 1, i8 0]
53 ; CHECK: @constant.array.i16 = constant [3 x i16] [i16 0, i16 1, i16 0]
54 @constant.array.i16 = constant [3 x i16] [i16 -0, i16 1, i16 0]
55 ; CHECK: @constant.array.i32 = constant [3 x i32] [i32 0, i32 1, i32 0]
56 @constant.array.i32 = constant [3 x i32] [i32 -0, i32 1, i32 0]
57 ; CHECK: @constant.array.i64 = constant [3 x i64] [i64 0, i64 1, i64 0]
58 @constant.array.i64 = constant [3 x i64] [i64 -0, i64 1, i64 0]
59 ; CHECK: @constant.array.f16 = constant [3 x half] [half 0xH8000, half 0xH3C00, half 0xH0000]
60 @constant.array.f16 = constant [3 x half] [half -0.0, half 1.0, half 0.0]
61 ; CHECK: @constant.array.f32 = constant [3 x float] [float -0.000000e+00, float 1.000000e+00, float 0.000000e+00]
62 @constant.array.f32 = constant [3 x float] [float -0.0, float 1.0, float 0.0]
63 ; CHECK: @constant.array.f64 = constant [3 x double] [double -0.000000e+00, double 1.000000e+00, double 0.000000e+00]
64 @constant.array.f64 = constant [3 x double] [double -0.0, double 1.0, double 0.0]
66 ; CHECK: @constant.vector.i8 = constant <3 x i8> <i8 0, i8 1, i8 0>
67 @constant.vector.i8 = constant <3 x i8> <i8 -0, i8 1, i8 0>
68 ; CHECK: @constant.vector.i16 = constant <3 x i16> <i16 0, i16 1, i16 0>
69 @constant.vector.i16 = constant <3 x i16> <i16 -0, i16 1, i16 0>
70 ; CHECK: @constant.vector.i32 = constant <3 x i32> <i32 0, i32 1, i32 0>
71 @constant.vector.i32 = constant <3 x i32> <i32 -0, i32 1, i32 0>
72 ; CHECK: @constant.vector.i64 = constant <3 x i64> <i64 0, i64 1, i64 0>
73 @constant.vector.i64 = constant <3 x i64> <i64 -0, i64 1, i64 0>
74 ; CHECK: @constant.vector.f16 = constant <3 x half> <half 0xH8000, half 0xH3C00, half 0xH0000>
75 @constant.vector.f16 = constant <3 x half> <half -0.0, half 1.0, half 0.0>
76 ; CHECK: @constant.vector.f32 = constant <3 x float> <float -0.000000e+00, float 1.000000e+00, float 0.000000e+00>
77 @constant.vector.f32 = constant <3 x float> <float -0.0, float 1.0, float 0.0>
78 ; CHECK: @constant.vector.f64 = constant <3 x double> <double -0.000000e+00, double 1.000000e+00, double 0.000000e+00>
79 @constant.vector.f64 = constant <3 x double> <double -0.0, double 1.0, double 0.0>
82 ; Format: [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass]
83 ; [ThreadLocal] [(unnamed_addr|local_unnamed_addr)] [AddrSpace] [ExternallyInitialized]
84 ; <global | constant> <Type> [<InitializerConstant>]
85 ; [, section "name"] [, comdat [($name)]] [, align <Alignment>]
87 ; Global Variables -- Simple
89 ; CHECK: @g1 = global i32 0
91 ; CHECK: @g2 = constant i32 0
93 ; Global Variables -- Linkage
94 @g.private = private global i32 0
95 ; CHECK: @g.private = private global i32 0
96 @g.internal = internal global i32 0
97 ; CHECK: @g.internal = internal global i32 0
98 @g.available_externally = available_externally global i32 0
99 ; CHECK: @g.available_externally = available_externally global i32 0
100 @g.linkonce = linkonce global i32 0
101 ; CHECK: @g.linkonce = linkonce global i32 0
102 @g.weak = weak global i32 0
103 ; CHECK: @g.weak = weak global i32 0
104 @g.common = common global i32 0
105 ; CHECK: @g.common = common global i32 0
106 @g.appending = appending global [4 x i8] c"test"
107 ; CHECK: @g.appending = appending global [4 x i8] c"test"
108 @g.extern_weak = extern_weak global i32
109 ; CHECK: @g.extern_weak = extern_weak global i32
110 @g.linkonce_odr = linkonce_odr global i32 0
111 ; CHECK: @g.linkonce_odr = linkonce_odr global i32 0
112 @g.weak_odr = weak_odr global i32 0
113 ; CHECK: @g.weak_odr = weak_odr global i32 0
114 @g.external = external global i32
115 ; CHECK: @g.external = external global i32
117 ; Global Variables -- Visibility
118 @g.default = default global i32 0
119 ; CHECK: @g.default = global i32 0
120 @g.hidden = hidden global i32 0
121 ; CHECK: @g.hidden = hidden global i32 0
122 @g.protected = protected global i32 0
123 ; CHECK: @g.protected = protected global i32 0
125 ; Global Variables -- DLLStorageClass
126 @g.dlldefault = default global i32 0
127 ; CHECK: @g.dlldefault = global i32 0
128 @g.dllimport = external dllimport global i32
129 ; CHECK: @g.dllimport = external dllimport global i32
130 @g.dllexport = dllexport global i32 0
131 ; CHECK: @g.dllexport = dllexport global i32 0
133 ; Global Variables -- ThreadLocal
134 @g.notthreadlocal = global i32 0
135 ; CHECK: @g.notthreadlocal = global i32 0
136 @g.generaldynamic = thread_local global i32 0
137 ; CHECK: @g.generaldynamic = thread_local global i32 0
138 @g.localdynamic = thread_local(localdynamic) global i32 0
139 ; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0
140 @g.initialexec = thread_local(initialexec) global i32 0
141 ; CHECK: @g.initialexec = thread_local(initialexec) global i32 0
142 @g.localexec = thread_local(localexec) global i32 0
143 ; CHECK: @g.localexec = thread_local(localexec) global i32 0
145 ; Global Variables -- unnamed_addr and local_unnamed_addr
146 @g.unnamed_addr = unnamed_addr global i32 0
147 ; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
148 @g.local_unnamed_addr = local_unnamed_addr global i32 0
149 ; CHECK: @g.local_unnamed_addr = local_unnamed_addr global i32 0
151 ; Global Variables -- AddrSpace
152 @g.addrspace = addrspace(1) global i32 0
153 ; CHECK: @g.addrspace = addrspace(1) global i32 0
155 ; Global Variables -- ExternallyInitialized
156 @g.externally_initialized = external externally_initialized global i32
157 ; CHECK: @g.externally_initialized = external externally_initialized global i32
159 ; Global Variables -- section
160 @g.section = global i32 0, section "_DATA"
161 ; CHECK: @g.section = global i32 0, section "_DATA"
163 ; Global Variables -- partition
164 @g.partition = global i32 0, partition "part"
165 ; CHECK: @g.partition = global i32 0, partition "part"
167 ; Global Variables -- comdat
168 @comdat.any = global i32 0, comdat
169 ; CHECK: @comdat.any = global i32 0, comdat
170 @comdat.exactmatch = global i32 0, comdat
171 ; CHECK: @comdat.exactmatch = global i32 0, comdat
172 @comdat.largest = global i32 0, comdat
173 ; CHECK: @comdat.largest = global i32 0, comdat
174 @comdat.noduplicates = global i32 0, comdat
175 ; CHECK: @comdat.noduplicates = global i32 0, comdat
176 @comdat.samesize = global i32 0, comdat
177 ; CHECK: @comdat.samesize = global i32 0, comdat
179 ; Force two globals from different comdats into sections with the same name.
180 $comdat1 = comdat any
181 $comdat2 = comdat any
182 @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
183 ; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
184 @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
185 ; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
187 ; Global Variables -- align
188 @g.align = global i32 0, align 4
189 ; CHECK: @g.align = global i32 0, align 4
191 ; Global Variables -- Intrinsics
192 %pri.func.data = type { i32, void ()*, i8* }
193 @g.used1 = global i32 0
194 @g.used2 = global i32 0
195 @g.used3 = global i8 0
197 @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
198 ; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
199 @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
200 ; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
201 @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
202 ; 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"
203 @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
204 ; 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"
207 ; Format: @<Name> = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
208 ; [unnamed_addr] alias <AliaseeTy> @<Aliasee>
211 @a.private = private alias i32, i32* @g.private
212 ; CHECK: @a.private = private alias i32, i32* @g.private
213 @a.internal = internal alias i32, i32* @g.internal
214 ; CHECK: @a.internal = internal alias i32, i32* @g.internal
215 @a.linkonce = linkonce alias i32, i32* @g.linkonce
216 ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
217 @a.weak = weak alias i32, i32* @g.weak
218 ; CHECK: @a.weak = weak alias i32, i32* @g.weak
219 @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
220 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
221 @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
222 ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
223 @a.external = external alias i32, i32* @g1
224 ; CHECK: @a.external = alias i32, i32* @g1
226 ; Aliases -- Visibility
227 @a.default = default alias i32, i32* @g.default
228 ; CHECK: @a.default = alias i32, i32* @g.default
229 @a.hidden = hidden alias i32, i32* @g.hidden
230 ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
231 @a.protected = protected alias i32, i32* @g.protected
232 ; CHECK: @a.protected = protected alias i32, i32* @g.protected
234 ; Aliases -- DLLStorageClass
235 @a.dlldefault = default alias i32, i32* @g.dlldefault
236 ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
237 @a.dllexport = dllexport alias i32, i32* @g.dllexport
238 ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
240 ; Aliases -- ThreadLocal
241 @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
242 ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
243 @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
244 ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
245 @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
246 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
247 @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
248 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
249 @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
250 ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
252 ; Aliases -- unnamed_addr and local_unnamed_addr
253 @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
254 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
255 @a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
256 ; CHECK: @a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
258 ; Aliases -- partition
259 ; CHECK: @alias.partition = alias i32, i32* @g.partition, partition "part"
260 @alias.partition = alias i32, i32* @g.partition, partition "part"
263 ; Format @<Name> = [Linkage] [Visibility] ifunc <IFuncTy>,
264 ; <ResolverTy>* @<Resolver>
267 @ifunc.external = external ifunc void (), i8* ()* @ifunc_resolver
268 ; CHECK: @ifunc.external = ifunc void (), i8* ()* @ifunc_resolver
269 @ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
270 ; CHECK: @ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
271 @ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
272 ; CHECK: @ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
274 ; IFunc -- Visibility
275 @ifunc.default = default ifunc void (), i8* ()* @ifunc_resolver
276 ; CHECK: @ifunc.default = ifunc void (), i8* ()* @ifunc_resolver
277 @ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
278 ; CHECK: @ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
279 @ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
280 ; CHECK: @ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
283 ; CHECK: @ifunc.partition = ifunc void (), i8* ()* @ifunc_resolver, partition "part"
284 @ifunc.partition = ifunc void (), i8* ()* @ifunc_resolver, partition "part"
286 define i8* @ifunc_resolver() {
292 ; Format: define [linkage] [visibility] [DLLStorageClass]
293 ; [cconv] [ret attrs]
294 ; <ResultType> @<FunctionName> ([argument list])
295 ; [(unnamed_addr|local_unnamed_addr)] [fn Attrs] [section "name"] [comdat [($name)]]
296 ; [align N] [gc] [prefix Constant] [prologue Constant]
297 ; [personality Constant] { ... }
299 ; Functions -- Simple
301 ; CHECK: declare void @f1()
304 ; CHECK: define void @f2()
309 ; Functions -- linkage
310 define private void @f.private() {
311 ; CHECK: define private void @f.private()
315 define internal void @f.internal() {
316 ; CHECK: define internal void @f.internal()
320 define available_externally void @f.available_externally() {
321 ; CHECK: define available_externally void @f.available_externally()
325 define linkonce void @f.linkonce() {
326 ; CHECK: define linkonce void @f.linkonce()
330 define weak void @f.weak() {
331 ; CHECK: define weak void @f.weak()
335 define linkonce_odr void @f.linkonce_odr() {
336 ; CHECK: define linkonce_odr void @f.linkonce_odr()
340 define weak_odr void @f.weak_odr() {
341 ; CHECK: define weak_odr void @f.weak_odr()
345 declare external void @f.external()
346 ; CHECK: declare void @f.external()
347 declare extern_weak void @f.extern_weak()
348 ; CHECK: declare extern_weak void @f.extern_weak()
350 ; Functions -- visibility
351 declare default void @f.default()
352 ; CHECK: declare void @f.default()
353 declare hidden void @f.hidden()
354 ; CHECK: declare hidden void @f.hidden()
355 declare protected void @f.protected()
356 ; CHECK: declare protected void @f.protected()
358 ; Functions -- DLLStorageClass
359 declare dllimport void @f.dllimport()
360 ; CHECK: declare dllimport void @f.dllimport()
361 declare dllexport void @f.dllexport()
362 ; CHECK: declare dllexport void @f.dllexport()
364 ; Functions -- cconv (Calling conventions)
365 declare ccc void @f.ccc()
366 ; CHECK: declare void @f.ccc()
367 declare fastcc void @f.fastcc()
368 ; CHECK: declare fastcc void @f.fastcc()
369 declare coldcc void @f.coldcc()
370 ; CHECK: declare coldcc void @f.coldcc()
371 declare cc10 void @f.cc10()
372 ; CHECK: declare ghccc void @f.cc10()
373 declare ghccc void @f.ghccc()
374 ; CHECK: declare ghccc void @f.ghccc()
375 declare cc11 void @f.cc11()
376 ; CHECK: declare cc11 void @f.cc11()
377 declare webkit_jscc void @f.webkit_jscc()
378 ; CHECK: declare webkit_jscc void @f.webkit_jscc()
379 declare anyregcc void @f.anyregcc()
380 ; CHECK: declare anyregcc void @f.anyregcc()
381 declare preserve_mostcc void @f.preserve_mostcc()
382 ; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
383 declare preserve_allcc void @f.preserve_allcc()
384 ; CHECK: declare preserve_allcc void @f.preserve_allcc()
385 declare cc64 void @f.cc64()
386 ; CHECK: declare x86_stdcallcc void @f.cc64()
387 declare x86_stdcallcc void @f.x86_stdcallcc()
388 ; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
389 declare cc65 void @f.cc65()
390 ; CHECK: declare x86_fastcallcc void @f.cc65()
391 declare x86_fastcallcc void @f.x86_fastcallcc()
392 ; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
393 declare cc66 void @f.cc66()
394 ; CHECK: declare arm_apcscc void @f.cc66()
395 declare arm_apcscc void @f.arm_apcscc()
396 ; CHECK: declare arm_apcscc void @f.arm_apcscc()
397 declare cc67 void @f.cc67()
398 ; CHECK: declare arm_aapcscc void @f.cc67()
399 declare arm_aapcscc void @f.arm_aapcscc()
400 ; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
401 declare cc68 void @f.cc68()
402 ; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
403 declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
404 ; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
405 declare cc69 void @f.cc69()
406 ; CHECK: declare msp430_intrcc void @f.cc69()
407 declare msp430_intrcc void @f.msp430_intrcc()
408 ; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
409 declare cc70 void @f.cc70()
410 ; CHECK: declare x86_thiscallcc void @f.cc70()
411 declare x86_thiscallcc void @f.x86_thiscallcc()
412 ; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
413 declare cc71 void @f.cc71()
414 ; CHECK: declare ptx_kernel void @f.cc71()
415 declare ptx_kernel void @f.ptx_kernel()
416 ; CHECK: declare ptx_kernel void @f.ptx_kernel()
417 declare cc72 void @f.cc72()
418 ; CHECK: declare ptx_device void @f.cc72()
419 declare ptx_device void @f.ptx_device()
420 ; CHECK: declare ptx_device void @f.ptx_device()
421 declare cc75 void @f.cc75()
422 ; CHECK: declare spir_func void @f.cc75()
423 declare spir_func void @f.spir_func()
424 ; CHECK: declare spir_func void @f.spir_func()
425 declare cc76 void @f.cc76()
426 ; CHECK: declare spir_kernel void @f.cc76()
427 declare spir_kernel void @f.spir_kernel()
428 ; CHECK: declare spir_kernel void @f.spir_kernel()
429 declare cc77 void @f.cc77()
430 ; CHECK: declare intel_ocl_bicc void @f.cc77()
431 declare intel_ocl_bicc void @f.intel_ocl_bicc()
432 ; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
433 declare cc78 void @f.cc78()
434 ; CHECK: declare x86_64_sysvcc void @f.cc78()
435 declare x86_64_sysvcc void @f.x86_64_sysvcc()
436 ; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
437 declare cc79 void @f.cc79()
438 ; CHECK: declare win64cc void @f.cc79()
439 declare win64cc void @f.win64cc()
440 ; CHECK: declare win64cc void @f.win64cc()
441 declare cc80 void @f.cc80()
442 ; CHECK: declare x86_vectorcallcc void @f.cc80()
443 declare x86_vectorcallcc void @f.x86_vectorcallcc()
444 ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
445 declare cc81 void @f.cc81()
446 ; CHECK: declare hhvmcc void @f.cc81()
447 declare hhvmcc void @f.hhvmcc()
448 ; CHECK: declare hhvmcc void @f.hhvmcc()
449 declare cc82 void @f.cc82()
450 ; CHECK: declare hhvm_ccc void @f.cc82()
451 declare hhvm_ccc void @f.hhvm_ccc()
452 ; CHECK: declare hhvm_ccc void @f.hhvm_ccc()
453 declare cc83 void @f.cc83()
454 ; CHECK: declare x86_intrcc void @f.cc83()
455 declare x86_intrcc void @f.x86_intrcc()
456 ; CHECK: declare x86_intrcc void @f.x86_intrcc()
457 declare cc84 void @f.cc84()
458 ; CHECK: declare avr_intrcc void @f.cc84()
459 declare avr_intrcc void @f.avr_intrcc()
460 ; CHECK: declare avr_intrcc void @f.avr_intrcc()
461 declare cc85 void @f.cc85()
462 ; CHECK: declare avr_signalcc void @f.cc85()
463 declare avr_signalcc void @f.avr_signalcc()
464 ; CHECK: declare avr_signalcc void @f.avr_signalcc()
465 declare cc87 void @f.cc87()
466 ; CHECK: declare amdgpu_vs void @f.cc87()
467 declare amdgpu_vs void @f.amdgpu_vs()
468 ; CHECK: declare amdgpu_vs void @f.amdgpu_vs()
469 declare cc88 void @f.cc88()
470 ; CHECK: declare amdgpu_gs void @f.cc88()
471 declare amdgpu_gs void @f.amdgpu_gs()
472 ; CHECK: declare amdgpu_gs void @f.amdgpu_gs()
473 declare cc89 void @f.cc89()
474 ; CHECK: declare amdgpu_ps void @f.cc89()
475 declare amdgpu_ps void @f.amdgpu_ps()
476 ; CHECK: declare amdgpu_ps void @f.amdgpu_ps()
477 declare cc90 void @f.cc90()
478 ; CHECK: declare amdgpu_cs void @f.cc90()
479 declare amdgpu_cs void @f.amdgpu_cs()
480 ; CHECK: declare amdgpu_cs void @f.amdgpu_cs()
481 declare cc91 void @f.cc91()
482 ; CHECK: declare amdgpu_kernel void @f.cc91()
483 declare amdgpu_kernel void @f.amdgpu_kernel()
484 ; CHECK: declare amdgpu_kernel void @f.amdgpu_kernel()
485 declare cc93 void @f.cc93()
486 ; CHECK: declare amdgpu_hs void @f.cc93()
487 declare amdgpu_hs void @f.amdgpu_hs()
488 ; CHECK: declare amdgpu_hs void @f.amdgpu_hs()
489 declare cc95 void @f.cc95()
490 ; CHECK: declare amdgpu_ls void @f.cc95()
491 declare amdgpu_ls void @f.amdgpu_ls()
492 ; CHECK: declare amdgpu_ls void @f.amdgpu_ls()
493 declare cc96 void @f.cc96()
494 ; CHECK: declare amdgpu_es void @f.cc96()
495 declare amdgpu_es void @f.amdgpu_es()
496 ; CHECK: declare amdgpu_es void @f.amdgpu_es()
497 declare cc1023 void @f.cc1023()
498 ; CHECK: declare cc1023 void @f.cc1023()
500 ; Functions -- ret attrs (Return attributes)
501 declare zeroext i64 @f.zeroext()
502 ; CHECK: declare zeroext i64 @f.zeroext()
503 declare signext i64 @f.signext()
504 ; CHECK: declare signext i64 @f.signext()
505 declare inreg i32* @f.inreg()
506 ; CHECK: declare inreg i32* @f.inreg()
507 declare noalias i32* @f.noalias()
508 ; CHECK: declare noalias i32* @f.noalias()
509 declare nonnull i32* @f.nonnull()
510 ; CHECK: declare nonnull i32* @f.nonnull()
511 declare dereferenceable(4) i32* @f.dereferenceable4()
512 ; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
513 declare dereferenceable(8) i32* @f.dereferenceable8()
514 ; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
515 declare dereferenceable(16) i32* @f.dereferenceable16()
516 ; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
517 declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
518 ; CHECK: declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
519 declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
520 ; CHECK: declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
521 declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
522 ; CHECK: declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
524 ; Functions -- Parameter attributes
525 declare void @f.param.zeroext(i8 zeroext)
526 ; CHECK: declare void @f.param.zeroext(i8 zeroext)
527 declare void @f.param.signext(i8 signext)
528 ; CHECK: declare void @f.param.signext(i8 signext)
529 declare void @f.param.inreg(i8 inreg)
530 ; CHECK: declare void @f.param.inreg(i8 inreg)
531 declare void @f.param.byval({ i8, i8 }* byval)
532 ; CHECK: declare void @f.param.byval({ i8, i8 }* byval({ i8, i8 }))
533 declare void @f.param.inalloca(i8* inalloca)
534 ; CHECK: declare void @f.param.inalloca(i8* inalloca)
535 declare void @f.param.sret(i8* sret)
536 ; CHECK: declare void @f.param.sret(i8* sret)
537 declare void @f.param.noalias(i8* noalias)
538 ; CHECK: declare void @f.param.noalias(i8* noalias)
539 declare void @f.param.nocapture(i8* nocapture)
540 ; CHECK: declare void @f.param.nocapture(i8* nocapture)
541 declare void @f.param.nest(i8* nest)
542 ; CHECK: declare void @f.param.nest(i8* nest)
543 declare i8* @f.param.returned(i8* returned)
544 ; CHECK: declare i8* @f.param.returned(i8* returned)
545 declare void @f.param.nonnull(i8* nonnull)
546 ; CHECK: declare void @f.param.nonnull(i8* nonnull)
547 declare void @f.param.dereferenceable(i8* dereferenceable(4))
548 ; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
549 declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
550 ; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
552 ; Functions -- unnamed_addr and local_unnamed_addr
553 declare void @f.unnamed_addr() unnamed_addr
554 ; CHECK: declare void @f.unnamed_addr() unnamed_addr
555 declare void @f.local_unnamed_addr() local_unnamed_addr
556 ; CHECK: declare void @f.local_unnamed_addr() local_unnamed_addr
558 ; Functions -- fn Attrs (Function attributes)
559 declare void @f.alignstack4() alignstack(4)
560 ; CHECK: declare void @f.alignstack4() #0
561 declare void @f.alignstack8() alignstack(8)
562 ; CHECK: declare void @f.alignstack8() #1
563 declare void @f.alwaysinline() alwaysinline
564 ; CHECK: declare void @f.alwaysinline() #2
565 declare void @f.cold() cold
566 ; CHECK: declare void @f.cold() #3
567 declare void @f.convergent() convergent
568 ; CHECK: declare void @f.convergent() #4
569 declare void @f.inlinehint() inlinehint
570 ; CHECK: declare void @f.inlinehint() #5
571 declare void @f.jumptable() unnamed_addr jumptable
572 ; CHECK: declare void @f.jumptable() unnamed_addr #6
573 declare void @f.minsize() minsize
574 ; CHECK: declare void @f.minsize() #7
575 declare void @f.naked() naked
576 ; CHECK: declare void @f.naked() #8
577 declare void @f.nobuiltin() nobuiltin
578 ; CHECK: declare void @f.nobuiltin() #9
579 declare void @f.noduplicate() noduplicate
580 ; CHECK: declare void @f.noduplicate() #10
581 declare void @f.noimplicitfloat() noimplicitfloat
582 ; CHECK: declare void @f.noimplicitfloat() #11
583 declare void @f.noinline() noinline
584 ; CHECK: declare void @f.noinline() #12
585 declare void @f.nonlazybind() nonlazybind
586 ; CHECK: declare void @f.nonlazybind() #13
587 declare void @f.noredzone() noredzone
588 ; CHECK: declare void @f.noredzone() #14
589 declare void @f.noreturn() noreturn
590 ; CHECK: declare void @f.noreturn() #15
591 declare void @f.nounwind() nounwind
592 ; CHECK: declare void @f.nounwind() #16
593 declare void @f.optnone() noinline optnone
594 ; CHECK: declare void @f.optnone() #17
595 declare void @f.optsize() optsize
596 ; CHECK: declare void @f.optsize() #18
597 declare void @f.readnone() readnone
598 ; CHECK: declare void @f.readnone() #19
599 declare void @f.readonly() readonly
600 ; CHECK: declare void @f.readonly() #20
601 declare void @f.returns_twice() returns_twice
602 ; CHECK: declare void @f.returns_twice() #21
603 declare void @f.safestack() safestack
604 ; CHECK: declare void @f.safestack() #22
605 declare void @f.sanitize_address() sanitize_address
606 ; CHECK: declare void @f.sanitize_address() #23
607 declare void @f.sanitize_memory() sanitize_memory
608 ; CHECK: declare void @f.sanitize_memory() #24
609 declare void @f.sanitize_thread() sanitize_thread
610 ; CHECK: declare void @f.sanitize_thread() #25
611 declare void @f.ssp() ssp
612 ; CHECK: declare void @f.ssp() #26
613 declare void @f.sspreq() sspreq
614 ; CHECK: declare void @f.sspreq() #27
615 declare void @f.sspstrong() sspstrong
616 ; CHECK: declare void @f.sspstrong() #28
617 declare void @f.thunk() "thunk"
618 ; CHECK: declare void @f.thunk() #29
619 declare void @f.uwtable() uwtable
620 ; CHECK: declare void @f.uwtable() #30
621 declare void @f.kvpair() "cpu"="cortex-a8"
622 ; CHECK:declare void @f.kvpair() #31
623 declare void @f.norecurse() norecurse
624 ; CHECK: declare void @f.norecurse() #32
625 declare void @f.inaccessiblememonly() inaccessiblememonly
626 ; CHECK: declare void @f.inaccessiblememonly() #33
627 declare void @f.inaccessiblemem_or_argmemonly() inaccessiblemem_or_argmemonly
628 ; CHECK: declare void @f.inaccessiblemem_or_argmemonly() #34
629 declare void @f.strictfp() #35
631 ; Functions -- section
632 declare void @f.section() section "80"
633 ; CHECK: declare void @f.section() section "80"
635 ; Functions -- partition
636 define void @f.partition() partition "part" {
637 ; CHECK: define void @f.partition() partition "part"
641 ; Functions -- comdat
642 define void @f.comdat_any() comdat($comdat.any) {
643 ; CHECK: define void @f.comdat_any() comdat($comdat.any)
647 define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
648 ; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
652 define void @f.comdat_largest() comdat($comdat.largest) {
653 ; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
657 define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
658 ; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
662 define void @f.comdat_samesize() comdat($comdat.samesize) {
663 ; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
669 declare void @f.align2() align 2
670 ; CHECK: declare void @f.align2() align 2
671 declare void @f.align4() align 4
672 ; CHECK: declare void @f.align4() align 4
673 declare void @f.align8() align 8
674 ; CHECK: declare void @f.align8() align 8
677 declare void @f.gcshadow() gc "shadow-stack"
678 ; CHECK: declare void @f.gcshadow() gc "shadow-stack"
680 ; Functions -- Prefix data
681 declare void @f.prefixi32() prefix i32 1684365668
682 ; CHECK: declare void @f.prefixi32() prefix i32 1684365668
683 declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
684 ; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
686 ; Functions -- Prologue data
687 declare void @f.prologuei32() prologue i32 1684365669
688 ; CHECK: declare void @f.prologuei32() prologue i32 1684365669
689 declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
690 ; CHECK: declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
692 ; Functions -- Personality constant
693 declare void @llvm.donothing() nounwind readnone
694 ; CHECK: declare void @llvm.donothing() #35
695 define void @f.no_personality() personality i8 3 {
696 ; CHECK: define void @f.no_personality() personality i8 3
697 invoke void @llvm.donothing() to label %normal unwind label %exception
699 %cleanup = landingpad i8 cleanup
705 declare i32 @f.personality_handler()
706 ; CHECK: declare i32 @f.personality_handler()
707 define void @f.personality() personality i32 ()* @f.personality_handler {
708 ; CHECK: define void @f.personality() personality i32 ()* @f.personality_handler
709 invoke void @llvm.donothing() to label %normal unwind label %exception
711 %cleanup = landingpad i32 cleanup
717 ;; Atomic Memory Ordering Constraints
718 define void @atomics(i32* %word) {
719 %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
720 ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
721 %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
722 ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
723 %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
724 ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
725 %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
726 ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
727 %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
728 ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
729 %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
730 ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
731 %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
732 ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
733 %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 syncscope("singlethread") seq_cst monotonic
734 ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 syncscope("singlethread") seq_cst monotonic
735 %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
736 ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
737 %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
738 ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
739 %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
740 ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
741 %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
742 ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
743 %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
744 ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
745 %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
746 ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
747 %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
748 ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
749 %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
750 ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
751 %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
752 ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
753 %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 syncscope("singlethread") monotonic
754 ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 syncscope("singlethread") monotonic
755 %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 syncscope("singlethread") monotonic
756 ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 syncscope("singlethread") monotonic
758 ; CHECK: fence acquire
760 ; CHECK: fence release
762 ; CHECK: fence acq_rel
763 fence syncscope("singlethread") seq_cst
764 ; CHECK: fence syncscope("singlethread") seq_cst
766 %ld.1 = load atomic i32, i32* %word monotonic, align 4
767 ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
768 %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
769 ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
770 %ld.3 = load atomic volatile i32, i32* %word syncscope("singlethread") seq_cst, align 16
771 ; CHECK: %ld.3 = load atomic volatile i32, i32* %word syncscope("singlethread") seq_cst, align 16
773 store atomic i32 23, i32* %word monotonic, align 4
774 ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
775 store atomic volatile i32 24, i32* %word monotonic, align 4
776 ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
777 store atomic volatile i32 25, i32* %word syncscope("singlethread") monotonic, align 4
778 ; CHECK: store atomic volatile i32 25, i32* %word syncscope("singlethread") monotonic, align 4
782 define void @fp_atomics(float* %word) {
783 ; CHECK: %atomicrmw.xchg = atomicrmw xchg float* %word, float 1.000000e+00 monotonic
784 %atomicrmw.xchg = atomicrmw xchg float* %word, float 1.0 monotonic
786 ; CHECK: %atomicrmw.fadd = atomicrmw fadd float* %word, float 1.000000e+00 monotonic
787 %atomicrmw.fadd = atomicrmw fadd float* %word, float 1.0 monotonic
789 ; CHECK: %atomicrmw.fsub = atomicrmw fsub float* %word, float 1.000000e+00 monotonic
790 %atomicrmw.fsub = atomicrmw fsub float* %word, float 1.0 monotonic
796 define void @fastmathflags_unop(float %op1) {
797 %f.nnan = fneg nnan float %op1
798 ; CHECK: %f.nnan = fneg nnan float %op1
799 %f.ninf = fneg ninf float %op1
800 ; CHECK: %f.ninf = fneg ninf float %op1
801 %f.nsz = fneg nsz float %op1
802 ; CHECK: %f.nsz = fneg nsz float %op1
803 %f.arcp = fneg arcp float %op1
804 ; CHECK: %f.arcp = fneg arcp float %op1
805 %f.contract = fneg contract float %op1
806 ; CHECK: %f.contract = fneg contract float %op1
807 %f.afn = fneg afn float %op1
808 ; CHECK: %f.afn = fneg afn float %op1
809 %f.reassoc = fneg reassoc float %op1
810 ; CHECK: %f.reassoc = fneg reassoc float %op1
811 %f.fast = fneg fast float %op1
812 ; CHECK: %f.fast = fneg fast float %op1
816 define void @fastmathflags_binops(float %op1, float %op2) {
817 %f.nnan = fadd nnan float %op1, %op2
818 ; CHECK: %f.nnan = fadd nnan float %op1, %op2
819 %f.ninf = fadd ninf float %op1, %op2
820 ; CHECK: %f.ninf = fadd ninf float %op1, %op2
821 %f.nsz = fadd nsz float %op1, %op2
822 ; CHECK: %f.nsz = fadd nsz float %op1, %op2
823 %f.arcp = fadd arcp float %op1, %op2
824 ; CHECK: %f.arcp = fadd arcp float %op1, %op2
825 %f.contract = fadd contract float %op1, %op2
826 ; CHECK: %f.contract = fadd contract float %op1, %op2
827 %f.afn = fadd afn float %op1, %op2
828 ; CHECK: %f.afn = fadd afn float %op1, %op2
829 %f.reassoc = fadd reassoc float %op1, %op2
830 ; CHECK: %f.reassoc = fadd reassoc float %op1, %op2
831 %f.fast = fadd fast float %op1, %op2
832 ; CHECK: %f.fast = fadd fast float %op1, %op2
836 define void @fastmathflags_select(i1 %cond, float %op1, float %op2) {
837 %f.nnan = select nnan i1 %cond, float %op1, float %op2
838 ; CHECK: %f.nnan = select nnan i1 %cond, float %op1, float %op2
839 %f.ninf = select ninf i1 %cond, float %op1, float %op2
840 ; CHECK: %f.ninf = select ninf i1 %cond, float %op1, float %op2
841 %f.nsz = select nsz i1 %cond, float %op1, float %op2
842 ; CHECK: %f.nsz = select nsz i1 %cond, float %op1, float %op2
843 %f.arcp = select arcp i1 %cond, float %op1, float %op2
844 ; CHECK: %f.arcp = select arcp i1 %cond, float %op1, float %op2
845 %f.contract = select contract i1 %cond, float %op1, float %op2
846 ; CHECK: %f.contract = select contract i1 %cond, float %op1, float %op2
847 %f.afn = select afn i1 %cond, float %op1, float %op2
848 ; CHECK: %f.afn = select afn i1 %cond, float %op1, float %op2
849 %f.reassoc = select reassoc i1 %cond, float %op1, float %op2
850 ; CHECK: %f.reassoc = select reassoc i1 %cond, float %op1, float %op2
851 %f.fast = select fast i1 %cond, float %op1, float %op2
852 ; CHECK: %f.fast = select fast i1 %cond, float %op1, float %op2
856 define void @fastmathflags_vector_select(<2 x i1> %cond, <2 x double> %op1, <2 x double> %op2) {
857 %f.nnan.nsz = select nnan nsz <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2
858 ; CHECK: %f.nnan.nsz = select nnan nsz <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2
859 %f.fast = select fast <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2
860 ; CHECK: %f.fast = select fast <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2
864 define void @fastmathflags_phi(i1 %cond, float %f1, float %f2, double %d1, double %d2, half %h1, half %h2) {
866 br i1 %cond, label %L1, label %L2
872 %p.nnan = phi nnan float [ %f1, %L1 ], [ %f2, %L2 ]
873 ; CHECK: %p.nnan = phi nnan float [ %f1, %L1 ], [ %f2, %L2 ]
874 %p.ninf = phi ninf double [ %d1, %L1 ], [ %d2, %L2 ]
875 ; CHECK: %p.ninf = phi ninf double [ %d1, %L1 ], [ %d2, %L2 ]
876 %p.contract = phi contract half [ %h1, %L1 ], [ %h2, %L2 ]
877 ; CHECK: %p.contract = phi contract half [ %h1, %L1 ], [ %h2, %L2 ]
878 %p.nsz.reassoc = phi reassoc nsz float [ %f1, %L1 ], [ %f2, %L2 ]
879 ; CHECK: %p.nsz.reassoc = phi reassoc nsz float [ %f1, %L1 ], [ %f2, %L2 ]
880 %p.fast = phi fast half [ %h2, %L1 ], [ %h1, %L2 ]
881 ; CHECK: %p.fast = phi fast half [ %h2, %L1 ], [ %h1, %L2 ]
885 define void @fastmathflags_vector_phi(i1 %cond, <4 x float> %f1, <4 x float> %f2, <2 x double> %d1, <2 x double> %d2, <8 x half> %h1, <8 x half> %h2) {
887 br i1 %cond, label %L1, label %L2
893 %p.nnan = phi nnan <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
894 ; CHECK: %p.nnan = phi nnan <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
895 %p.ninf = phi ninf <2 x double> [ %d1, %L1 ], [ %d2, %L2 ]
896 ; CHECK: %p.ninf = phi ninf <2 x double> [ %d1, %L1 ], [ %d2, %L2 ]
897 %p.contract = phi contract <8 x half> [ %h1, %L1 ], [ %h2, %L2 ]
898 ; CHECK: %p.contract = phi contract <8 x half> [ %h1, %L1 ], [ %h2, %L2 ]
899 %p.nsz.reassoc = phi reassoc nsz <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
900 ; CHECK: %p.nsz.reassoc = phi reassoc nsz <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
901 %p.fast = phi fast <8 x half> [ %h2, %L1 ], [ %h1, %L2 ]
902 ; CHECK: %p.fast = phi fast <8 x half> [ %h2, %L1 ], [ %h1, %L2 ]
906 ; Check various fast math flags and floating-point types on calls.
908 declare float @fmf1()
909 declare double @fmf2()
910 declare <4 x double> @fmf3()
912 ; CHECK-LABEL: fastMathFlagsForCalls(
913 define void @fastMathFlagsForCalls(float %f, double %d1, <4 x double> %d2) {
914 %call.fast = call fast float @fmf1()
915 ; CHECK: %call.fast = call fast float @fmf1()
917 ; Throw in some other attributes to make sure those stay in the right places.
919 %call.nsz.arcp = notail call nsz arcp double @fmf2()
920 ; CHECK: %call.nsz.arcp = notail call nsz arcp double @fmf2()
922 %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
923 ; CHECK: %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
929 %opaquety = type opaque
930 define void @typesystem() {
931 %p0 = bitcast i8* null to i32 (i32)*
932 ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
933 %p1 = bitcast i8* null to void (i8*)*
934 ; CHECK: %p1 = bitcast i8* null to void (i8*)*
935 %p2 = bitcast i8* null to i32 (i8*, ...)*
936 ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
937 %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
938 ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
939 %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
940 ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
941 %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
942 ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
944 %t0 = alloca i1942652
945 ; CHECK: %t0 = alloca i1942652
947 ; CHECK: %t1 = alloca half
949 ; CHECK: %t2 = alloca float
951 ; CHECK: %t3 = alloca double
953 ; CHECK: %t4 = alloca fp128
954 %t5 = alloca x86_fp80
955 ; CHECK: %t5 = alloca x86_fp80
956 %t6 = alloca ppc_fp128
957 ; CHECK: %t6 = alloca ppc_fp128
959 ; CHECK: %t7 = alloca x86_mmx
960 %t8 = alloca %opaquety*
961 ; CHECK: %t8 = alloca %opaquety*
962 %t9 = alloca <4 x i32>
963 ; CHECK: %t9 = alloca <4 x i32>
964 %t10 = alloca <vscale x 4 x i32>
965 ; CHECK: %t10 = alloca <vscale x 4 x i32>
970 declare void @llvm.token(token)
971 ; CHECK: declare void @llvm.token(token)
973 ;; Inline Assembler Expressions
974 define void @inlineasm(i32 %arg) {
975 call i32 asm "bswap $0", "=r,r"(i32 %arg)
976 ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
977 call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
978 ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
984 ; Instructions -- Terminators
985 define void @instructions.terminators(i8 %val) personality i32 -10 {
986 br i1 false, label %iftrue, label %iffalse
987 ; CHECK: br i1 false, label %iftrue, label %iffalse
989 ; CHECK: br label %iftrue
995 switch i8 %val, label %defaultdest [
996 ; CHECK: switch i8 %val, label %defaultdest [
997 i8 0, label %defaultdest.0
998 ; CHECK: i8 0, label %defaultdest.0
999 i8 1, label %defaultdest.1
1000 ; CHECK: i8 1, label %defaultdest.1
1001 i8 2, label %defaultdest.2
1002 ; CHECK: i8 2, label %defaultdest.2
1013 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
1014 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
1015 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
1016 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
1018 invoke fastcc void @f.fastcc()
1019 ; CHECK: invoke fastcc void @f.fastcc()
1020 to label %defaultdest unwind label %exc
1021 ; CHECK: to label %defaultdest unwind label %exc
1023 %cleanup = landingpad i32 cleanup
1026 ; CHECK: resume i32 undef
1028 ; CHECK: unreachable
1033 define i32 @instructions.win_eh.1() personality i32 -3 {
1037 invoke void @f.ccc() to label %normal unwind label %catchswitch1
1038 invoke void @f.ccc() to label %normal unwind label %catchswitch2
1039 invoke void @f.ccc() to label %normal unwind label %catchswitch3
1042 %cs1 = catchswitch within none [label %catchpad1] unwind to caller
1045 catchpad within %cs1 []
1047 ; CHECK: catchpad within %cs1 []
1048 ; CHECK-NEXT: br label %normal
1051 %cs2 = catchswitch within none [label %catchpad2] unwind to caller
1054 catchpad within %cs2 [i32* %arg1]
1056 ; CHECK: catchpad within %cs2 [i32* %arg1]
1057 ; CHECK-NEXT: br label %normal
1060 %cs3 = catchswitch within none [label %catchpad3] unwind label %cleanuppad1
1063 catchpad within %cs3 [i32* %arg1, i32* %arg2]
1065 ; CHECK: catchpad within %cs3 [i32* %arg1, i32* %arg2]
1066 ; CHECK-NEXT: br label %normal
1069 %clean.1 = cleanuppad within none []
1071 ; CHECK: %clean.1 = cleanuppad within none []
1072 ; CHECK-NEXT: unreachable
1078 define i32 @instructions.win_eh.2() personality i32 -4 {
1080 invoke void @f.ccc() to label %invoke.cont unwind label %catchswitch
1083 invoke void @f.ccc() to label %continue unwind label %cleanup
1086 %clean = cleanuppad within none []
1087 ; CHECK: %clean = cleanuppad within none []
1088 cleanupret from %clean unwind to caller
1089 ; CHECK: cleanupret from %clean unwind to caller
1092 %cs = catchswitch within none [label %catchpad] unwind label %terminate
1095 %catch = catchpad within %cs []
1097 ; CHECK: %catch = catchpad within %cs []
1098 ; CHECK-NEXT: br label %body
1101 invoke void @f.ccc() [ "funclet"(token %catch) ]
1102 to label %continue unwind label %terminate.inner
1103 catchret from %catch to label %return
1104 ; CHECK: catchret from %catch to label %return
1110 cleanuppad within %catch []
1112 ; CHECK: cleanuppad within %catch []
1113 ; CHECK-NEXT: unreachable
1116 cleanuppad within none []
1118 ; CHECK: cleanuppad within none []
1119 ; CHECK-NEXT: unreachable
1125 ; Instructions -- Unary Operations
1126 define void @instructions.unops(double %op1) {
1128 ; CHECK: fneg double %op1
1132 ; Instructions -- Binary Operations
1133 define void @instructions.binops(i8 %op1, i8 %op2) {
1136 ; CHECK: add i8 %op1, %op2
1137 add nuw i8 %op1, %op2
1138 ; CHECK: add nuw i8 %op1, %op2
1139 add nsw i8 %op1, %op2
1140 ; CHECK: add nsw i8 %op1, %op2
1141 add nuw nsw i8 %op1, %op2
1142 ; CHECK: add nuw nsw i8 %op1, %op2
1144 ; CHECK: sub i8 %op1, %op2
1145 sub nuw i8 %op1, %op2
1146 ; CHECK: sub nuw i8 %op1, %op2
1147 sub nsw i8 %op1, %op2
1148 ; CHECK: sub nsw i8 %op1, %op2
1149 sub nuw nsw i8 %op1, %op2
1150 ; CHECK: sub nuw nsw i8 %op1, %op2
1152 ; CHECK: mul i8 %op1, %op2
1153 mul nuw i8 %op1, %op2
1154 ; CHECK: mul nuw i8 %op1, %op2
1155 mul nsw i8 %op1, %op2
1156 ; CHECK: mul nsw i8 %op1, %op2
1157 mul nuw nsw i8 %op1, %op2
1158 ; CHECK: mul nuw nsw i8 %op1, %op2
1162 ; CHECK: udiv i8 %op1, %op2
1163 udiv exact i8 %op1, %op2
1164 ; CHECK: udiv exact i8 %op1, %op2
1166 ; CHECK: sdiv i8 %op1, %op2
1167 sdiv exact i8 %op1, %op2
1168 ; CHECK: sdiv exact i8 %op1, %op2
1172 ; CHECK: urem i8 %op1, %op2
1174 ; CHECK: srem i8 %op1, %op2
1179 ; Instructions -- Bitwise Binary Operations
1180 define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
1183 ; CHECK: shl i8 %op1, %op2
1184 shl nuw i8 %op1, %op2
1185 ; CHECK: shl nuw i8 %op1, %op2
1186 shl nsw i8 %op1, %op2
1187 ; CHECK: shl nsw i8 %op1, %op2
1188 shl nuw nsw i8 %op1, %op2
1189 ; CHECK: shl nuw nsw i8 %op1, %op2
1193 ; CHECK: lshr i8 %op1, %op2
1194 lshr exact i8 %op1, %op2
1195 ; CHECK: lshr exact i8 %op1, %op2
1197 ; CHECK: ashr i8 %op1, %op2
1198 ashr exact i8 %op1, %op2
1199 ; CHECK: ashr exact i8 %op1, %op2
1203 ; CHECK: and i8 %op1, %op2
1205 ; CHECK: or i8 %op1, %op2
1207 ; CHECK: xor i8 %op1, %op2
1212 ; Instructions -- Vector Operations
1213 define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
1214 extractelement <4 x float> %vec, i8 0
1215 ; CHECK: extractelement <4 x float> %vec, i8 0
1216 insertelement <4 x float> %vec, float 3.500000e+00, i8 0
1217 ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
1218 shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
1219 ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
1224 ; Instructions -- Aggregate Operations
1225 define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
1226 [3 x i8] %arr, { i8, { i32 }} %n,
1227 <2 x i8*> %pvec, <2 x i64> %offsets) {
1228 extractvalue { i8, i32 } %up, 0
1229 ; CHECK: extractvalue { i8, i32 } %up, 0
1230 extractvalue <{ i8, i32 }> %p, 1
1231 ; CHECK: extractvalue <{ i8, i32 }> %p, 1
1232 extractvalue [3 x i8] %arr, 2
1233 ; CHECK: extractvalue [3 x i8] %arr, 2
1234 extractvalue { i8, { i32 } } %n, 1, 0
1235 ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
1237 insertvalue { i8, i32 } %up, i8 1, 0
1238 ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
1239 insertvalue <{ i8, i32 }> %p, i32 2, 1
1240 ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
1241 insertvalue [3 x i8] %arr, i8 0, 0
1242 ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
1243 insertvalue { i8, { i32 } } %n, i32 0, 1, 0
1244 ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
1246 %up.ptr = alloca { i8, i32 }
1247 %p.ptr = alloca <{ i8, i32 }>
1248 %arr.ptr = alloca [3 x i8]
1249 %n.ptr = alloca { i8, { i32 } }
1251 getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
1252 ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
1253 getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
1254 ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
1255 getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
1256 ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
1257 getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
1258 ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
1259 getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
1260 ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
1261 getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
1262 ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
1267 ; Instructions -- Memory Access and Addressing Operations
1271 define void @instructions.memops(i32** %base) {
1272 alloca i32, i8 4, align 4
1273 ; CHECK: alloca i32, i8 4, align 4
1274 alloca inalloca i32, i8 4, align 4
1275 ; CHECK: alloca inalloca i32, i8 4, align 4
1277 load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1278 ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1279 load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1280 ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1282 store i32* null, i32** %base, align 4, !nontemporal !8
1283 ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
1284 store volatile i32* null, i32** %base, align 4, !nontemporal !8
1285 ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
1290 ; Instructions -- Conversion Operations
1291 define void @instructions.conversions() {
1293 ; CHECK: trunc i32 -1 to i1
1295 ; CHECK: zext i32 -1 to i64
1297 ; CHECK: sext i32 -1 to i64
1298 fptrunc float undef to half
1299 ; CHECK: fptrunc float undef to half
1300 fpext half undef to float
1301 ; CHECK: fpext half undef to float
1302 fptoui float undef to i32
1303 ; CHECK: fptoui float undef to i32
1304 fptosi float undef to i32
1305 ; CHECK: fptosi float undef to i32
1306 uitofp i32 1 to float
1307 ; CHECK: uitofp i32 1 to float
1308 sitofp i32 -1 to float
1309 ; CHECK: sitofp i32 -1 to float
1310 ptrtoint i8* null to i64
1311 ; CHECK: ptrtoint i8* null to i64
1312 inttoptr i64 0 to i8*
1313 ; CHECK: inttoptr i64 0 to i8*
1314 bitcast i32 0 to i32
1315 ; CHECK: bitcast i32 0 to i32
1316 addrspacecast i32* null to i32 addrspace(1)*
1317 ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
1322 ; Instructions -- Other Operations
1323 define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
1325 icmp eq i32 %op1, %op2
1326 ; CHECK: icmp eq i32 %op1, %op2
1327 icmp ne i32 %op1, %op2
1328 ; CHECK: icmp ne i32 %op1, %op2
1329 icmp ugt i32 %op1, %op2
1330 ; CHECK: icmp ugt i32 %op1, %op2
1331 icmp uge i32 %op1, %op2
1332 ; CHECK: icmp uge i32 %op1, %op2
1333 icmp ult i32 %op1, %op2
1334 ; CHECK: icmp ult i32 %op1, %op2
1335 icmp ule i32 %op1, %op2
1336 ; CHECK: icmp ule i32 %op1, %op2
1337 icmp sgt i32 %op1, %op2
1338 ; CHECK: icmp sgt i32 %op1, %op2
1339 icmp sge i32 %op1, %op2
1340 ; CHECK: icmp sge i32 %op1, %op2
1341 icmp slt i32 %op1, %op2
1342 ; CHECK: icmp slt i32 %op1, %op2
1343 icmp sle i32 %op1, %op2
1344 ; CHECK: icmp sle i32 %op1, %op2
1346 fcmp false half %fop1, %fop2
1347 ; CHECK: fcmp false half %fop1, %fop2
1348 fcmp oeq half %fop1, %fop2
1349 ; CHECK: fcmp oeq half %fop1, %fop2
1350 fcmp ogt half %fop1, %fop2
1351 ; CHECK: fcmp ogt half %fop1, %fop2
1352 fcmp oge half %fop1, %fop2
1353 ; CHECK: fcmp oge half %fop1, %fop2
1354 fcmp olt half %fop1, %fop2
1355 ; CHECK: fcmp olt half %fop1, %fop2
1356 fcmp ole half %fop1, %fop2
1357 ; CHECK: fcmp ole half %fop1, %fop2
1358 fcmp one half %fop1, %fop2
1359 ; CHECK: fcmp one half %fop1, %fop2
1360 fcmp ord half %fop1, %fop2
1361 ; CHECK: fcmp ord half %fop1, %fop2
1362 fcmp ueq half %fop1, %fop2
1363 ; CHECK: fcmp ueq half %fop1, %fop2
1364 fcmp ugt half %fop1, %fop2
1365 ; CHECK: fcmp ugt half %fop1, %fop2
1366 fcmp uge half %fop1, %fop2
1367 ; CHECK: fcmp uge half %fop1, %fop2
1368 fcmp ult half %fop1, %fop2
1369 ; CHECK: fcmp ult half %fop1, %fop2
1370 fcmp ule half %fop1, %fop2
1371 ; CHECK: fcmp ule half %fop1, %fop2
1372 fcmp une half %fop1, %fop2
1373 ; CHECK: fcmp une half %fop1, %fop2
1374 fcmp uno half %fop1, %fop2
1375 ; CHECK: fcmp uno half %fop1, %fop2
1376 fcmp true half %fop1, %fop2
1377 ; CHECK: fcmp true half %fop1, %fop2
1381 %v1 = add i32 %op1, %op2
1384 %v2 = add i32 %op1, %op2
1387 phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1388 ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1390 select i1 true, i32 0, i32 1
1391 ; CHECK: select i1 true, i32 0, i32 1
1392 select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
1393 ; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
1395 call void @f.nobuiltin() builtin
1396 ; CHECK: call void @f.nobuiltin() #43
1398 call fastcc noalias i32* @f.noalias() noinline
1399 ; CHECK: call fastcc noalias i32* @f.noalias() #12
1400 tail call ghccc nonnull i32* @f.nonnull() minsize
1401 ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #7
1406 define void @instructions.call_musttail(i8* inalloca %val) {
1407 musttail call void @f.param.inalloca(i8* inalloca %val)
1408 ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
1413 define void @instructions.strictfp() #44 {
1414 call void @f.strictfp() strictfp
1415 ; CHECK: call void @f.strictfp() #44
1420 define void @instructions.call_notail() {
1421 notail call void @f1()
1422 ; CHECK: notail call void @f1()
1427 define void @instructions.landingpad() personality i32 -2 {
1428 invoke void @llvm.donothing() to label %proceed unwind label %catch1
1429 invoke void @llvm.donothing() to label %proceed unwind label %catch2
1430 invoke void @llvm.donothing() to label %proceed unwind label %catch3
1431 invoke void @llvm.donothing() to label %proceed unwind label %catch4
1435 ; CHECK: landingpad i32
1442 ; CHECK: landingpad i32
1446 ; CHECK: catch i32* null
1451 ; CHECK: landingpad i32
1455 ; CHECK: catch i32* null
1457 ; CHECK: catch i32* null
1462 ; CHECK: landingpad i32
1463 filter [2 x i32] zeroinitializer
1464 ; CHECK: filter [2 x i32] zeroinitializer
1471 ;; Intrinsic Functions
1473 ; Intrinsic Functions -- Variable Argument Handling
1474 declare void @llvm.va_start(i8*)
1475 declare void @llvm.va_copy(i8*, i8*)
1476 declare void @llvm.va_end(i8*)
1477 define void @instructions.va_arg(i8* %v, ...) {
1479 %ap2 = bitcast i8** %ap to i8*
1481 call void @llvm.va_start(i8* %ap2)
1482 ; CHECK: call void @llvm.va_start(i8* %ap2)
1484 va_arg i8* %ap2, i32
1485 ; CHECK: va_arg i8* %ap2, i32
1487 call void @llvm.va_copy(i8* %v, i8* %ap2)
1488 ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
1490 call void @llvm.va_end(i8* %ap2)
1491 ; CHECK: call void @llvm.va_end(i8* %ap2)
1496 ; Intrinsic Functions -- Accurate Garbage Collection
1497 declare void @llvm.gcroot(i8**, i8*)
1498 declare i8* @llvm.gcread(i8*, i8**)
1499 declare void @llvm.gcwrite(i8*, i8*, i8**)
1500 define void @intrinsics.gc() gc "shadow-stack" {
1501 %ptrloc = alloca i8*
1502 call void @llvm.gcroot(i8** %ptrloc, i8* null)
1503 ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
1505 call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1506 ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1509 call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1510 ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1515 ; Intrinsic Functions -- Code Generation
1516 declare i8* @llvm.returnaddress(i32)
1517 declare i8* @llvm.frameaddress(i32)
1518 declare i32 @llvm.read_register.i32(metadata)
1519 declare i64 @llvm.read_register.i64(metadata)
1520 declare void @llvm.write_register.i32(metadata, i32)
1521 declare void @llvm.write_register.i64(metadata, i64)
1522 declare i8* @llvm.stacksave()
1523 declare void @llvm.stackrestore(i8*)
1524 declare void @llvm.prefetch.p0i8(i8*, i32, i32, i32)
1525 declare void @llvm.pcmarker(i32)
1526 declare i64 @llvm.readcyclecounter()
1527 declare void @llvm.clear_cache(i8*, i8*)
1528 declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
1531 define void @intrinsics.codegen() {
1532 call i8* @llvm.returnaddress(i32 1)
1533 ; CHECK: call i8* @llvm.returnaddress(i32 1)
1534 call i8* @llvm.frameaddress(i32 1)
1535 ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1)
1537 call i32 @llvm.read_register.i32(metadata !10)
1538 ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
1539 call i64 @llvm.read_register.i64(metadata !10)
1540 ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
1541 call void @llvm.write_register.i32(metadata !10, i32 0)
1542 ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
1543 call void @llvm.write_register.i64(metadata !10, i64 0)
1544 ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
1546 %stack = call i8* @llvm.stacksave()
1547 ; CHECK: %stack = call i8* @llvm.stacksave()
1548 call void @llvm.stackrestore(i8* %stack)
1549 ; CHECK: call void @llvm.stackrestore(i8* %stack)
1551 call void @llvm.prefetch.p0i8(i8* %stack, i32 0, i32 3, i32 0)
1552 ; CHECK: call void @llvm.prefetch.p0i8(i8* %stack, i32 0, i32 3, i32 0)
1554 call void @llvm.pcmarker(i32 1)
1555 ; CHECK: call void @llvm.pcmarker(i32 1)
1557 call i64 @llvm.readcyclecounter()
1558 ; CHECK: call i64 @llvm.readcyclecounter()
1560 call void @llvm.clear_cache(i8* null, i8* null)
1561 ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
1563 call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1564 ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1569 declare void @llvm.localescape(...)
1570 declare i8* @llvm.localrecover(i8* %func, i8* %fp, i32 %idx)
1571 define void @intrinsics.localescape() {
1572 %static.alloca = alloca i32
1573 call void (...) @llvm.localescape(i32* %static.alloca)
1574 ; CHECK: call void (...) @llvm.localescape(i32* %static.alloca)
1576 call void @intrinsics.localrecover()
1580 define void @intrinsics.localrecover() {
1581 %func = bitcast void ()* @intrinsics.localescape to i8*
1582 %fp = call i8* @llvm.frameaddress(i32 1)
1583 call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1584 ; CHECK: call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1589 ; We need this function to provide `uses' for some metadata tests.
1590 define void @misc.metadata() {
1591 call void @f1(), !srcloc !11
1592 call void @f1(), !srcloc !12
1593 call void @f1(), !srcloc !13
1594 call void @f1(), !srcloc !14
1598 declare void @op_bundle_callee_0()
1599 declare void @op_bundle_callee_1(i32,i32)
1601 define void @call_with_operand_bundle0(i32* %ptr) {
1602 ; CHECK-LABEL: call_with_operand_bundle0(
1604 %l = load i32, i32* %ptr
1606 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
1607 ; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
1611 define void @call_with_operand_bundle1(i32* %ptr) {
1612 ; CHECK-LABEL: call_with_operand_bundle1(
1614 %l = load i32, i32* %ptr
1617 call void @op_bundle_callee_0()
1618 call void @op_bundle_callee_0() [ "foo"() ]
1619 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
1620 ; CHECK: @op_bundle_callee_0(){{$}}
1621 ; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"() ]
1622 ; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
1626 define void @call_with_operand_bundle2(i32* %ptr) {
1627 ; CHECK-LABEL: call_with_operand_bundle2(
1629 call void @op_bundle_callee_0() [ "foo"() ]
1630 ; CHECK: call void @op_bundle_callee_0() [ "foo"() ]
1634 define void @call_with_operand_bundle3(i32* %ptr) {
1635 ; CHECK-LABEL: call_with_operand_bundle3(
1637 %l = load i32, i32* %ptr
1639 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1640 ; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1644 define void @call_with_operand_bundle4(i32* %ptr) {
1645 ; CHECK-LABEL: call_with_operand_bundle4(
1647 %l = load i32, i32* %ptr
1649 call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1650 ; CHECK: call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1654 ; Invoke versions of the above tests:
1657 define void @invoke_with_operand_bundle0(i32* %ptr) personality i8 3 {
1658 ; CHECK-LABEL: @invoke_with_operand_bundle0(
1660 %l = load i32, i32* %ptr
1662 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] to label %normal unwind label %exception
1663 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
1666 %cleanup = landingpad i8 cleanup
1672 define void @invoke_with_operand_bundle1(i32* %ptr) personality i8 3 {
1673 ; CHECK-LABEL: @invoke_with_operand_bundle1(
1675 %l = load i32, i32* %ptr
1678 invoke void @op_bundle_callee_0() to label %normal unwind label %exception
1679 ; CHECK: invoke void @op_bundle_callee_0(){{$}}
1682 %cleanup = landingpad i8 cleanup
1686 invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal1 unwind label %exception1
1687 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
1690 %cleanup1 = landingpad i8 cleanup
1694 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal2 unwind label %exception2
1695 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1698 %cleanup2 = landingpad i8 cleanup
1705 define void @invoke_with_operand_bundle2(i32* %ptr) personality i8 3 {
1706 ; CHECK-LABEL: @invoke_with_operand_bundle2(
1708 invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal unwind label %exception
1709 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
1712 %cleanup = landingpad i8 cleanup
1718 define void @invoke_with_operand_bundle3(i32* %ptr) personality i8 3 {
1719 ; CHECK-LABEL: @invoke_with_operand_bundle3(
1721 %l = load i32, i32* %ptr
1723 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal unwind label %exception
1724 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1727 %cleanup = landingpad i8 cleanup
1733 define void @invoke_with_operand_bundle4(i32* %ptr) personality i8 3 {
1734 ; CHECK-LABEL: @invoke_with_operand_bundle4(
1736 %l = load i32, i32* %ptr
1738 invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1739 to label %normal unwind label %exception
1740 ; CHECK: invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1743 %cleanup = landingpad i8 cleanup
1749 declare void @vaargs_func(...)
1750 define void @invoke_with_operand_bundle_vaarg(i32* %ptr) personality i8 3 {
1751 ; CHECK-LABEL: @invoke_with_operand_bundle_vaarg(
1753 %l = load i32, i32* %ptr
1755 invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1756 to label %normal unwind label %exception
1757 ; CHECK: invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
1760 %cleanup = landingpad i8 cleanup
1767 declare void @f.writeonly() writeonly
1768 ; CHECK: declare void @f.writeonly() #41
1770 declare void @f.speculatable() speculatable
1771 ; CHECK: declare void @f.speculatable() #42
1773 ;; Constant Expressions
1775 define i8** @constexpr() {
1776 ; CHECK: ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2)
1777 ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2)
1781 declare void @llvm.test.immarg.intrinsic(i32 immarg)
1782 ; CHECK: declare void @llvm.test.immarg.intrinsic(i32 immarg)
1784 ; byval attribute with type
1785 %named_type = type [8 x i8]
1786 declare void @byval_type(i32* byval(i32) align 2)
1787 declare void @byval_type2({ i8, i8* }* byval({ i8, i8* }))
1788 declare void @byval_named_type(%named_type* byval(%named_type))
1789 ; CHECK: declare void @byval_type(i32* byval(i32) align 2)
1790 ; CHECK: declare void @byval_type2({ i8, i8* }* byval({ i8, i8* }))
1791 ; CHECK: declare void @byval_named_type([8 x i8]* byval([8 x i8]))
1793 ; CHECK: attributes #0 = { alignstack=4 }
1794 ; CHECK: attributes #1 = { alignstack=8 }
1795 ; CHECK: attributes #2 = { alwaysinline }
1796 ; CHECK: attributes #3 = { cold }
1797 ; CHECK: attributes #4 = { convergent }
1798 ; CHECK: attributes #5 = { inlinehint }
1799 ; CHECK: attributes #6 = { jumptable }
1800 ; CHECK: attributes #7 = { minsize }
1801 ; CHECK: attributes #8 = { naked }
1802 ; CHECK: attributes #9 = { nobuiltin }
1803 ; CHECK: attributes #10 = { noduplicate }
1804 ; CHECK: attributes #11 = { noimplicitfloat }
1805 ; CHECK: attributes #12 = { noinline }
1806 ; CHECK: attributes #13 = { nonlazybind }
1807 ; CHECK: attributes #14 = { noredzone }
1808 ; CHECK: attributes #15 = { noreturn }
1809 ; CHECK: attributes #16 = { nounwind }
1810 ; CHECK: attributes #17 = { noinline optnone }
1811 ; CHECK: attributes #18 = { optsize }
1812 ; CHECK: attributes #19 = { readnone }
1813 ; CHECK: attributes #20 = { readonly }
1814 ; CHECK: attributes #21 = { returns_twice }
1815 ; CHECK: attributes #22 = { safestack }
1816 ; CHECK: attributes #23 = { sanitize_address }
1817 ; CHECK: attributes #24 = { sanitize_memory }
1818 ; CHECK: attributes #25 = { sanitize_thread }
1819 ; CHECK: attributes #26 = { ssp }
1820 ; CHECK: attributes #27 = { sspreq }
1821 ; CHECK: attributes #28 = { sspstrong }
1822 ; CHECK: attributes #29 = { "thunk" }
1823 ; CHECK: attributes #30 = { uwtable }
1824 ; CHECK: attributes #31 = { "cpu"="cortex-a8" }
1825 ; CHECK: attributes #32 = { norecurse }
1826 ; CHECK: attributes #33 = { inaccessiblememonly }
1827 ; CHECK: attributes #34 = { inaccessiblemem_or_argmemonly }
1828 ; CHECK: attributes #35 = { nounwind readnone willreturn }
1829 ; CHECK: attributes #36 = { argmemonly nounwind readonly }
1830 ; CHECK: attributes #37 = { argmemonly nounwind }
1831 ; CHECK: attributes #38 = { nounwind readnone }
1832 ; CHECK: attributes #39 = { nounwind readonly }
1833 ; CHECK: attributes #40 = { inaccessiblemem_or_argmemonly nounwind willreturn }
1834 ; CHECK: attributes #41 = { writeonly }
1835 ; CHECK: attributes #42 = { speculatable }
1836 ; CHECK: attributes #43 = { builtin }
1837 ; CHECK: attributes #44 = { strictfp }
1841 ; Metadata -- Module flags
1842 !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1843 ; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1845 !0 = !{i32 1, !"mod1", i32 0}
1846 ; CHECK: !0 = !{i32 1, !"mod1", i32 0}
1847 !1 = !{i32 2, !"mod2", i32 0}
1848 ; CHECK: !1 = !{i32 2, !"mod2", i32 0}
1849 !2 = !{i32 3, !"mod3", !3}
1850 ; CHECK: !2 = !{i32 3, !"mod3", !3}
1852 ; CHECK: !3 = !{!"mod6", !0}
1853 !4 = !{i32 4, !"mod4", i32 0}
1854 ; CHECK: !4 = !{i32 4, !"mod4", i32 0}
1855 !5 = !{i32 5, !"mod5", !0}
1856 ; CHECK: !5 = !{i32 5, !"mod5", !0}
1857 !6 = !{i32 6, !"mod6", !0}
1858 ; CHECK: !6 = !{i32 6, !"mod6", !0}
1860 ; Metadata -- Check `distinct'
1862 ; CHECK: !11 = distinct !{}
1864 ; CHECK: !12 = distinct !{}
1866 ; CHECK: !13 = !{!11}
1868 ; CHECK: !14 = !{!12}