• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Bitcode compatibility test for llvm
2;
3; Please update this file when making any IR changes. Information on the
4; release process for this file is available here:
5;
6;     http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility
7
8; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
9; RUN-PR24755: verify-uselistorder < %s
10
11target datalayout = "E"
12; CHECK: target datalayout = "E"
13
14target triple = "x86_64-apple-macosx10.10.0"
15; CHECK: target triple = "x86_64-apple-macosx10.10.0"
16
17;; Module-level assembly
18module asm "beep boop"
19; CHECK: module asm "beep boop"
20
21;; Comdats
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
32
33;; Constants
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 }>
50
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]
65
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>
80
81;; Global Variables
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>]
86
87; Global Variables -- Simple
88@g1 = global i32 0
89; CHECK: @g1 = global i32 0
90@g2 = constant i32 0
91; CHECK: @g2 = constant i32 0
92
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
116
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
124
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
132
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
144
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
150
151; Global Variables -- AddrSpace
152@g.addrspace = addrspace(1) global i32 0
153; CHECK: @g.addrspace = addrspace(1) global i32 0
154
155; Global Variables -- ExternallyInitialized
156@g.externally_initialized = external externally_initialized global i32
157; CHECK: @g.externally_initialized = external externally_initialized global i32
158
159; Global Variables -- section
160@g.section = global i32 0, section "_DATA"
161; CHECK: @g.section = global i32 0, section "_DATA"
162
163; Global Variables -- comdat
164@comdat.any = global i32 0, comdat
165; CHECK: @comdat.any = global i32 0, comdat
166@comdat.exactmatch = global i32 0, comdat
167; CHECK: @comdat.exactmatch = global i32 0, comdat
168@comdat.largest = global i32 0, comdat
169; CHECK: @comdat.largest = global i32 0, comdat
170@comdat.noduplicates = global i32 0, comdat
171; CHECK: @comdat.noduplicates = global i32 0, comdat
172@comdat.samesize = global i32 0, comdat
173; CHECK: @comdat.samesize = global i32 0, comdat
174
175; Force two globals from different comdats into sections with the same name.
176$comdat1 = comdat any
177$comdat2 = comdat any
178@g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
179; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
180@g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
181; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
182
183; Global Variables -- align
184@g.align = global i32 0, align 4
185; CHECK: @g.align = global i32 0, align 4
186
187; Global Variables -- Intrinsics
188%pri.func.data = type { i32, void ()*, i8* }
189@g.used1 = global i32 0
190@g.used2 = global i32 0
191@g.used3 = global i8 0
192declare void @g.f1()
193@llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
194; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
195@llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
196; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
197@llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
198; 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"
199@llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
200; 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"
201
202;; Aliases
203; Format: @<Name> = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
204;                   [unnamed_addr] alias <AliaseeTy> @<Aliasee>
205
206; Aliases -- Linkage
207@a.private = private alias i32, i32* @g.private
208; CHECK: @a.private = private alias i32, i32* @g.private
209@a.internal = internal alias i32, i32* @g.internal
210; CHECK: @a.internal = internal alias i32, i32* @g.internal
211@a.linkonce = linkonce alias i32, i32* @g.linkonce
212; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
213@a.weak = weak alias i32, i32* @g.weak
214; CHECK: @a.weak = weak alias i32, i32* @g.weak
215@a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
216; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
217@a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
218; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
219@a.external = external alias i32, i32* @g1
220; CHECK: @a.external = alias i32, i32* @g1
221
222; Aliases -- Visibility
223@a.default = default alias i32, i32* @g.default
224; CHECK: @a.default = alias i32, i32* @g.default
225@a.hidden = hidden alias i32, i32* @g.hidden
226; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
227@a.protected = protected alias i32, i32* @g.protected
228; CHECK: @a.protected = protected alias i32, i32* @g.protected
229
230; Aliases -- DLLStorageClass
231@a.dlldefault = default alias i32, i32* @g.dlldefault
232; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
233@a.dllimport = dllimport alias i32, i32* @g1
234; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
235@a.dllexport = dllexport alias i32, i32* @g.dllexport
236; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
237
238; Aliases -- ThreadLocal
239@a.notthreadlocal = alias i32, i32* @g.notthreadlocal
240; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
241@a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
242; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
243@a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
244; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
245@a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
246; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
247@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
248; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
249
250; Aliases -- unnamed_addr and local_unnamed_addr
251@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
252; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
253@a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
254; CHECK: @a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
255
256;; IFunc
257; Format @<Name> = [Linkage] [Visibility] ifunc <IFuncTy>,
258;                  <ResolverTy>* @<Resolver>
259
260; IFunc -- Linkage
261@ifunc.external = external ifunc void (), i8* ()* @ifunc_resolver
262; CHECK: @ifunc.external = ifunc void (), i8* ()* @ifunc_resolver
263@ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
264; CHECK: @ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
265@ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
266; CHECK: @ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
267
268; IFunc -- Visibility
269@ifunc.default = default ifunc void (), i8* ()* @ifunc_resolver
270; CHECK: @ifunc.default = ifunc void (), i8* ()* @ifunc_resolver
271@ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
272; CHECK: @ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
273@ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
274; CHECK: @ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
275
276define i8* @ifunc_resolver() {
277entry:
278  ret i8* null
279}
280
281;; Functions
282; Format: define [linkage] [visibility] [DLLStorageClass]
283;         [cconv] [ret attrs]
284;         <ResultType> @<FunctionName> ([argument list])
285;         [(unnamed_addr|local_unnamed_addr)] [fn Attrs] [section "name"] [comdat [($name)]]
286;         [align N] [gc] [prefix Constant] [prologue Constant]
287;         [personality Constant] { ... }
288
289; Functions -- Simple
290declare void @f1 ()
291; CHECK: declare void @f1()
292
293define void @f2 () {
294; CHECK: define void @f2()
295entry:
296  ret void
297}
298
299; Functions -- linkage
300define private void @f.private() {
301; CHECK: define private void @f.private()
302entry:
303  ret void
304}
305define internal void @f.internal() {
306; CHECK: define internal void @f.internal()
307entry:
308  ret void
309}
310define available_externally void @f.available_externally() {
311; CHECK: define available_externally void @f.available_externally()
312entry:
313  ret void
314}
315define linkonce void @f.linkonce() {
316; CHECK: define linkonce void @f.linkonce()
317entry:
318  ret void
319}
320define weak void @f.weak() {
321; CHECK: define weak void @f.weak()
322entry:
323  ret void
324}
325define linkonce_odr void @f.linkonce_odr() {
326; CHECK: define linkonce_odr void @f.linkonce_odr()
327entry:
328  ret void
329}
330define weak_odr void @f.weak_odr() {
331; CHECK: define weak_odr void @f.weak_odr()
332entry:
333  ret void
334}
335declare external void @f.external()
336; CHECK: declare void @f.external()
337declare extern_weak void @f.extern_weak()
338; CHECK: declare extern_weak void @f.extern_weak()
339
340; Functions -- visibility
341declare default void @f.default()
342; CHECK: declare void @f.default()
343declare hidden void @f.hidden()
344; CHECK: declare hidden void @f.hidden()
345declare protected void @f.protected()
346; CHECK: declare protected void @f.protected()
347
348; Functions -- DLLStorageClass
349declare dllimport void @f.dllimport()
350; CHECK: declare dllimport void @f.dllimport()
351declare dllexport void @f.dllexport()
352; CHECK: declare dllexport void @f.dllexport()
353
354; Functions -- cconv (Calling conventions)
355declare ccc void @f.ccc()
356; CHECK: declare void @f.ccc()
357declare fastcc void @f.fastcc()
358; CHECK: declare fastcc void @f.fastcc()
359declare coldcc void @f.coldcc()
360; CHECK: declare coldcc void @f.coldcc()
361declare cc10 void @f.cc10()
362; CHECK: declare ghccc void @f.cc10()
363declare ghccc void @f.ghccc()
364; CHECK: declare ghccc void @f.ghccc()
365declare cc11 void @f.cc11()
366; CHECK: declare cc11 void @f.cc11()
367declare webkit_jscc void @f.webkit_jscc()
368; CHECK: declare webkit_jscc void @f.webkit_jscc()
369declare anyregcc void @f.anyregcc()
370; CHECK: declare anyregcc void @f.anyregcc()
371declare preserve_mostcc void @f.preserve_mostcc()
372; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
373declare preserve_allcc void @f.preserve_allcc()
374; CHECK: declare preserve_allcc void @f.preserve_allcc()
375declare cc64 void @f.cc64()
376; CHECK: declare x86_stdcallcc void @f.cc64()
377declare x86_stdcallcc void @f.x86_stdcallcc()
378; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
379declare cc65 void @f.cc65()
380; CHECK: declare x86_fastcallcc void @f.cc65()
381declare x86_fastcallcc void @f.x86_fastcallcc()
382; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
383declare cc66 void @f.cc66()
384; CHECK: declare arm_apcscc void @f.cc66()
385declare arm_apcscc void @f.arm_apcscc()
386; CHECK: declare arm_apcscc void @f.arm_apcscc()
387declare cc67 void @f.cc67()
388; CHECK: declare arm_aapcscc void @f.cc67()
389declare arm_aapcscc void @f.arm_aapcscc()
390; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
391declare cc68 void @f.cc68()
392; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
393declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
394; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
395declare cc69 void @f.cc69()
396; CHECK: declare msp430_intrcc void @f.cc69()
397declare msp430_intrcc void @f.msp430_intrcc()
398; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
399declare cc70 void @f.cc70()
400; CHECK: declare x86_thiscallcc void @f.cc70()
401declare x86_thiscallcc void @f.x86_thiscallcc()
402; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
403declare cc71 void @f.cc71()
404; CHECK: declare ptx_kernel void @f.cc71()
405declare ptx_kernel void @f.ptx_kernel()
406; CHECK: declare ptx_kernel void @f.ptx_kernel()
407declare cc72 void @f.cc72()
408; CHECK: declare ptx_device void @f.cc72()
409declare ptx_device void @f.ptx_device()
410; CHECK: declare ptx_device void @f.ptx_device()
411declare cc75 void @f.cc75()
412; CHECK: declare spir_func void @f.cc75()
413declare spir_func void @f.spir_func()
414; CHECK: declare spir_func void @f.spir_func()
415declare cc76 void @f.cc76()
416; CHECK: declare spir_kernel void @f.cc76()
417declare spir_kernel void @f.spir_kernel()
418; CHECK: declare spir_kernel void @f.spir_kernel()
419declare cc77 void @f.cc77()
420; CHECK: declare intel_ocl_bicc void @f.cc77()
421declare intel_ocl_bicc void @f.intel_ocl_bicc()
422; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
423declare cc78 void @f.cc78()
424; CHECK: declare x86_64_sysvcc void @f.cc78()
425declare x86_64_sysvcc void @f.x86_64_sysvcc()
426; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
427declare cc79 void @f.cc79()
428; CHECK: declare x86_64_win64cc void @f.cc79()
429declare x86_64_win64cc void @f.x86_64_win64cc()
430; CHECK: declare x86_64_win64cc void @f.x86_64_win64cc()
431declare cc80 void @f.cc80()
432; CHECK: declare x86_vectorcallcc void @f.cc80()
433declare x86_vectorcallcc void @f.x86_vectorcallcc()
434; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
435declare cc81 void @f.cc81()
436; CHECK: declare hhvmcc void @f.cc81()
437declare hhvmcc void @f.hhvmcc()
438; CHECK: declare hhvmcc void @f.hhvmcc()
439declare cc82 void @f.cc82()
440; CHECK: declare hhvm_ccc void @f.cc82()
441declare hhvm_ccc void @f.hhvm_ccc()
442; CHECK: declare hhvm_ccc void @f.hhvm_ccc()
443declare cc83 void @f.cc83()
444; CHECK: declare x86_intrcc void @f.cc83()
445declare x86_intrcc void @f.x86_intrcc()
446; CHECK: declare x86_intrcc void @f.x86_intrcc()
447declare cc84 void @f.cc84()
448; CHECK: declare avr_intrcc void @f.cc84()
449declare avr_intrcc void @f.avr_intrcc()
450; CHECK: declare avr_intrcc void @f.avr_intrcc()
451declare cc85 void @f.cc85()
452; CHECK: declare avr_signalcc void @f.cc85()
453declare avr_signalcc void @f.avr_signalcc()
454; CHECK: declare avr_signalcc void @f.avr_signalcc()
455declare cc87 void @f.cc87()
456; CHECK: declare amdgpu_vs void @f.cc87()
457declare amdgpu_vs void @f.amdgpu_vs()
458; CHECK: declare amdgpu_vs void @f.amdgpu_vs()
459declare cc88 void @f.cc88()
460; CHECK: declare amdgpu_gs void @f.cc88()
461declare amdgpu_gs void @f.amdgpu_gs()
462; CHECK: declare amdgpu_gs void @f.amdgpu_gs()
463declare cc89 void @f.cc89()
464; CHECK: declare amdgpu_ps void @f.cc89()
465declare amdgpu_ps void @f.amdgpu_ps()
466; CHECK: declare amdgpu_ps void @f.amdgpu_ps()
467declare cc90 void @f.cc90()
468; CHECK: declare amdgpu_cs void @f.cc90()
469declare amdgpu_cs void @f.amdgpu_cs()
470; CHECK: declare amdgpu_cs void @f.amdgpu_cs()
471declare cc91 void @f.cc91()
472; CHECK: declare amdgpu_kernel void @f.cc91()
473declare amdgpu_kernel void @f.amdgpu_kernel()
474; CHECK: declare amdgpu_kernel void @f.amdgpu_kernel()
475declare cc1023 void @f.cc1023()
476; CHECK: declare cc1023 void @f.cc1023()
477
478; Functions -- ret attrs (Return attributes)
479declare zeroext i64 @f.zeroext()
480; CHECK: declare zeroext i64 @f.zeroext()
481declare signext i64 @f.signext()
482; CHECK: declare signext i64 @f.signext()
483declare inreg i32* @f.inreg()
484; CHECK: declare inreg i32* @f.inreg()
485declare noalias i32* @f.noalias()
486; CHECK: declare noalias i32* @f.noalias()
487declare nonnull i32* @f.nonnull()
488; CHECK: declare nonnull i32* @f.nonnull()
489declare dereferenceable(4) i32* @f.dereferenceable4()
490; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
491declare dereferenceable(8) i32* @f.dereferenceable8()
492; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
493declare dereferenceable(16) i32* @f.dereferenceable16()
494; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
495declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
496; CHECK: declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
497declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
498; CHECK: declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
499declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
500; CHECK: declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
501
502; Functions -- Parameter attributes
503declare void @f.param.zeroext(i8 zeroext)
504; CHECK: declare void @f.param.zeroext(i8 zeroext)
505declare void @f.param.signext(i8 signext)
506; CHECK: declare void @f.param.signext(i8 signext)
507declare void @f.param.inreg(i8 inreg)
508; CHECK: declare void @f.param.inreg(i8 inreg)
509declare void @f.param.byval({ i8, i8 }* byval)
510; CHECK: declare void @f.param.byval({ i8, i8 }* byval)
511declare void @f.param.inalloca(i8* inalloca)
512; CHECK: declare void @f.param.inalloca(i8* inalloca)
513declare void @f.param.sret(i8* sret)
514; CHECK: declare void @f.param.sret(i8* sret)
515declare void @f.param.noalias(i8* noalias)
516; CHECK: declare void @f.param.noalias(i8* noalias)
517declare void @f.param.nocapture(i8* nocapture)
518; CHECK: declare void @f.param.nocapture(i8* nocapture)
519declare void @f.param.nest(i8* nest)
520; CHECK: declare void @f.param.nest(i8* nest)
521declare i8* @f.param.returned(i8* returned)
522; CHECK: declare i8* @f.param.returned(i8* returned)
523declare void @f.param.nonnull(i8* nonnull)
524; CHECK: declare void @f.param.nonnull(i8* nonnull)
525declare void @f.param.dereferenceable(i8* dereferenceable(4))
526; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
527declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
528; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
529
530; Functions -- unnamed_addr and local_unnamed_addr
531declare void @f.unnamed_addr() unnamed_addr
532; CHECK: declare void @f.unnamed_addr() unnamed_addr
533declare void @f.local_unnamed_addr() local_unnamed_addr
534; CHECK: declare void @f.local_unnamed_addr() local_unnamed_addr
535
536; Functions -- fn Attrs (Function attributes)
537declare void @f.alignstack4() alignstack(4)
538; CHECK: declare void @f.alignstack4() #0
539declare void @f.alignstack8() alignstack(8)
540; CHECK: declare void @f.alignstack8() #1
541declare void @f.alwaysinline() alwaysinline
542; CHECK: declare void @f.alwaysinline() #2
543declare void @f.cold() cold
544; CHECK: declare void @f.cold() #3
545declare void @f.convergent() convergent
546; CHECK: declare void @f.convergent() #4
547declare void @f.inlinehint() inlinehint
548; CHECK: declare void @f.inlinehint() #5
549declare void @f.jumptable() unnamed_addr jumptable
550; CHECK: declare void @f.jumptable() unnamed_addr #6
551declare void @f.minsize() minsize
552; CHECK: declare void @f.minsize() #7
553declare void @f.naked() naked
554; CHECK: declare void @f.naked() #8
555declare void @f.nobuiltin() nobuiltin
556; CHECK: declare void @f.nobuiltin() #9
557declare void @f.noduplicate() noduplicate
558; CHECK: declare void @f.noduplicate() #10
559declare void @f.noimplicitfloat() noimplicitfloat
560; CHECK: declare void @f.noimplicitfloat() #11
561declare void @f.noinline() noinline
562; CHECK: declare void @f.noinline() #12
563declare void @f.nonlazybind() nonlazybind
564; CHECK: declare void @f.nonlazybind() #13
565declare void @f.noredzone() noredzone
566; CHECK: declare void @f.noredzone() #14
567declare void @f.noreturn() noreturn
568; CHECK: declare void @f.noreturn() #15
569declare void @f.nounwind() nounwind
570; CHECK: declare void @f.nounwind() #16
571declare void @f.optnone() noinline optnone
572; CHECK: declare void @f.optnone() #17
573declare void @f.optsize() optsize
574; CHECK: declare void @f.optsize() #18
575declare void @f.readnone() readnone
576; CHECK: declare void @f.readnone() #19
577declare void @f.readonly() readonly
578; CHECK: declare void @f.readonly() #20
579declare void @f.returns_twice() returns_twice
580; CHECK: declare void @f.returns_twice() #21
581declare void @f.safestack() safestack
582; CHECK: declare void @f.safestack() #22
583declare void @f.sanitize_address() sanitize_address
584; CHECK: declare void @f.sanitize_address() #23
585declare void @f.sanitize_memory() sanitize_memory
586; CHECK: declare void @f.sanitize_memory() #24
587declare void @f.sanitize_thread() sanitize_thread
588; CHECK: declare void @f.sanitize_thread() #25
589declare void @f.ssp() ssp
590; CHECK: declare void @f.ssp() #26
591declare void @f.sspreq() sspreq
592; CHECK: declare void @f.sspreq() #27
593declare void @f.sspstrong() sspstrong
594; CHECK: declare void @f.sspstrong() #28
595declare void @f.thunk() "thunk"
596; CHECK: declare void @f.thunk() #29
597declare void @f.uwtable() uwtable
598; CHECK: declare void @f.uwtable() #30
599declare void @f.kvpair() "cpu"="cortex-a8"
600; CHECK:declare void @f.kvpair() #31
601declare void @f.norecurse() norecurse
602; CHECK: declare void @f.norecurse() #32
603declare void @f.inaccessiblememonly() inaccessiblememonly
604; CHECK: declare void @f.inaccessiblememonly() #33
605declare void @f.inaccessiblemem_or_argmemonly() inaccessiblemem_or_argmemonly
606; CHECK: declare void @f.inaccessiblemem_or_argmemonly() #34
607
608; Functions -- section
609declare void @f.section() section "80"
610; CHECK: declare void @f.section() section "80"
611
612; Functions -- comdat
613define void @f.comdat_any() comdat($comdat.any) {
614; CHECK: define void @f.comdat_any() comdat($comdat.any)
615entry:
616  ret void
617}
618define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
619; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
620entry:
621  ret void
622}
623define void @f.comdat_largest() comdat($comdat.largest) {
624; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
625entry:
626  ret void
627}
628define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
629; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
630entry:
631  ret void
632}
633define void @f.comdat_samesize() comdat($comdat.samesize) {
634; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
635entry:
636  ret void
637}
638
639; Functions -- align
640declare void @f.align2() align 2
641; CHECK: declare void @f.align2() align 2
642declare void @f.align4() align 4
643; CHECK: declare void @f.align4() align 4
644declare void @f.align8() align 8
645; CHECK: declare void @f.align8() align 8
646
647; Functions -- GC
648declare void @f.gcshadow() gc "shadow-stack"
649; CHECK: declare void @f.gcshadow() gc "shadow-stack"
650
651; Functions -- Prefix data
652declare void @f.prefixi32() prefix i32 1684365668
653; CHECK: declare void @f.prefixi32() prefix i32 1684365668
654declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
655; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
656
657; Functions -- Prologue data
658declare void @f.prologuei32() prologue i32 1684365669
659; CHECK: declare void @f.prologuei32() prologue i32 1684365669
660declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
661; CHECK: declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
662
663; Functions -- Personality constant
664declare void @llvm.donothing() nounwind readnone
665; CHECK: declare void @llvm.donothing() #35
666define void @f.no_personality() personality i8 3 {
667; CHECK: define void @f.no_personality() personality i8 3
668  invoke void @llvm.donothing() to label %normal unwind label %exception
669exception:
670  %cleanup = landingpad i8 cleanup
671  br label %normal
672normal:
673  ret void
674}
675
676declare i32 @f.personality_handler()
677; CHECK: declare i32 @f.personality_handler()
678define void @f.personality() personality i32 ()* @f.personality_handler {
679; CHECK: define void @f.personality() personality i32 ()* @f.personality_handler
680  invoke void @llvm.donothing() to label %normal unwind label %exception
681exception:
682  %cleanup = landingpad i32 cleanup
683  br label %normal
684normal:
685  ret void
686}
687
688;; Atomic Memory Ordering Constraints
689define void @atomics(i32* %word) {
690  %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
691  ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
692  %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
693  ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
694  %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
695  ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
696  %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
697  ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
698  %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
699  ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
700  %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
701  ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
702  %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
703  ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
704  %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
705  ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
706  %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
707  ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
708  %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
709  ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
710  %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
711  ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
712  %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
713  ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
714  %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
715  ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
716  %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
717  ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
718  %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
719  ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
720  %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
721  ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
722  %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
723  ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
724  %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
725  ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
726  %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
727  ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
728  fence acquire
729  ; CHECK: fence acquire
730  fence release
731  ; CHECK: fence release
732  fence acq_rel
733  ; CHECK: fence acq_rel
734  fence singlethread seq_cst
735  ; CHECK: fence singlethread seq_cst
736
737  %ld.1 = load atomic i32, i32* %word monotonic, align 4
738  ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
739  %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
740  ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
741  %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
742  ; CHECK: %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
743
744  store atomic i32 23, i32* %word monotonic, align 4
745  ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
746  store atomic volatile i32 24, i32* %word monotonic, align 4
747  ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
748  store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
749  ; CHECK: store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
750  ret void
751}
752
753;; Fast Math Flags
754define void @fastmathflags(float %op1, float %op2) {
755  %f.nnan = fadd nnan float %op1, %op2
756  ; CHECK: %f.nnan = fadd nnan float %op1, %op2
757  %f.ninf = fadd ninf float %op1, %op2
758  ; CHECK: %f.ninf = fadd ninf float %op1, %op2
759  %f.nsz = fadd nsz float %op1, %op2
760  ; CHECK: %f.nsz = fadd nsz float %op1, %op2
761  %f.arcp = fadd arcp float %op1, %op2
762  ; CHECK: %f.arcp = fadd arcp float %op1, %op2
763  %f.fast = fadd fast float %op1, %op2
764  ; CHECK: %f.fast = fadd fast float %op1, %op2
765  ret void
766}
767
768; Check various fast math flags and floating-point types on calls.
769
770declare float @fmf1()
771declare double @fmf2()
772declare <4 x double> @fmf3()
773
774; CHECK-LABEL: fastMathFlagsForCalls(
775define void @fastMathFlagsForCalls(float %f, double %d1, <4 x double> %d2) {
776  %call.fast = call fast float @fmf1()
777  ; CHECK: %call.fast = call fast float @fmf1()
778
779  ; Throw in some other attributes to make sure those stay in the right places.
780
781  %call.nsz.arcp = notail call nsz arcp double @fmf2()
782  ; CHECK: %call.nsz.arcp = notail call nsz arcp double @fmf2()
783
784  %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
785  ; CHECK: %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
786
787  ret void
788}
789
790;; Type System
791%opaquety = type opaque
792define void @typesystem() {
793  %p0 = bitcast i8* null to i32 (i32)*
794  ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
795  %p1 = bitcast i8* null to void (i8*)*
796  ; CHECK: %p1 = bitcast i8* null to void (i8*)*
797  %p2 = bitcast i8* null to i32 (i8*, ...)*
798  ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
799  %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
800  ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
801  %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
802  ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
803  %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
804  ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
805
806  %t0 = alloca i1942652
807  ; CHECK: %t0 = alloca i1942652
808  %t1 = alloca half
809  ; CHECK: %t1 = alloca half
810  %t2 = alloca float
811  ; CHECK: %t2 = alloca float
812  %t3 = alloca double
813  ; CHECK: %t3 = alloca double
814  %t4 = alloca fp128
815  ; CHECK: %t4 = alloca fp128
816  %t5 = alloca x86_fp80
817  ; CHECK: %t5 = alloca x86_fp80
818  %t6 = alloca ppc_fp128
819  ; CHECK: %t6 = alloca ppc_fp128
820  %t7 = alloca x86_mmx
821  ; CHECK: %t7 = alloca x86_mmx
822  %t8 = alloca %opaquety*
823  ; CHECK: %t8 = alloca %opaquety*
824
825  ret void
826}
827
828declare void @llvm.token(token)
829; CHECK: declare void @llvm.token(token)
830
831;; Inline Assembler Expressions
832define void @inlineasm(i32 %arg) {
833  call i32 asm "bswap $0", "=r,r"(i32 %arg)
834  ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
835  call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
836  ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
837  ret void
838}
839
840;; Instructions
841
842; Instructions -- Terminators
843define void @instructions.terminators(i8 %val) personality i32 -10 {
844  br i1 false, label %iftrue, label %iffalse
845  ; CHECK: br i1 false, label %iftrue, label %iffalse
846  br label %iftrue
847  ; CHECK: br label %iftrue
848iftrue:
849  ret void
850  ; CHECK: ret void
851iffalse:
852
853  switch i8 %val, label %defaultdest [
854  ; CHECK: switch i8 %val, label %defaultdest [
855         i8 0, label %defaultdest.0
856         ; CHECK: i8 0, label %defaultdest.0
857         i8 1, label %defaultdest.1
858         ; CHECK: i8 1, label %defaultdest.1
859         i8 2, label %defaultdest.2
860         ; CHECK: i8 2, label %defaultdest.2
861  ]
862  ; CHECK: ]
863defaultdest:
864  ret void
865defaultdest.0:
866  ret void
867defaultdest.1:
868  ret void
869defaultdest.2:
870
871  indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
872  ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
873  indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
874  ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
875
876  invoke fastcc void @f.fastcc()
877  ; CHECK: invoke fastcc void @f.fastcc()
878         to label %defaultdest unwind label %exc
879         ; CHECK: to label %defaultdest unwind label %exc
880exc:
881  %cleanup = landingpad i32 cleanup
882
883  resume i32 undef
884  ; CHECK: resume i32 undef
885  unreachable
886  ; CHECK: unreachable
887
888  ret void
889}
890
891define i32 @instructions.win_eh.1() personality i32 -3 {
892entry:
893  %arg1 = alloca i32
894  %arg2 = alloca i32
895  invoke void @f.ccc() to label %normal unwind label %catchswitch1
896  invoke void @f.ccc() to label %normal unwind label %catchswitch2
897  invoke void @f.ccc() to label %normal unwind label %catchswitch3
898
899catchswitch1:
900  %cs1 = catchswitch within none [label %catchpad1] unwind to caller
901
902catchpad1:
903  catchpad within %cs1 []
904  br label %normal
905  ; CHECK: catchpad within %cs1 []
906  ; CHECK-NEXT: br label %normal
907
908catchswitch2:
909  %cs2 = catchswitch within none [label %catchpad2] unwind to caller
910
911catchpad2:
912  catchpad within %cs2 [i32* %arg1]
913  br label %normal
914  ; CHECK: catchpad within %cs2 [i32* %arg1]
915  ; CHECK-NEXT: br label %normal
916
917catchswitch3:
918  %cs3 = catchswitch within none [label %catchpad3] unwind label %cleanuppad1
919
920catchpad3:
921  catchpad within %cs3 [i32* %arg1, i32* %arg2]
922  br label %normal
923  ; CHECK: catchpad within %cs3 [i32* %arg1, i32* %arg2]
924  ; CHECK-NEXT: br label %normal
925
926cleanuppad1:
927  %clean.1 = cleanuppad within none []
928  unreachable
929  ; CHECK: %clean.1 = cleanuppad within none []
930  ; CHECK-NEXT: unreachable
931
932normal:
933  ret i32 0
934}
935;
936define i32 @instructions.win_eh.2() personality i32 -4 {
937entry:
938  invoke void @f.ccc() to label %invoke.cont unwind label %catchswitch
939
940invoke.cont:
941  invoke void @f.ccc() to label %continue unwind label %cleanup
942
943cleanup:
944  %clean = cleanuppad within none []
945  ; CHECK: %clean = cleanuppad within none []
946  cleanupret from %clean unwind to caller
947  ; CHECK: cleanupret from %clean unwind to caller
948
949catchswitch:
950  %cs = catchswitch within none [label %catchpad] unwind label %terminate
951
952catchpad:
953  %catch = catchpad within %cs []
954  br label %body
955  ; CHECK: %catch = catchpad within %cs []
956  ; CHECK-NEXT: br label %body
957
958body:
959  invoke void @f.ccc() [ "funclet"(token %catch) ]
960    to label %continue unwind label %terminate.inner
961  catchret from %catch to label %return
962  ; CHECK: catchret from %catch to label %return
963
964return:
965  ret i32 0
966
967terminate.inner:
968  cleanuppad within %catch []
969  unreachable
970  ; CHECK: cleanuppad within %catch []
971  ; CHECK-NEXT: unreachable
972
973terminate:
974  cleanuppad within none []
975  unreachable
976  ; CHECK: cleanuppad within none []
977  ; CHECK-NEXT: unreachable
978
979continue:
980  ret i32 0
981}
982
983; Instructions -- Binary Operations
984define void @instructions.binops(i8 %op1, i8 %op2) {
985  ; nuw x nsw
986  add i8 %op1, %op2
987  ; CHECK: add i8 %op1, %op2
988  add nuw i8 %op1, %op2
989  ; CHECK: add nuw i8 %op1, %op2
990  add nsw i8 %op1, %op2
991  ; CHECK: add nsw i8 %op1, %op2
992  add nuw nsw i8 %op1, %op2
993  ; CHECK: add nuw nsw i8 %op1, %op2
994  sub i8 %op1, %op2
995  ; CHECK: sub i8 %op1, %op2
996  sub nuw i8 %op1, %op2
997  ; CHECK: sub nuw i8 %op1, %op2
998  sub nsw i8 %op1, %op2
999  ; CHECK: sub nsw i8 %op1, %op2
1000  sub nuw nsw i8 %op1, %op2
1001  ; CHECK: sub nuw nsw i8 %op1, %op2
1002  mul i8 %op1, %op2
1003  ; CHECK: mul i8 %op1, %op2
1004  mul nuw i8 %op1, %op2
1005  ; CHECK: mul nuw i8 %op1, %op2
1006  mul nsw i8 %op1, %op2
1007  ; CHECK: mul nsw i8 %op1, %op2
1008  mul nuw nsw i8 %op1, %op2
1009  ; CHECK: mul nuw nsw i8 %op1, %op2
1010
1011  ; exact
1012  udiv i8 %op1, %op2
1013  ; CHECK: udiv i8 %op1, %op2
1014  udiv exact i8 %op1, %op2
1015  ; CHECK: udiv exact i8 %op1, %op2
1016  sdiv i8 %op1, %op2
1017  ; CHECK: sdiv i8 %op1, %op2
1018  sdiv exact i8 %op1, %op2
1019  ; CHECK: sdiv exact i8 %op1, %op2
1020
1021  ; none
1022  urem i8 %op1, %op2
1023  ; CHECK: urem i8 %op1, %op2
1024  srem i8 %op1, %op2
1025  ; CHECK: srem i8 %op1, %op2
1026
1027  ret void
1028}
1029
1030; Instructions -- Bitwise Binary Operations
1031define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
1032  ; nuw x nsw
1033  shl i8 %op1, %op2
1034  ; CHECK: shl i8 %op1, %op2
1035  shl nuw i8 %op1, %op2
1036  ; CHECK: shl nuw i8 %op1, %op2
1037  shl nsw i8 %op1, %op2
1038  ; CHECK: shl nsw i8 %op1, %op2
1039  shl nuw nsw i8 %op1, %op2
1040  ; CHECK: shl nuw nsw i8 %op1, %op2
1041
1042  ; exact
1043  lshr i8 %op1, %op2
1044  ; CHECK: lshr i8 %op1, %op2
1045  lshr exact i8 %op1, %op2
1046  ; CHECK: lshr exact i8 %op1, %op2
1047  ashr i8 %op1, %op2
1048  ; CHECK: ashr i8 %op1, %op2
1049  ashr exact i8 %op1, %op2
1050  ; CHECK: ashr exact i8 %op1, %op2
1051
1052  ; none
1053  and i8 %op1, %op2
1054  ; CHECK: and i8 %op1, %op2
1055  or i8 %op1, %op2
1056  ; CHECK: or i8 %op1, %op2
1057  xor i8 %op1, %op2
1058  ; CHECK: xor i8 %op1, %op2
1059
1060  ret void
1061}
1062
1063; Instructions -- Vector Operations
1064define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
1065  extractelement <4 x float> %vec, i8 0
1066  ; CHECK: extractelement <4 x float> %vec, i8 0
1067  insertelement <4 x float> %vec, float 3.500000e+00, i8 0
1068  ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
1069  shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
1070  ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
1071
1072  ret void
1073}
1074
1075; Instructions -- Aggregate Operations
1076define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
1077                                       [3 x i8] %arr, { i8, { i32 }} %n,
1078                                       <2 x i8*> %pvec, <2 x i64> %offsets) {
1079  extractvalue { i8, i32 } %up, 0
1080  ; CHECK: extractvalue { i8, i32 } %up, 0
1081  extractvalue <{ i8, i32 }> %p, 1
1082  ; CHECK: extractvalue <{ i8, i32 }> %p, 1
1083  extractvalue [3 x i8] %arr, 2
1084  ; CHECK: extractvalue [3 x i8] %arr, 2
1085  extractvalue { i8, { i32 } } %n, 1, 0
1086  ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
1087
1088  insertvalue { i8, i32 } %up, i8 1, 0
1089  ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
1090  insertvalue <{ i8, i32 }> %p, i32 2, 1
1091  ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
1092  insertvalue [3 x i8] %arr, i8 0, 0
1093  ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
1094  insertvalue { i8, { i32 } } %n, i32 0, 1, 0
1095  ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
1096
1097  %up.ptr = alloca { i8, i32 }
1098  %p.ptr = alloca <{ i8, i32 }>
1099  %arr.ptr = alloca [3 x i8]
1100  %n.ptr = alloca { i8, { i32 } }
1101
1102  getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
1103  ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
1104  getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
1105  ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
1106  getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
1107  ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
1108  getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
1109  ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
1110  getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
1111  ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
1112  getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
1113  ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
1114
1115  ret void
1116}
1117
1118; Instructions -- Memory Access and Addressing Operations
1119!7 = !{i32 1}
1120!8 = !{}
1121!9 = !{i64 4}
1122define void @instructions.memops(i32** %base) {
1123  alloca i32, i8 4, align 4
1124  ; CHECK: alloca i32, i8 4, align 4
1125  alloca inalloca i32, i8 4, align 4
1126  ; CHECK: alloca inalloca i32, i8 4, align 4
1127
1128  load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1129  ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1130  load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1131  ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
1132
1133  store i32* null, i32** %base, align 4, !nontemporal !8
1134  ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
1135  store volatile i32* null, i32** %base, align 4, !nontemporal !8
1136  ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
1137
1138  ret void
1139}
1140
1141; Instructions -- Conversion Operations
1142define void @instructions.conversions() {
1143  trunc i32 -1 to i1
1144  ; CHECK: trunc i32 -1 to i1
1145  zext i32 -1 to i64
1146  ; CHECK: zext i32 -1 to i64
1147  sext i32 -1 to i64
1148  ; CHECK: sext i32 -1 to i64
1149  fptrunc float undef to half
1150  ; CHECK: fptrunc float undef to half
1151  fpext half undef to float
1152  ; CHECK: fpext half undef to float
1153  fptoui float undef to i32
1154  ; CHECK: fptoui float undef to i32
1155  fptosi float undef to i32
1156  ; CHECK: fptosi float undef to i32
1157  uitofp i32 1 to float
1158  ; CHECK: uitofp i32 1 to float
1159  sitofp i32 -1 to float
1160  ; CHECK: sitofp i32 -1 to float
1161  ptrtoint i8* null to i64
1162  ; CHECK: ptrtoint i8* null to i64
1163  inttoptr i64 0 to i8*
1164  ; CHECK: inttoptr i64 0 to i8*
1165  bitcast i32 0 to i32
1166  ; CHECK: bitcast i32 0 to i32
1167  addrspacecast i32* null to i32 addrspace(1)*
1168  ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
1169
1170  ret void
1171}
1172
1173; Instructions -- Other Operations
1174define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
1175entry:
1176  icmp eq  i32 %op1, %op2
1177  ; CHECK: icmp eq  i32 %op1, %op2
1178  icmp ne  i32 %op1, %op2
1179  ; CHECK: icmp ne  i32 %op1, %op2
1180  icmp ugt i32 %op1, %op2
1181  ; CHECK: icmp ugt i32 %op1, %op2
1182  icmp uge i32 %op1, %op2
1183  ; CHECK: icmp uge i32 %op1, %op2
1184  icmp ult i32 %op1, %op2
1185  ; CHECK: icmp ult i32 %op1, %op2
1186  icmp ule i32 %op1, %op2
1187  ; CHECK: icmp ule i32 %op1, %op2
1188  icmp sgt i32 %op1, %op2
1189  ; CHECK: icmp sgt i32 %op1, %op2
1190  icmp sge i32 %op1, %op2
1191  ; CHECK: icmp sge i32 %op1, %op2
1192  icmp slt i32 %op1, %op2
1193  ; CHECK: icmp slt i32 %op1, %op2
1194  icmp sle i32 %op1, %op2
1195  ; CHECK: icmp sle i32 %op1, %op2
1196
1197  fcmp false half %fop1, %fop2
1198  ; CHECK: fcmp false half %fop1, %fop2
1199  fcmp oeq   half %fop1, %fop2
1200  ; CHECK: fcmp oeq   half %fop1, %fop2
1201  fcmp ogt   half %fop1, %fop2
1202  ; CHECK: fcmp ogt   half %fop1, %fop2
1203  fcmp oge   half %fop1, %fop2
1204  ; CHECK: fcmp oge   half %fop1, %fop2
1205  fcmp olt   half %fop1, %fop2
1206  ; CHECK: fcmp olt   half %fop1, %fop2
1207  fcmp ole   half %fop1, %fop2
1208  ; CHECK: fcmp ole   half %fop1, %fop2
1209  fcmp one   half %fop1, %fop2
1210  ; CHECK: fcmp one   half %fop1, %fop2
1211  fcmp ord   half %fop1, %fop2
1212  ; CHECK: fcmp ord   half %fop1, %fop2
1213  fcmp ueq   half %fop1, %fop2
1214  ; CHECK: fcmp ueq   half %fop1, %fop2
1215  fcmp ugt   half %fop1, %fop2
1216  ; CHECK: fcmp ugt   half %fop1, %fop2
1217  fcmp uge   half %fop1, %fop2
1218  ; CHECK: fcmp uge   half %fop1, %fop2
1219  fcmp ult   half %fop1, %fop2
1220  ; CHECK: fcmp ult   half %fop1, %fop2
1221  fcmp ule   half %fop1, %fop2
1222  ; CHECK: fcmp ule   half %fop1, %fop2
1223  fcmp une   half %fop1, %fop2
1224  ; CHECK: fcmp une   half %fop1, %fop2
1225  fcmp uno   half %fop1, %fop2
1226  ; CHECK: fcmp uno   half %fop1, %fop2
1227  fcmp true  half %fop1, %fop2
1228  ; CHECK: fcmp true  half %fop1, %fop2
1229
1230  br label %exit
1231L1:
1232  %v1 = add i32 %op1, %op2
1233  br label %exit
1234L2:
1235  %v2 = add i32 %op1, %op2
1236  br label %exit
1237exit:
1238  phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1239  ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
1240
1241  select i1 true, i32 0, i32 1
1242  ; CHECK: select i1 true, i32 0, i32 1
1243  select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
1244  ; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
1245
1246  call void @f.nobuiltin() builtin
1247  ; CHECK: call void @f.nobuiltin() #40
1248
1249  call fastcc noalias i32* @f.noalias() noinline
1250  ; CHECK: call fastcc noalias i32* @f.noalias() #12
1251  tail call ghccc nonnull i32* @f.nonnull() minsize
1252  ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #7
1253
1254  ret void
1255}
1256
1257define void @instructions.call_musttail(i8* inalloca %val) {
1258  musttail call void @f.param.inalloca(i8* inalloca %val)
1259  ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
1260
1261  ret void
1262}
1263
1264define void @instructions.call_notail() {
1265  notail call void @f1()
1266  ; CHECK: notail call void @f1()
1267
1268  ret void
1269}
1270
1271define void @instructions.landingpad() personality i32 -2 {
1272  invoke void @llvm.donothing() to label %proceed unwind label %catch1
1273  invoke void @llvm.donothing() to label %proceed unwind label %catch2
1274  invoke void @llvm.donothing() to label %proceed unwind label %catch3
1275  invoke void @llvm.donothing() to label %proceed unwind label %catch4
1276
1277catch1:
1278  landingpad i32
1279  ; CHECK: landingpad i32
1280             cleanup
1281             ; CHECK: cleanup
1282  br label %proceed
1283
1284catch2:
1285  landingpad i32
1286  ; CHECK: landingpad i32
1287             cleanup
1288             ; CHECK: cleanup
1289             catch i32* null
1290             ; CHECK: catch i32* null
1291  br label %proceed
1292
1293catch3:
1294  landingpad i32
1295  ; CHECK: landingpad i32
1296             cleanup
1297             ; CHECK: cleanup
1298             catch i32* null
1299             ; CHECK: catch i32* null
1300             catch i32* null
1301             ; CHECK: catch i32* null
1302  br label %proceed
1303
1304catch4:
1305  landingpad i32
1306  ; CHECK: landingpad i32
1307             filter [2 x i32] zeroinitializer
1308             ; CHECK: filter [2 x i32] zeroinitializer
1309  br label %proceed
1310
1311proceed:
1312  ret void
1313}
1314
1315;; Intrinsic Functions
1316
1317; Intrinsic Functions -- Variable Argument Handling
1318declare void @llvm.va_start(i8*)
1319declare void @llvm.va_copy(i8*, i8*)
1320declare void @llvm.va_end(i8*)
1321define void @instructions.va_arg(i8* %v, ...) {
1322  %ap = alloca i8*
1323  %ap2 = bitcast i8** %ap to i8*
1324
1325  call void @llvm.va_start(i8* %ap2)
1326  ; CHECK: call void @llvm.va_start(i8* %ap2)
1327
1328  va_arg i8* %ap2, i32
1329  ; CHECK: va_arg i8* %ap2, i32
1330
1331  call void @llvm.va_copy(i8* %v, i8* %ap2)
1332  ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
1333
1334  call void @llvm.va_end(i8* %ap2)
1335  ; CHECK: call void @llvm.va_end(i8* %ap2)
1336
1337  ret void
1338}
1339
1340; Intrinsic Functions -- Accurate Garbage Collection
1341declare void @llvm.gcroot(i8**, i8*)
1342declare i8* @llvm.gcread(i8*, i8**)
1343declare void @llvm.gcwrite(i8*, i8*, i8**)
1344define void @intrinsics.gc() gc "shadow-stack" {
1345  %ptrloc = alloca i8*
1346  call void @llvm.gcroot(i8** %ptrloc, i8* null)
1347  ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
1348
1349  call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1350  ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1351
1352  %ref = alloca i8
1353  call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1354  ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1355
1356  ret void
1357}
1358
1359; Intrinsic Functions -- Code Generation
1360declare i8* @llvm.returnaddress(i32)
1361declare i8* @llvm.frameaddress(i32)
1362declare i32 @llvm.read_register.i32(metadata)
1363declare i64 @llvm.read_register.i64(metadata)
1364declare void @llvm.write_register.i32(metadata, i32)
1365declare void @llvm.write_register.i64(metadata, i64)
1366declare i8* @llvm.stacksave()
1367declare void @llvm.stackrestore(i8*)
1368declare void @llvm.prefetch(i8*, i32, i32, i32)
1369declare void @llvm.pcmarker(i32)
1370declare i64 @llvm.readcyclecounter()
1371declare void @llvm.clear_cache(i8*, i8*)
1372declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
1373
1374!10 = !{!"rax"}
1375define void @intrinsics.codegen() {
1376  call i8* @llvm.returnaddress(i32 1)
1377  ; CHECK: call i8* @llvm.returnaddress(i32 1)
1378  call i8* @llvm.frameaddress(i32 1)
1379  ; CHECK: call i8* @llvm.frameaddress(i32 1)
1380
1381  call i32 @llvm.read_register.i32(metadata !10)
1382  ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
1383  call i64 @llvm.read_register.i64(metadata !10)
1384  ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
1385  call void @llvm.write_register.i32(metadata !10, i32 0)
1386  ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
1387  call void @llvm.write_register.i64(metadata !10, i64 0)
1388  ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
1389
1390  %stack = call i8* @llvm.stacksave()
1391  ; CHECK: %stack = call i8* @llvm.stacksave()
1392  call void @llvm.stackrestore(i8* %stack)
1393  ; CHECK: call void @llvm.stackrestore(i8* %stack)
1394
1395  call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1396  ; CHECK: call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1397
1398  call void @llvm.pcmarker(i32 1)
1399  ; CHECK: call void @llvm.pcmarker(i32 1)
1400
1401  call i64 @llvm.readcyclecounter()
1402  ; CHECK: call i64 @llvm.readcyclecounter()
1403
1404  call void @llvm.clear_cache(i8* null, i8* null)
1405  ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
1406
1407  call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1408  ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1409
1410  ret void
1411}
1412
1413declare void @llvm.localescape(...)
1414declare i8* @llvm.localrecover(i8* %func, i8* %fp, i32 %idx)
1415define void @intrinsics.localescape() {
1416  %static.alloca = alloca i32
1417  call void (...) @llvm.localescape(i32* %static.alloca)
1418  ; CHECK: call void (...) @llvm.localescape(i32* %static.alloca)
1419
1420  call void @intrinsics.localrecover()
1421
1422  ret void
1423}
1424define void @intrinsics.localrecover() {
1425  %func = bitcast void ()* @intrinsics.localescape to i8*
1426  %fp = call i8* @llvm.frameaddress(i32 1)
1427  call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1428  ; CHECK: call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
1429
1430  ret void
1431}
1432
1433; We need this function to provide `uses' for some metadata tests.
1434define void @misc.metadata() {
1435  call void @f1(), !srcloc !11
1436  call void @f1(), !srcloc !12
1437  call void @f1(), !srcloc !13
1438  call void @f1(), !srcloc !14
1439  ret void
1440}
1441
1442declare void @op_bundle_callee_0()
1443declare void @op_bundle_callee_1(i32,i32)
1444
1445define void @call_with_operand_bundle0(i32* %ptr) {
1446; CHECK-LABEL: call_with_operand_bundle0(
1447 entry:
1448  %l = load i32, i32* %ptr
1449  %x = add i32 42, 1
1450  call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
1451; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
1452  ret void
1453}
1454
1455define void @call_with_operand_bundle1(i32* %ptr) {
1456; CHECK-LABEL: call_with_operand_bundle1(
1457 entry:
1458  %l = load i32, i32* %ptr
1459  %x = add i32 42, 1
1460
1461  call void @op_bundle_callee_0()
1462  call void @op_bundle_callee_0() [ "foo"() ]
1463  call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
1464; CHECK: @op_bundle_callee_0(){{$}}
1465; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"() ]
1466; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
1467  ret void
1468}
1469
1470define void @call_with_operand_bundle2(i32* %ptr) {
1471; CHECK-LABEL: call_with_operand_bundle2(
1472 entry:
1473  call void @op_bundle_callee_0() [ "foo"() ]
1474; CHECK: call void @op_bundle_callee_0() [ "foo"() ]
1475  ret void
1476}
1477
1478define void @call_with_operand_bundle3(i32* %ptr) {
1479; CHECK-LABEL: call_with_operand_bundle3(
1480 entry:
1481  %l = load i32, i32* %ptr
1482  %x = add i32 42, 1
1483  call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
1484; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
1485  ret void
1486}
1487
1488define void @call_with_operand_bundle4(i32* %ptr) {
1489; CHECK-LABEL: call_with_operand_bundle4(
1490 entry:
1491  %l = load i32, i32* %ptr
1492  %x = add i32 42, 1
1493  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) ]
1494; 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) ]
1495  ret void
1496}
1497
1498; Invoke versions of the above tests:
1499
1500
1501define void @invoke_with_operand_bundle0(i32* %ptr) personality i8 3 {
1502; CHECK-LABEL: @invoke_with_operand_bundle0(
1503 entry:
1504  %l = load i32, i32* %ptr
1505  %x = add i32 42, 1
1506  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
1507; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
1508
1509exception:
1510  %cleanup = landingpad i8 cleanup
1511  br label %normal
1512normal:
1513  ret void
1514}
1515
1516define void @invoke_with_operand_bundle1(i32* %ptr) personality i8 3 {
1517; CHECK-LABEL: @invoke_with_operand_bundle1(
1518 entry:
1519  %l = load i32, i32* %ptr
1520  %x = add i32 42, 1
1521
1522  invoke void @op_bundle_callee_0() to label %normal unwind label %exception
1523; CHECK: invoke void @op_bundle_callee_0(){{$}}
1524
1525exception:
1526  %cleanup = landingpad i8 cleanup
1527  br label %normal
1528
1529normal:
1530  invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal1 unwind label %exception1
1531; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
1532
1533exception1:
1534  %cleanup1 = landingpad i8 cleanup
1535  br label %normal1
1536
1537normal1:
1538  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
1539; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
1540
1541exception2:
1542  %cleanup2 = landingpad i8 cleanup
1543  br label %normal2
1544
1545normal2:
1546  ret void
1547}
1548
1549define void @invoke_with_operand_bundle2(i32* %ptr) personality i8 3 {
1550; CHECK-LABEL: @invoke_with_operand_bundle2(
1551 entry:
1552  invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal unwind label %exception
1553; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
1554
1555exception:
1556  %cleanup = landingpad i8 cleanup
1557  br label %normal
1558normal:
1559  ret void
1560}
1561
1562define void @invoke_with_operand_bundle3(i32* %ptr) personality i8 3 {
1563; CHECK-LABEL: @invoke_with_operand_bundle3(
1564 entry:
1565  %l = load i32, i32* %ptr
1566  %x = add i32 42, 1
1567  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
1568; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
1569
1570exception:
1571  %cleanup = landingpad i8 cleanup
1572  br label %normal
1573normal:
1574  ret void
1575}
1576
1577define void @invoke_with_operand_bundle4(i32* %ptr) personality i8 3 {
1578; CHECK-LABEL: @invoke_with_operand_bundle4(
1579 entry:
1580  %l = load i32, i32* %ptr
1581  %x = add i32 42, 1
1582  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) ]
1583        to label %normal unwind label %exception
1584; 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) ]
1585
1586exception:
1587  %cleanup = landingpad i8 cleanup
1588  br label %normal
1589normal:
1590  ret void
1591}
1592
1593declare void @f.writeonly() writeonly
1594; CHECK: declare void @f.writeonly() #39
1595
1596; CHECK: attributes #0 = { alignstack=4 }
1597; CHECK: attributes #1 = { alignstack=8 }
1598; CHECK: attributes #2 = { alwaysinline }
1599; CHECK: attributes #3 = { cold }
1600; CHECK: attributes #4 = { convergent }
1601; CHECK: attributes #5 = { inlinehint }
1602; CHECK: attributes #6 = { jumptable }
1603; CHECK: attributes #7 = { minsize }
1604; CHECK: attributes #8 = { naked }
1605; CHECK: attributes #9 = { nobuiltin }
1606; CHECK: attributes #10 = { noduplicate }
1607; CHECK: attributes #11 = { noimplicitfloat }
1608; CHECK: attributes #12 = { noinline }
1609; CHECK: attributes #13 = { nonlazybind }
1610; CHECK: attributes #14 = { noredzone }
1611; CHECK: attributes #15 = { noreturn }
1612; CHECK: attributes #16 = { nounwind }
1613; CHECK: attributes #17 = { noinline optnone }
1614; CHECK: attributes #18 = { optsize }
1615; CHECK: attributes #19 = { readnone }
1616; CHECK: attributes #20 = { readonly }
1617; CHECK: attributes #21 = { returns_twice }
1618; CHECK: attributes #22 = { safestack }
1619; CHECK: attributes #23 = { sanitize_address }
1620; CHECK: attributes #24 = { sanitize_memory }
1621; CHECK: attributes #25 = { sanitize_thread }
1622; CHECK: attributes #26 = { ssp }
1623; CHECK: attributes #27 = { sspreq }
1624; CHECK: attributes #28 = { sspstrong }
1625; CHECK: attributes #29 = { "thunk" }
1626; CHECK: attributes #30 = { uwtable }
1627; CHECK: attributes #31 = { "cpu"="cortex-a8" }
1628; CHECK: attributes #32 = { norecurse }
1629; CHECK: attributes #33 = { inaccessiblememonly }
1630; CHECK: attributes #34 = { inaccessiblemem_or_argmemonly }
1631; CHECK: attributes #35 = { nounwind readnone }
1632; CHECK: attributes #36 = { argmemonly nounwind readonly }
1633; CHECK: attributes #37 = { argmemonly nounwind }
1634; CHECK: attributes #38 = { nounwind readonly }
1635; CHECK: attributes #39 = { writeonly }
1636; CHECK: attributes #40 = { builtin }
1637
1638;; Metadata
1639
1640; Metadata -- Module flags
1641!llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1642; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1643
1644!0 = !{i32 1, !"mod1", i32 0}
1645; CHECK: !0 = !{i32 1, !"mod1", i32 0}
1646!1 = !{i32 2, !"mod2", i32 0}
1647; CHECK: !1 = !{i32 2, !"mod2", i32 0}
1648!2 = !{i32 3, !"mod3", !3}
1649; CHECK: !2 = !{i32 3, !"mod3", !3}
1650!3 = !{!"mod6", !0}
1651; CHECK: !3 = !{!"mod6", !0}
1652!4 = !{i32 4, !"mod4", i32 0}
1653; CHECK: !4 = !{i32 4, !"mod4", i32 0}
1654!5 = !{i32 5, !"mod5", !0}
1655; CHECK: !5 = !{i32 5, !"mod5", !0}
1656!6 = !{i32 6, !"mod6", !0}
1657; CHECK: !6 = !{i32 6, !"mod6", !0}
1658
1659; Metadata -- Check `distinct'
1660!11 = distinct !{}
1661; CHECK: !11 = distinct !{}
1662!12 = distinct !{}
1663; CHECK: !12 = distinct !{}
1664!13 = !{!11}
1665; CHECK: !13 = !{!11}
1666!14 = !{!12}
1667; CHECK: !14 = !{!12}
1668