@@ -7,7 +7,7 @@ macro_rules! read_csr {
77 #[ cfg( all( riscv, feature = "inline-asm" ) ) ]
88 ( ) => {
99 let r: usize ;
10- llvm_asm !( "csrrs $0, $1 , x0" : "=r" ( r ) : "i" ( $csr_number) :: "volatile" ) ;
10+ asm !( "csrrs {0}, {1} , x0" , out ( reg ) r , const $csr_number) ;
1111 r
1212 }
1313
@@ -36,7 +36,7 @@ macro_rules! read_csr_rv32 {
3636 #[ cfg( all( riscv32, feature = "inline-asm" ) ) ]
3737 ( ) => {
3838 let r: usize ;
39- llvm_asm !( "csrrs $0, $1 , x0" : "=r" ( r ) : "i" ( $csr_number) :: "volatile" ) ;
39+ asm !( "csrrs {0}, {1} , x0" , out ( reg ) r , const $csr_number) ;
4040 r
4141 }
4242
@@ -102,7 +102,7 @@ macro_rules! write_csr {
102102 unsafe fn _write( bits: usize ) {
103103 match ( ) {
104104 #[ cfg( all( riscv, feature = "inline-asm" ) ) ]
105- ( ) => llvm_asm !( "csrrw x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
105+ ( ) => asm !( "csrrw x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
106106
107107 #[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
108108 ( ) => {
@@ -128,7 +128,7 @@ macro_rules! write_csr_rv32 {
128128 unsafe fn _write( bits: usize ) {
129129 match ( ) {
130130 #[ cfg( all( riscv32, feature = "inline-asm" ) ) ]
131- ( ) => llvm_asm !( "csrrw x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
131+ ( ) => asm !( "csrrw x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
132132
133133 #[ cfg( all( riscv32, not( feature = "inline-asm" ) ) ) ]
134134 ( ) => {
@@ -178,7 +178,7 @@ macro_rules! set {
178178 unsafe fn _set( bits: usize ) {
179179 match ( ) {
180180 #[ cfg( all( riscv, feature = "inline-asm" ) ) ]
181- ( ) => llvm_asm !( "csrrs x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
181+ ( ) => asm !( "csrrs x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
182182
183183 #[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
184184 ( ) => {
@@ -204,7 +204,7 @@ macro_rules! clear {
204204 unsafe fn _clear( bits: usize ) {
205205 match ( ) {
206206 #[ cfg( all( riscv, feature = "inline-asm" ) ) ]
207- ( ) => llvm_asm !( "csrrc x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
207+ ( ) => asm !( "csrrc x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
208208
209209 #[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
210210 ( ) => {
0 commit comments