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