| 1 |
119734787 65536 393230 33 0 |
| 2 |
2 Capability Addresses |
| 3 |
2 Capability Kernel |
| 4 |
5 ExtInstImport 1 "OpenCL.std" |
| 5 |
3 MemoryModel 2 2 |
| 6 |
8 EntryPoint 6 6 "test_atomic_global" |
| 7 |
13 String 32 "kernel_arg_type.test_atomic_global.int*," |
| 8 |
3 Source 3 102000 |
| 9 |
3 Name 7 "dst" |
| 10 |
4 Name 8 "object" |
| 11 |
5 Name 9 "expected" |
| 12 |
4 Name 10 "desired" |
| 13 |
3 Decorate 7 Volatile |
| 14 |
4 TypeInt 3 32 0 |
| 15 |
4 Constant 3 13 1 |
| 16 |
4 Constant 3 14 16 |
| 17 |
4 Constant 3 17 0 |
| 18 |
2 TypeVoid 2 |
| 19 |
4 TypePointer 4 5 3 |
| 20 |
7 TypeFunction 5 2 4 4 4 3 |
| 21 |
2 TypeBool 30 |
| 22 |
|
| 23 |
|
| 24 |
5 Function 2 6 0 5 |
| 25 |
3 FunctionParameter 4 7 |
| 26 |
3 FunctionParameter 4 8 |
| 27 |
3 FunctionParameter 4 9 |
| 28 |
3 FunctionParameter 3 10 |
| 29 |
|
| 30 |
2 Label 11 |
| 31 |
6 AtomicIIncrement 3 12 7 13 14 |
| 32 |
6 AtomicIDecrement 3 15 7 13 14 |
| 33 |
7 AtomicSMax 3 16 7 13 14 17 |
| 34 |
7 AtomicUMax 3 18 7 13 14 17 |
| 35 |
7 AtomicSMin 3 19 7 13 14 17 |
| 36 |
7 AtomicUMin 3 20 7 13 14 17 |
| 37 |
7 AtomicIAdd 3 21 7 13 14 13 |
| 38 |
7 AtomicISub 3 22 7 13 14 13 |
| 39 |
7 AtomicOr 3 23 7 13 14 13 |
| 40 |
7 AtomicXor 3 24 7 13 14 13 |
| 41 |
7 AtomicAnd 3 25 7 13 14 13 |
| 42 |
9 AtomicCompareExchange 3 26 7 13 14 14 13 17 |
| 43 |
9 AtomicCompareExchangeWeak 3 27 7 13 14 14 13 17 |
| 44 |
7 AtomicExchange 3 28 7 13 14 13 |
| 45 |
6 AtomicLoad 3 29 8 13 14 |
| 46 |
5 AtomicStore 8 13 14 10 |
| 47 |
6 AtomicFlagTestAndSet 30 31 8 13 14 |
| 48 |
4 AtomicFlagClear 8 13 14 |
| 49 |
1 Return |
| 50 |
|
| 51 |
1 FunctionEnd |
| 52 |
|
| 53 |
|
| 54 |
; RUN: llvm-spirv %s -to-binary -o %t1.spv |
| 55 |
; RUN: spirv-val %t1.spv |
| 56 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t1.spv -o %t1.bc --spirv-target-env="CL1.2" |
| 57 |
; RUN: llvm-dis < %t1.bc | FileCheck %s --check-prefix=CHECK-LLVM-12 |
| 58 |
|
| 59 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_incPU3AS1Vi(ptr addrspace(1) %dst) [[attr:#[0-9]+]] |
| 60 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_decPU3AS1Vi(ptr addrspace(1) %dst) [[attr]] |
| 61 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_maxPU3AS1Vii(ptr addrspace(1) %dst, i32 0) [[attr]] |
| 62 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_maxPU3AS1Vjj(ptr addrspace(1) %dst, i32 0) [[attr]] |
| 63 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_minPU3AS1Vii(ptr addrspace(1) %dst, i32 0) [[attr]] |
| 64 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_minPU3AS1Vjj(ptr addrspace(1) %dst, i32 0) [[attr]] |
| 65 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_addPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 66 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_subPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 67 |
; CHECK-LLVM-12: call spir_func i32 @_Z9atomic_orPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 68 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_xorPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 69 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_andPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 70 |
; CHECK-LLVM-12-COUNT-2: call spir_func i32 @_Z14atomic_cmpxchgPU3AS1Viii(ptr addrspace(1) %dst, i32 0, i32 1) [[attr]] |
| 71 |
; CHECK-LLVM-12: call spir_func i32 @_Z11atomic_xchgPU3AS1Vii(ptr addrspace(1) %dst, i32 1) [[attr]] |
| 72 |
; CHECK-LLVM-12: call spir_func i32 @_Z10atomic_addPU3AS1Vii(ptr addrspace(1) %object, i32 0) [[attr]] |
| 73 |
; CHECK-LLVM-12: call spir_func i32 @_Z11atomic_xchgPU3AS1Vii(ptr addrspace(1) %object, i32 %desired) [[attr]] |
| 74 |
; CHECK-LLVM-12: %[[XCHG:[0-9a-zA-Z.]+]] = call spir_func i32 @_Z11atomic_xchgPU3AS1Vii(ptr addrspace(1) %object, i32 1) [[attr]] |
| 75 |
; CHECK-LLVM-12: trunc i32 %[[XCHG]] to i1 |
| 76 |
; CHECK-LLVM-12: call spir_func i32 @_Z11atomic_xchgPU3AS1Vii(ptr addrspace(1) %object, i32 0) [[attr]] |
| 77 |
|
| 78 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t1.spv -o %t2.bc --spirv-target-env="CL2.0" |
| 79 |
; RUN: llvm-dis < %t2.bc | FileCheck %s --check-prefix=CHECK-LLVM-20 |
| 80 |
|
| 81 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_add_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as, i32 1, i32 5, i32 2) [[attr:#[0-9]+]] |
| 82 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_sub_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as1, i32 1, i32 5, i32 2) [[attr]] |
| 83 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_max_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as2, i32 0, i32 5, i32 2) [[attr]] |
| 84 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_max_explicitPU3AS4VU7_Atomicjj12memory_order12memory_scope(ptr addrspace(4) %dst.as3, i32 0, i32 5, i32 2) [[attr]] |
| 85 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_min_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as4, i32 0, i32 5, i32 2) [[attr]] |
| 86 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_min_explicitPU3AS4VU7_Atomicjj12memory_order12memory_scope(ptr addrspace(4) %dst.as5, i32 0, i32 5, i32 2) [[attr]] |
| 87 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_add_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as6, i32 1, i32 5, i32 2) [[attr]] |
| 88 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_sub_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as7, i32 1, i32 5, i32 2) [[attr]] |
| 89 |
; CHECK-LLVM-20: call spir_func i32 @_Z24atomic_fetch_or_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as8, i32 1, i32 5, i32 2) [[attr]] |
| 90 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_xor_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as9, i32 1, i32 5, i32 2) [[attr]] |
| 91 |
; CHECK-LLVM-20: call spir_func i32 @_Z25atomic_fetch_and_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as10, i32 1, i32 5, i32 2) [[attr]] |
| 92 |
; CHECK-LLVM-20: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPU3AS4VU7_AtomiciPU3AS4ii12memory_orderS4_12memory_scope(ptr addrspace(4) %dst.as11, ptr addrspace(4) %expected12.as, i32 1, i32 5, i32 5, i32 2) [[attr]] |
| 93 |
; CHECK-LLVM-20: call spir_func i1 @_Z39atomic_compare_exchange_strong_explicitPU3AS4VU7_AtomiciPU3AS4ii12memory_orderS4_12memory_scope(ptr addrspace(4) %dst.as13, ptr addrspace(4) %expected14.as, i32 1, i32 5, i32 5, i32 2) [[attr]] |
| 94 |
; CHECK-LLVM-20: call spir_func i32 @_Z24atomic_exchange_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %dst.as15, i32 1, i32 5, i32 2) [[attr]] |
| 95 |
; CHECK-LLVM-20: call spir_func i32 @_Z20atomic_load_explicitPU3AS4VU7_Atomici12memory_order12memory_scope(ptr addrspace(4) %object.as, i32 5, i32 2) [[attr]] |
| 96 |
; CHECK-LLVM-20: call spir_func void @_Z21atomic_store_explicitPU3AS4VU7_Atomicii12memory_order12memory_scope(ptr addrspace(4) %object.as16, i32 %desired, i32 5, i32 2) [[attr]] |
| 97 |
; CHECK-LLVM-20: call spir_func i1 @_Z33atomic_flag_test_and_set_explicitPU3AS4VU7_Atomici12memory_order12memory_scope(ptr addrspace(4) %object.as17, i32 5, i32 2) [[attr]] |
| 98 |
; CHECK-LLVM-20: call spir_func void @_Z26atomic_flag_clear_explicitPU3AS4VU7_Atomici12memory_order12memory_scope(ptr addrspace(4) %object.as18, i32 5, i32 2) [[attr]] |
| 99 |
|
| 100 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t1.spv -o %t2.bc --spirv-target-env="SPV-IR" |
| 101 |
; RUN: llvm-dis < %t2.bc | FileCheck %s --check-prefix=CHECK-LLVM-SPV-IR |
| 102 |
|
| 103 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z24__spirv_AtomicIIncrementPU3AS1iii(ptr addrspace(1) %dst, i32 1, i32 16) #[[#attr:]] |
| 104 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z24__spirv_AtomicIDecrementPU3AS1iii(ptr addrspace(1) %dst, i32 1, i32 16) #[[#attr:]] |
| 105 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicSMaxPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 0) #[[#attr:]] |
| 106 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicUMaxPU3AS1jiij(ptr addrspace(1) %dst, i32 1, i32 16, i32 0) #[[#attr:]] |
| 107 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicSMinPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 0) #[[#attr:]] |
| 108 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicUMinPU3AS1jiij(ptr addrspace(1) %dst, i32 1, i32 16, i32 0) #[[#attr:]] |
| 109 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicIAddPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 110 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicISubPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 111 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z16__spirv_AtomicOrPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 112 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z17__spirv_AtomicXorPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 113 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z17__spirv_AtomicAndPU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 114 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z29__spirv_AtomicCompareExchangePU3AS1iiiiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 16, i32 1, i32 0) #[[#attr:]] |
| 115 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z22__spirv_AtomicExchangePU3AS1iiii(ptr addrspace(1) %dst, i32 1, i32 16, i32 1) #[[#attr:]] |
| 116 |
; CHECK-LLVM-SPV-IR: call spir_func i32 @_Z18__spirv_AtomicLoadPU3AS1iii(ptr addrspace(1) %object, i32 1, i32 16) #[[#attr:]] |
| 117 |
; CHECK-LLVM-SPV-IR: call spir_func void @_Z19__spirv_AtomicStorePU3AS1iiii(ptr addrspace(1) %object, i32 1, i32 16, i32 %desired) #[[#attr:]] |
| 118 |
; CHECK-LLVM-SPV-IR: call spir_func i1 @_Z28__spirv_AtomicFlagTestAndSetPU3AS1iii(ptr addrspace(1) %object, i32 1, i32 16) #[[#attr:]] |
| 119 |
; CHECK-LLVM-SPV-IR: call spir_func void @_Z23__spirv_AtomicFlagClearPU3AS1iii(ptr addrspace(1) %object, i32 1, i32 16) #[[#attr:]] |
| 120 |
|