forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatomic.cpp
More file actions
74 lines (63 loc) · 1.89 KB
/
atomic.cpp
File metadata and controls
74 lines (63 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// RUN: %clangxx -fsycl -fsyntax-only -Wno-deprecated-declarations -Xclang -verify %s
// expected-no-diagnostics
#include <sycl/atomic.hpp>
#include <sycl/multi_ptr.hpp>
SYCL_EXTERNAL void
store(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
a.store(value);
}
SYCL_EXTERNAL int
load(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr) {
sycl::atomic<int> a(mptr);
return a.load();
}
SYCL_EXTERNAL int
exchange(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.exchange(value);
}
SYCL_EXTERNAL int
fetch_add(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_add(value);
}
SYCL_EXTERNAL int
fetch_sub(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_sub(value);
}
SYCL_EXTERNAL int
fetch_and(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_and(value);
}
SYCL_EXTERNAL int
fetch_or(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_or(value);
}
SYCL_EXTERNAL int
fetch_xor(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_xor(value);
}
SYCL_EXTERNAL int
fetch_min(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_min(value);
}
SYCL_EXTERNAL int
fetch_max(sycl::multi_ptr<int, sycl::access::address_space::global_space> mptr,
int value) {
sycl::atomic<int> a(mptr);
return a.fetch_max(value);
}