@@ -53,9 +53,8 @@ macro_rules! atomic_load_store {
53
53
asm!(
54
54
// (atomic) load from src to out
55
55
concat!( "l" , $l_suffix, " {out}, 0({src})" ) ,
56
- src = in( reg ) ptr_reg!( src) ,
56
+ src = in( reg_addr ) ptr_reg!( src) ,
57
57
out = lateout( reg) out,
58
- out( "r0" ) _,
59
58
options( nostack, preserves_flags) ,
60
59
) ;
61
60
}
@@ -79,9 +78,8 @@ macro_rules! atomic_load_store {
79
78
// (atomic) store val to dst
80
79
concat!( "st" , $asm_suffix, " {val}, 0({dst})" ) ,
81
80
$fence,
82
- dst = in( reg ) ptr_reg!( dst) ,
81
+ dst = in( reg_addr ) ptr_reg!( dst) ,
83
82
val = in( reg) val,
84
- out( "r0" ) _,
85
83
options( nostack, preserves_flags) ,
86
84
)
87
85
} ;
@@ -126,13 +124,13 @@ macro_rules! atomic {
126
124
// atomic swap is always SeqCst.
127
125
asm!(
128
126
// (atomic) swap (CAS loop)
129
- concat!( "l" , $asm_suffix, " %r0 , 0({dst})" ) ,
127
+ concat!( "l" , $asm_suffix, " {out} , 0({dst})" ) ,
130
128
"2:" ,
131
- concat!( "cs" , $asm_suffix, " %r0 , {val}, 0({dst})" ) ,
129
+ concat!( "cs" , $asm_suffix, " {out} , {val}, 0({dst})" ) ,
132
130
"jl 2b" ,
133
- dst = in( reg ) ptr_reg!( dst) ,
131
+ dst = in( reg_addr ) ptr_reg!( dst) ,
134
132
val = in( reg) val,
135
- out( "r0" ) out,
133
+ out = out ( reg ) out,
136
134
// Do not use `preserves_flags` because CS modifies the condition code.
137
135
options( nostack) ,
138
136
) ;
@@ -158,13 +156,13 @@ macro_rules! atomic {
158
156
// compare_exchange is always SeqCst.
159
157
asm!(
160
158
// (atomic) CAS
161
- concat!( "cs" , $asm_suffix, " %r0 , {new}, 0({dst})" ) ,
159
+ concat!( "cs" , $asm_suffix, " {old} , {new}, 0({dst})" ) ,
162
160
// store condition code
163
161
"ipm {r}" ,
164
- dst = in( reg ) ptr_reg!( dst) ,
162
+ dst = in( reg_addr ) ptr_reg!( dst) ,
165
163
new = in( reg) new,
166
164
r = lateout( reg) r,
167
- inout( "r0" ) old => out,
165
+ old = inout( reg ) old => out,
168
166
// Do not use `preserves_flags` because CS modifies the condition code.
169
167
options( nostack) ,
170
168
) ;
@@ -195,21 +193,21 @@ macro_rules! atomic_sub_word {
195
193
// Based on assemblies generated by rustc/LLVM.
196
194
// See also create_sub_word_mask_values.
197
195
asm!(
198
- "l %r0 , 0({dst})" ,
196
+ "l {prev} , 0({dst})" ,
199
197
"2:" ,
200
- "rll {tmp}, %r0 , 0({shift})" ,
198
+ "rll {tmp}, {prev} , 0({shift})" ,
201
199
concat!( "risbg {tmp}, {val}, 32, " , $risbg_swap) ,
202
200
"rll {tmp}, {tmp}, 0({shift_c})" ,
203
- "cs %r0 , {tmp}, 0({dst})" ,
201
+ "cs {prev} , {tmp}, 0({dst})" ,
204
202
"jl 2b" ,
205
- concat!( "rll {out}, %r0 , " , $bits , "({shift})" ) ,
206
- dst = in( reg ) ptr_reg!( dst) ,
203
+ concat!( "rll {out}, {prev} , " , $bits , "({shift})" ) ,
204
+ dst = in( reg_addr ) ptr_reg!( dst) ,
207
205
val = in( reg) val,
208
206
out = lateout( reg) out,
209
- shift = in( reg ) shift as u32 ,
210
- shift_c = in( reg ) complement( shift as u32 ) ,
207
+ shift = in( reg_addr ) shift as u32 ,
208
+ shift_c = in( reg_addr ) complement( shift as u32 ) ,
211
209
tmp = out( reg) _,
212
- out( "r0" ) _, // prev
210
+ prev = out( reg ) _,
213
211
// Do not use `preserves_flags` because CS modifies the condition code.
214
212
options( nostack) ,
215
213
) ;
@@ -239,26 +237,26 @@ macro_rules! atomic_sub_word {
239
237
asm!(
240
238
"l {prev}, 0({dst})" ,
241
239
"2:" ,
242
- concat!( "rll %r0 , {prev}, " , $bits , "({shift})" ) ,
243
- concat!( "risbg {new}, %r0 , 32, " , $risbg_cas, ", 0" ) ,
244
- concat!( "ll" , $asm_suffix, "r %r0, %r0 " ) ,
245
- "cr %r0 , {old}" ,
240
+ concat!( "rll {out} , {prev}, " , $bits , "({shift})" ) ,
241
+ concat!( "risbg {new}, {out} , 32, " , $risbg_cas, ", 0" ) ,
242
+ concat!( "ll" , $asm_suffix, "r {out}, {out} " ) ,
243
+ "cr {out} , {old}" ,
246
244
"jlh 3f" ,
247
245
concat!( "rll {tmp}, {new}, -" , $bits , "({shift_c})" ) ,
248
246
"cs {prev}, {tmp}, 0({dst})" ,
249
247
"jl 2b" ,
250
248
"3:" ,
251
249
// store condition code
252
250
"ipm {r}" ,
253
- dst = in( reg ) ptr_reg!( dst) ,
251
+ dst = in( reg_addr ) ptr_reg!( dst) ,
254
252
prev = out( reg) _,
255
253
old = in( reg) crate :: utils:: zero_extend( old) ,
256
254
new = inout( reg) new => _,
257
- shift = in( reg ) shift as u32 ,
258
- shift_c = in( reg ) complement( shift as u32 ) ,
255
+ shift = in( reg_addr ) shift as u32 ,
256
+ shift_c = in( reg_addr ) complement( shift as u32 ) ,
259
257
tmp = out( reg) _,
260
258
r = lateout( reg) r,
261
- out( "r0" ) out,
259
+ out = out ( reg ) out,
262
260
// Do not use `preserves_flags` because CS modifies the condition code.
263
261
options( nostack) ,
264
262
) ;
@@ -298,7 +296,7 @@ macro_rules! atomic128 {
298
296
asm!(
299
297
// (atomic) load from src to out pair
300
298
"lpq %r0, 0({src})" ,
301
- src = in( reg ) ptr_reg!( src) ,
299
+ src = in( reg_addr ) ptr_reg!( src) ,
302
300
// Quadword atomic instructions work with even/odd pair of specified register and subsequent register.
303
301
out( "r0" ) prev_hi,
304
302
out( "r1" ) prev_lo,
@@ -326,7 +324,7 @@ macro_rules! atomic128 {
326
324
// (atomic) store val pair to dst
327
325
"stpq %r0, 0({dst})" ,
328
326
$fence,
329
- dst = in( reg ) ptr_reg!( dst) ,
327
+ dst = in( reg_addr ) ptr_reg!( dst) ,
330
328
// Quadword atomic instructions work with even/odd pair of specified register and subsequent register.
331
329
in( "r0" ) val. pair. hi,
332
330
in( "r1" ) val. pair. lo,
@@ -373,7 +371,7 @@ macro_rules! atomic128 {
373
371
"2:" ,
374
372
"cdsg %r0, %r12, 0({dst})" ,
375
373
"jl 2b" ,
376
- dst = inout ( reg ) ptr_reg!( dst) => _ ,
374
+ dst = in ( reg_addr ) ptr_reg!( dst) ,
377
375
// Quadword atomic instructions work with even/odd pair of specified register and subsequent register.
378
376
out( "r0" ) prev_hi,
379
377
out( "r1" ) prev_lo,
@@ -409,7 +407,7 @@ macro_rules! atomic128 {
409
407
"cdsg %r0, %r12, 0({dst})" ,
410
408
// store condition code
411
409
"ipm {r}" ,
412
- dst = in( reg ) ptr_reg!( dst) ,
410
+ dst = in( reg_addr ) ptr_reg!( dst) ,
413
411
r = lateout( reg) r,
414
412
// Quadword atomic instructions work with even/odd pair of specified register and subsequent register.
415
413
inout( "r0" ) old. pair. hi => prev_hi,
0 commit comments