forked from Matway/mpl-sl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
atomic.ll
executable file
·159 lines (128 loc) · 3.95 KB
/
atomic.ll
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
define i8 @atomicExchangeN8Acquire(i8* %ref, i8 %value) {
%old = atomicrmw xchg i8* %ref, i8 %value acquire
ret i8 %old
}
define i16 @atomicExchangeN16Acquire(i16* %ref, i16 %value) {
%old = atomicrmw xchg i16* %ref, i16 %value acquire
ret i16 %old
}
define i32 @atomicExchangeN32Acquire(i32* %ref, i32 %value) {
%old = atomicrmw xchg i32* %ref, i32 %value acquire
ret i32 %old
}
define i64 @atomicExchangeN64Acquire(i64* %ref, i64 %value) {
%old = atomicrmw xchg i64* %ref, i64 %value acquire
ret i64 %old
}
define i8 @atomicExchangeN8Release(i8* %ref, i8 %value) {
%old = atomicrmw xchg i8* %ref, i8 %value release
ret i8 %old
}
define i16 @atomicExchangeN16Release(i16* %ref, i16 %value) {
%old = atomicrmw xchg i16* %ref, i16 %value release
ret i16 %old
}
define i32 @atomicExchangeN32Release(i32* %ref, i32 %value) {
%old = atomicrmw xchg i32* %ref, i32 %value release
ret i32 %old
}
define i64 @atomicExchangeN64Release(i64* %ref, i64 %value) {
%old = atomicrmw xchg i64* %ref, i64 %value release
ret i64 %old
}
define i8 @atomicLoadN8Acquire(i8* %ref) {
%value = load atomic i8, i8* %ref acquire, align 1
ret i8 %value
}
define i16 @atomicLoadN16Acquire(i16* %ref) {
%value = load atomic i16, i16* %ref acquire, align 2
ret i16 %value
}
define i32 @atomicLoadN32Acquire(i32* %ref) {
%value = load atomic i32, i32* %ref acquire, align 4
ret i32 %value
}
define i64 @atomicLoadN64Acquire(i64* %ref) {
%value = load atomic i64, i64* %ref acquire, align 8
ret i64 %value
}
define i8 @atomicOrN8Acquire(i8* %ref, i8 %value) {
%old = atomicrmw or i8* %ref, i8 %value acquire
ret i8 %old
}
define i16 @atomicOrN16Acquire(i16* %ref, i16 %value) {
%old = atomicrmw or i16* %ref, i16 %value acquire
ret i16 %old
}
define i32 @atomicOrN32Acquire(i32* %ref, i32 %value) {
%old = atomicrmw or i32* %ref, i32 %value acquire
ret i32 %old
}
define i64 @atomicOrN64Acquire(i64* %ref, i64 %value) {
%old = atomicrmw or i64* %ref, i64 %value acquire
ret i64 %old
}
define i8 @atomicOrN8Release(i8* %ref, i8 %value) {
%old = atomicrmw or i8* %ref, i8 %value release
ret i8 %old
}
define i16 @atomicOrN16Release(i16* %ref, i16 %value) {
%old = atomicrmw or i16* %ref, i16 %value release
ret i16 %old
}
define i32 @atomicOrN32Release(i32* %ref, i32 %value) {
%old = atomicrmw or i32* %ref, i32 %value release
ret i32 %old
}
define i64 @atomicOrN64Release(i64* %ref, i64 %value) {
%old = atomicrmw or i64* %ref, i64 %value release
ret i64 %old
}
define void @atomicStoreN8Release(i8* %ref, i8 %value) {
store atomic i8 %value, i8* %ref release, align 1
ret void
}
define void @atomicStoreN16Release(i16* %ref, i16 %value) {
store atomic i16 %value, i16* %ref release, align 2
ret void
}
define void @atomicStoreN32Release(i32* %ref, i32 %value) {
store atomic i32 %value, i32* %ref release, align 4
ret void
}
define void @atomicStoreN64Release(i64* %ref, i64 %value) {
store atomic i64 %value, i64* %ref release, align 8
ret void
}
define i8 @atomicXorN8Acquire(i8* %ref, i8 %value) {
%old = atomicrmw xor i8* %ref, i8 %value acquire
ret i8 %old
}
define i16 @atomicXorN16Acquire(i16* %ref, i16 %value) {
%old = atomicrmw xor i16* %ref, i16 %value acquire
ret i16 %old
}
define i32 @atomicXorN32Acquire(i32* %ref, i32 %value) {
%old = atomicrmw xor i32* %ref, i32 %value acquire
ret i32 %old
}
define i64 @atomicXorN64Acquire(i64* %ref, i64 %value) {
%old = atomicrmw xor i64* %ref, i64 %value acquire
ret i64 %old
}
define i8 @atomicXorN8Release(i8* %ref, i8 %value) {
%old = atomicrmw xor i8* %ref, i8 %value release
ret i8 %old
}
define i16 @atomicXorN16Release(i16* %ref, i16 %value) {
%old = atomicrmw xor i16* %ref, i16 %value release
ret i16 %old
}
define i32 @atomicXorN32Release(i32* %ref, i32 %value) {
%old = atomicrmw xor i32* %ref, i32 %value release
ret i32 %old
}
define i64 @atomicXorN64Release(i64* %ref, i64 %value) {
%old = atomicrmw xor i64* %ref, i64 %value release
ret i64 %old
}