1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; CHECK-DAG: %[[#Long:]] = OpTypeInt 64 0
5 ; CHECK-COUNT-9: %[[#]] = OpAtomicExchange %[[#Long]] %[[#]] %[[#]] %[[#]] %[[#]]
8 %Type2 = type { ptr addrspace(4) }
10 define linkonce_odr dso_local spir_func void @f1() {
12 %a = alloca %Type1, align 8
13 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
14 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
15 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePyN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEy(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 3)
19 define linkonce_odr dso_local spir_func void @f2() {
21 %a = alloca %Type1, align 8
22 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
23 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
24 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePxN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEx(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 3)
28 define linkonce_odr dso_local spir_func void @f3() {
30 %a = alloca %Type1, align 8
31 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
32 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
33 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 3)
37 define linkonce_odr dso_local spir_func void @f4() {
39 %a = alloca %Type1, align 8
40 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
41 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
42 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePlN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEl(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 3)
47 define linkonce_odr dso_local spir_func void @f5() {
49 %a = alloca %Type2, align 8
50 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
51 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
52 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 %p)
56 define linkonce_odr dso_local spir_func void @f6() {
58 %a = alloca %Type2, align 8
59 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
60 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
61 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 %p)
65 define linkonce_odr dso_local spir_func void @f7() {
67 %a = alloca %Type2, align 8
68 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
69 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
70 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 %p)
74 define linkonce_odr dso_local spir_func void @f8() {
76 %a = alloca %Type2, align 8
77 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
78 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
79 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 %p)
83 ; Function Attrs: convergent mustprogress norecurse nounwind
84 define linkonce_odr dso_local spir_func void @f9() {
86 %a = alloca %Type2, align 8
87 %a.ascast = addrspacecast ptr %a to ptr addrspace(4)
88 %p = ptrtoint ptr addrspace(4) %a.ascast to i64
89 %res = call spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4) %a.ascast, i32 0, i32 912, i64 %p)
93 declare dso_local spir_func i64 @_Z22__spirv_AtomicExchangePyN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEy(ptr addrspace(4), i32, i32, i64)
94 declare dso_local spir_func i64 @_Z22__spirv_AtomicExchangePxN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEx(ptr addrspace(4), i32, i32, i64)
95 declare dso_local spir_func i64 @_Z22__spirv_AtomicExchangePmN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEm(ptr addrspace(4), i32, i32, i64)
96 declare dso_local spir_func i64 @_Z22__spirv_AtomicExchangePlN5__spv5Scope4FlagENS0_19MemorySemanticsMask4FlagEl(ptr addrspace(4), i32, i32, i64)