1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ; CHECK-SPIRV-NOT: OpStore %[[#]] %[[#]] Volatile Aligned 8
4 ; CHECK-SPIRV: OpStore %[[#]] %[[#]] Volatile|Aligned 8
5 ; CHECK-SPIRV-NOT: %[[#]] = OpLoad %[[#]] %[[#]] Volatile Aligned 8
6 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#]] %[[#]] Volatile|Aligned 8
7 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#]] %[[#]] Aligned 4
8 ; CHECK-SPIRV-NOT: %[[#]] = OpLoad %[[#]] %[[#]] Volatile Aligned 8
9 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#]] %[[#]] Volatile|Aligned 8
10 ; CHECK-SPIRV-NOT: %[[#]] = OpLoad %[[#]] %[[#]] Volatile Aligned 0
11 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#]] %[[#]] Volatile|Aligned 8
12 ; CHECK-SPIRV-NOT: %[[#]] = OpLoad %[[#]] %[[#]] Volatile Aligned 8
13 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#]] %[[#]] Volatile|Aligned|Nontemporal 8
14 ; CHECK-SPIRV-NOT: OpStore %[[#]] %[[#]] Aligned 4
15 ; CHECK-SPIRV: OpStore %[[#]] %[[#]] Aligned|Nontemporal 4
16 ; CHECK-SPIRV-NOT: OpStore %[[#]] %[[#]] Aligned 0
17 ; CHECK-SPIRV: OpStore %[[#]] %[[#]]
19 define spir_kernel void @test_load_store(i32 addrspace(1)* %destMemory, i32 addrspace(1)* %oldValues, i32 %newValue) {
21 %ptr = alloca i32 addrspace(4)*, align 8
22 %0 = addrspacecast i32 addrspace(1)* %oldValues to i32 addrspace(4)*
23 store volatile i32 addrspace(4)* %0, i32 addrspace(4)** %ptr, align 8
24 %1 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8
25 %2 = load i32, i32 addrspace(4)* %1, align 4
26 %call = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %destMemory, i32 %2, i32 %newValue)
27 %3 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8
28 %4 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr
29 %5 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8, !nontemporal !9
30 %arrayidx = getelementptr inbounds i32, i32 addrspace(4)* %3, i64 0
31 store i32 %call, i32 addrspace(4)* %arrayidx, align 4, !nontemporal !9
32 store i32 addrspace(4)* %5, i32 addrspace(4)** %ptr
36 declare spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)*, i32, i32)