@@ -107,7 +107,7 @@ the `lr` and `sc` instructions.
107
107
108
108
|`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}.aqrl` |4
109
109
110
- |`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}.aqrl` |4
110
+ |`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}.aqrl` |4, 5
111
111
112
112
|===
113
113
@@ -148,6 +148,11 @@ mappings with code generated by a compiler using those older mappings.
148
148
149
149
4) Currently only directly possible for 32- and 64-bit operands.
150
150
151
+ 5) atomic_compare_exchange operations with a memory_order_seq_cst failure
152
+ ordering are considered to have a note 3 annotation.
153
+ To remove the note 3 annotation the amocas operation must be prepended with a
154
+ leading fence (`fence rw,rw; amocas.{w\|d}.aqrl`).
155
+
151
156
== Ztso atomics mappings
152
157
153
158
This specifies additional mappings of C and {Cpp} atomic operations to RISC-V
@@ -157,7 +162,8 @@ For each construct, we provide a mapping that assumes only the A and Ztso
157
162
extension.
158
163
159
164
All mappings interoperate correctly with the RVWMO mappings, and with the
160
- original "Table A.6" mappings.
165
+ original "Table A.6" mappings, _except_ that mappings marked with note 3 do not
166
+ interoperate with the original "Table A.6" mappings.
161
167
162
168
We present the mappings as a table in 3 sections, as above.
163
169
@@ -167,32 +173,32 @@ We present the mappings as a table in 3 sections, as above.
167
173
|===
168
174
|C/{Cpp} Construct |Ztso Mapping |Notes
169
175
170
- |`atomic_load(memory_order_acquire)` |`l{b\|h\|w\|d}` | 5
176
+ |`atomic_load(memory_order_acquire)` |`l{b\|h\|w\|d}` | 6
171
177
172
- |`atomic_load(memory_order_seq_cst)` |`fence rw,rw; l{b\|h\|w\|d}` | 5
178
+ |`atomic_load(memory_order_seq_cst)` |`fence rw,rw; l{b\|h\|w\|d}` | 6
173
179
174
- |`atomic_store(memory_order_release)` |`s{b\|h\|w\|d}` | 5
180
+ |`atomic_store(memory_order_release)` |`s{b\|h\|w\|d}` | 6
175
181
176
- |`atomic_store(memory_order_seq_cst)` |`s{b\|h\|w\|d}; fence rw, rw` | 5
182
+ |`atomic_store(memory_order_seq_cst)` |`s{b\|h\|w\|d}; fence rw, rw` | 6
177
183
178
- |`atomic_thread_fence(memory_order_acquire)` |`nop` | 5
184
+ |`atomic_thread_fence(memory_order_acquire)` |`nop` | 6
179
185
180
- |`atomic_thread_fence(memory_order_release)` |`nop` | 5
186
+ |`atomic_thread_fence(memory_order_release)` |`nop` | 6
181
187
182
- |`atomic_thread_fence(memory_order_acq_rel)` |`nop` | 5
188
+ |`atomic_thread_fence(memory_order_acq_rel)` |`nop` | 6
183
189
|===
184
190
185
191
[cols="<20,<20,<4",options="header",]
186
192
|===
187
193
|C/{Cpp} Construct |Ztso AMO Mapping |Notes
188
194
189
- |`atomic_<op>(memory_order_acquire)` |`amo<op>.{w\|d}` |4, 5
195
+ |`atomic_<op>(memory_order_acquire)` |`amo<op>.{w\|d}` |4, 6
190
196
191
- |`atomic_<op>(memory_order_release)` |`amo<op>.{w\|d}` |4, 5
197
+ |`atomic_<op>(memory_order_release)` |`amo<op>.{w\|d}` |4, 6
192
198
193
- |`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}` |4, 5
199
+ |`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}` |4, 6
194
200
195
- |`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}` |4, 5
201
+ |`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}` |4, 5, 6
196
202
197
203
|===
198
204
@@ -201,21 +207,26 @@ We present the mappings as a table in 3 sections, as above.
201
207
|C/{Cpp} Construct |Ztso LR/SC Mapping |Notes
202
208
203
209
|`atomic_<op>(memory_order_acquire)`
204
- |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
210
+ |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6
205
211
206
212
|`atomic_<op>(memory_order_release)`
207
- |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
213
+ |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6
208
214
209
215
|`atomic_<op>(memory_order_acq_rel)`
210
- |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
216
+ |`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6
211
217
212
218
|===
213
219
214
220
=== Meaning of notes in table
215
221
216
222
4) Currently only directly possible for 32- and 64-bit operands.
217
223
218
- 5) Requires the Ztso extension.
224
+ 5) atomic_compare_exchange operations with a memory_order_seq_cst failure
225
+ ordering are considered to have a note 3 annotation.
226
+ To remove the note 3 annotation the amocas operation must be prepended with a
227
+ leading fence (`fence rw,rw; amocas.{w\|d}`).
228
+
229
+ 6) Requires the Ztso extension.
219
230
220
231
== Other conventions
221
232
0 commit comments