@@ -175,34 +175,27 @@ pub fn spin_loop() {
175
175
unsafe { crate :: arch:: x86_64:: _mm_pause ( ) } ;
176
176
}
177
177
178
- // RISC-V platform spin loop hint implementation
178
+ # [ cfg ( target_arch = "riscv32" ) ]
179
179
{
180
- // RISC-V RV32 and RV64 share the same PAUSE instruction, but they are located in different
181
- // modules in `core::arch`.
182
- // In this case, here we call `pause` function in each core arch module.
183
- #[ cfg( target_arch = "riscv32" ) ]
184
- {
185
- crate :: arch:: riscv32:: pause ( ) ;
186
- }
187
- #[ cfg( target_arch = "riscv64" ) ]
188
- {
189
- crate :: arch:: riscv64:: pause ( ) ;
190
- }
180
+ crate :: arch:: riscv32:: pause ( ) ;
191
181
}
192
182
193
- #[ cfg( any ( target_arch = "aarch64" , all ( target_arch = "arm" , target_feature = "v6" ) ) ) ]
183
+ #[ cfg( target_arch = "riscv64" ) ]
194
184
{
195
- #[ cfg( target_arch = "aarch64" ) ]
196
- {
197
- // SAFETY: the `cfg` attr ensures that we only execute this on aarch64 targets.
198
- unsafe { crate :: arch:: aarch64:: __isb ( crate :: arch:: aarch64:: SY ) } ;
199
- }
200
- #[ cfg( target_arch = "arm" ) ]
201
- {
202
- // SAFETY: the `cfg` attr ensures that we only execute this on arm targets
203
- // with support for the v6 feature.
204
- unsafe { crate :: arch:: arm:: __yield ( ) } ;
205
- }
185
+ crate :: arch:: riscv64:: pause ( ) ;
186
+ }
187
+
188
+ #[ cfg( target_arch = "aarch64" ) ]
189
+ {
190
+ // SAFETY: the `cfg` attr ensures that we only execute this on aarch64 targets.
191
+ unsafe { crate :: arch:: aarch64:: __isb ( crate :: arch:: aarch64:: SY ) } ;
192
+ }
193
+
194
+ #[ cfg( all( target_arch = "arm" , target_feature = "v6" ) ) ]
195
+ {
196
+ // SAFETY: the `cfg` attr ensures that we only execute this on arm targets
197
+ // with support for the v6 feature.
198
+ unsafe { crate :: arch:: arm:: __yield ( ) } ;
206
199
}
207
200
}
208
201
0 commit comments