11#[ cfg( test) ]
22use stdarch_test:: assert_instr;
33
4- macro_rules! static_assert_imm2 {
5- ( $imm: ident) => {
6- static_assert!(
7- $imm < 4 ,
8- "Immediate value allowed to be a constant from 0 up to including 3"
9- )
10- } ;
11- }
12-
134extern "unadjusted" {
145 #[ link_name = "llvm.riscv.aes32esi" ]
156 fn _aes32esi ( rs1 : i32 , rs2 : i32 , bs : i32 ) -> i32 ;
@@ -71,10 +62,10 @@ extern "unadjusted" {
7162/// This function is safe to use if the `zkne` target feature is present.
7263#[ target_feature( enable = "zkne" ) ]
7364#[ rustc_legacy_const_generics( 2 ) ]
74- #[ cfg_attr( test, assert_instr( aes32esi) ) ]
65+ #[ cfg_attr( test, assert_instr( aes32esi, BS = 0 ) ) ]
7566#[ inline]
7667pub unsafe fn aes32esi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
77- static_assert_imm2 ! ( BS ) ;
68+ static_assert ! ( BS < 4 ) ;
7869
7970 _aes32esi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
8071}
@@ -102,10 +93,10 @@ pub unsafe fn aes32esi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
10293/// This function is safe to use if the `zkne` target feature is present.
10394#[ target_feature( enable = "zkne" ) ]
10495#[ rustc_legacy_const_generics( 2 ) ]
105- #[ cfg_attr( test, assert_instr( aes32esmi) ) ]
96+ #[ cfg_attr( test, assert_instr( aes32esmi, BS = 0 ) ) ]
10697#[ inline]
10798pub unsafe fn aes32esmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
108- static_assert_imm2 ! ( BS ) ;
99+ static_assert ! ( BS < 4 ) ;
109100
110101 _aes32esmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
111102}
@@ -132,10 +123,10 @@ pub unsafe fn aes32esmi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
132123/// This function is safe to use if the `zknd` target feature is present.
133124#[ target_feature( enable = "zknd" ) ]
134125#[ rustc_legacy_const_generics( 2 ) ]
135- #[ cfg_attr( test, assert_instr( aes32dsi) ) ]
126+ #[ cfg_attr( test, assert_instr( aes32dsi, BS = 0 ) ) ]
136127#[ inline]
137128pub unsafe fn aes32dsi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
138- static_assert_imm2 ! ( BS ) ;
129+ static_assert ! ( BS < 4 ) ;
139130
140131 _aes32dsi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
141132}
@@ -163,10 +154,10 @@ pub unsafe fn aes32dsi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
163154/// This function is safe to use if the `zknd` target feature is present.
164155#[ target_feature( enable = "zknd" ) ]
165156#[ rustc_legacy_const_generics( 2 ) ]
166- #[ cfg_attr( test, assert_instr( aes32dsmi) ) ]
157+ #[ cfg_attr( test, assert_instr( aes32dsmi, BS = 0 ) ) ]
167158#[ inline]
168159pub unsafe fn aes32dsmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
169- static_assert_imm2 ! ( BS ) ;
160+ static_assert ! ( BS < 4 ) ;
170161
171162 _aes32dsmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
172163}
0 commit comments