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