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