1; ModuleID = ''
2target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
3target triple = "spir-unknown-unknown"
4
5; RUN: llvm-as %s -o %t.bc
6; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt
7; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
8; RUN: llvm-spirv %t.bc -o %t.spv
9; RUN: llvm-spirv -r %t.spv -o %t.bc
10; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
11
12; Check 'LLVM ==> SPIR-V ==> LLVM' conversion of atomic_store.
13
14; Function Attrs: nounwind
15
16; CHECK-LLVM:         define spir_func void @test
17; CHECK-LLVM-LABEL:   entry
18; CHECK-LLVM:         call spir_func void @_Z21atomic_store_explicitPVU3AS4U7_Atomiciiii(i32 addrspace(4)* %object, i32 %desired, i32 4, i32 2)
19
20; CHECK-SPIRV-LABEL:  5 Function
21; CHECK-SPIRV-NEXT:   FunctionParameter {{[0-9]+}} [[object:[0-9]+]]
22; CHECK-SPIRV-NEXT:   FunctionParameter
23; CHECK-SPIRV-NEXT:   FunctionParameter {{[0-9]+}} [[desired:[0-9]+]]
24; CHECK-SPIRV:        AtomicStore [[object]] {{[0-9]+}} {{[0-9]+}} [[desired]]
25; CHECK-SPIRV-LABEL:  1 FunctionEnd
26
27; Function Attrs: nounwind
28define spir_func void @test(i32 addrspace(4)* %object, i32 addrspace(4)* %expected, i32 %desired) #0 {
29entry:
30  call spir_func void @_Z12atomic_storePVU3AS4U7_Atomicii(i32 addrspace(4)* %object, i32 %desired) #2
31  ret void
32}
33
34declare spir_func void @_Z12atomic_storePVU3AS4U7_Atomicii(i32 addrspace(4)*, i32) #1
35
36attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
37attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
38attributes #2 = { nounwind }
39
40!opencl.enable.FP_CONTRACT = !{}
41!opencl.spir.version = !{!0}
42!opencl.ocl.version = !{!1}
43!opencl.used.extensions = !{!2}
44!opencl.used.optional.core.features = !{!2}
45!opencl.compiler.options = !{!2}
46
47!0 = !{i32 1, i32 2}
48!1 = !{i32 2, i32 0}
49!2 = !{}