• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; ModuleID = 'AtomicCompareExchange_cl12.cl'
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 -o %t.spv
7; RUN: llvm-spirv -r %t.spv -o %t.bc
8; RUN: llvm-dis < %t.bc | FileCheck %s
9
10; Check conversion of atomic_cmpxchng to atomic_compare_exchange_strong.
11
12; Function Attrs: nounwind
13
14; CHECK:         define spir_func i32 @test
15; CHECK-LABEL:   entry
16; CHECK:         [[PTR:%expected[0-9]*]] = alloca i32, align 4
17; CHECK:         store i32 {{.*}}, i32* [[PTR]]
18; CHECK:         call spir_func i1 @_Z39atomic_compare_exchange_strong_explicit{{.*}}%object, i32* [[PTR]], i32 %desired, i32 4, i32 4, i32 2)
19; CHECK-NEXT;         load i32* [[PTR]]
20define spir_func i32 @test(i32 addrspace(1)* %object, i32 %expected, i32 %desired) #0 {
21entry:
22  %call = tail call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %object, i32 %expected, i32 %desired) #2
23  ret i32 %call
24}
25
26declare spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)*, i32, i32) #1
27
28attributes #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" }
29attributes #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" }
30attributes #2 = { nounwind }
31
32!opencl.enable.FP_CONTRACT = !{}
33!opencl.spir.version = !{!0}
34!opencl.ocl.version = !{!0}
35!opencl.used.extensions = !{!1}
36!opencl.used.optional.core.features = !{!1}
37!opencl.compiler.options = !{!1}
38
39!0 = !{i32 1, i32 2}
40!1 = !{}
41