• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as < %s | llvm-spirv -spirv-text | FileCheck %s
2
3target 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"
4target triple = "spir-unknown-unknown"
5
6; CHECK: 3 Source 3 102000
7
8; CHECK: Name [[Pointer:[0-9]+]] "object"
9; CHECK: Name [[Comparator:[0-9]+]] "expected"
10; CHECK: Name [[Value:[0-9]+]] "desired"
11; CHECK: 4 TypeInt [[int:[0-9]+]] 32 0
12; CHECK: Constant [[int]] [[DeviceScope:[0-9]+]] 1
13; CHECK: Constant [[int]] [[SequentiallyConsistent_MS:[0-9]+]] 16
14; CHECK: 4 TypePointer [[int_ptr:[0-9]+]] 5 [[int]]
15
16; Function Attrs: nounwind
17define spir_func i32 @test(i32 addrspace(1)* %object, i32 %expected, i32 %desired) #0 {
18; CHECK: FunctionParameter [[int_ptr]] [[Pointer]]
19; CHECK: FunctionParameter [[int]] [[Comparator]]
20; CHECK: FunctionParameter [[int]] [[Value]]
21entry:
22  %object.addr = alloca i32 addrspace(1)*, align 4
23  %expected.addr = alloca i32, align 4
24  %desired.addr = alloca i32, align 4
25  %res = alloca i32, align 4
26  store i32 addrspace(1)* %object, i32 addrspace(1)** %object.addr, align 4
27  store i32 %expected, i32* %expected.addr, align 4
28  store i32 %desired, i32* %desired.addr, align 4
29  %0 = load i32 addrspace(1)*, i32 addrspace(1)** %object.addr, align 4
30  %1 = load i32, i32* %expected.addr, align 4
31  %2 = load i32, i32* %desired.addr, align 4
32
33  %call = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %0, i32 %1, i32 %2)
34; CHECK 9 AtomicCompareExchange [[int]] [[result:[0-9]+]] [[Pointer]] [[DeviceScope]] [[SequentiallyConsistent_MS]] [[SequentiallyConsistent_MS]] [[Value]] [[Comparator]]
35
36  store i32 %call, i32* %res, align 4
37  %3 = load i32, i32* %res, align 4
38  ret i32 %3
39; CHECK 2 ReturnValue [[result]]
40}
41
42declare spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)*, i32, i32) #1
43
44attributes #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" }
45attributes #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" }
46
47!opencl.enable.FP_CONTRACT = !{}
48!opencl.spir.version = !{!0}
49!opencl.ocl.version = !{!0}
50!opencl.used.extensions = !{!1}
51!opencl.used.optional.core.features = !{!1}
52!opencl.compiler.options = !{!1}
53
54!0 = !{i32 1, i32 2}
55!1 = !{}
56