1
1
#[ cfg( test) ]
2
2
use stdarch_test:: assert_instr;
3
3
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
-
13
4
extern "unadjusted" {
14
5
#[ link_name = "llvm.riscv.aes32esi" ]
15
6
fn _aes32esi ( rs1 : i32 , rs2 : i32 , bs : i32 ) -> i32 ;
@@ -71,10 +62,10 @@ extern "unadjusted" {
71
62
/// This function is safe to use if the `zkne` target feature is present.
72
63
#[ target_feature( enable = "zkne" ) ]
73
64
#[ rustc_legacy_const_generics( 2 ) ]
74
- #[ cfg_attr( test, assert_instr( aes32esi) ) ]
65
+ #[ cfg_attr( test, assert_instr( aes32esi, BS = 0 ) ) ]
75
66
#[ inline]
76
67
pub unsafe fn aes32esi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
77
- static_assert_imm2 ! ( BS ) ;
68
+ static_assert ! ( BS < 4 ) ;
78
69
79
70
_aes32esi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
80
71
}
@@ -102,10 +93,10 @@ pub unsafe fn aes32esi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
102
93
/// This function is safe to use if the `zkne` target feature is present.
103
94
#[ target_feature( enable = "zkne" ) ]
104
95
#[ rustc_legacy_const_generics( 2 ) ]
105
- #[ cfg_attr( test, assert_instr( aes32esmi) ) ]
96
+ #[ cfg_attr( test, assert_instr( aes32esmi, BS = 0 ) ) ]
106
97
#[ inline]
107
98
pub unsafe fn aes32esmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
108
- static_assert_imm2 ! ( BS ) ;
99
+ static_assert ! ( BS < 4 ) ;
109
100
110
101
_aes32esmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
111
102
}
@@ -132,10 +123,10 @@ pub unsafe fn aes32esmi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
132
123
/// This function is safe to use if the `zknd` target feature is present.
133
124
#[ target_feature( enable = "zknd" ) ]
134
125
#[ rustc_legacy_const_generics( 2 ) ]
135
- #[ cfg_attr( test, assert_instr( aes32dsi) ) ]
126
+ #[ cfg_attr( test, assert_instr( aes32dsi, BS = 0 ) ) ]
136
127
#[ inline]
137
128
pub unsafe fn aes32dsi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
138
- static_assert_imm2 ! ( BS ) ;
129
+ static_assert ! ( BS < 4 ) ;
139
130
140
131
_aes32dsi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
141
132
}
@@ -163,10 +154,10 @@ pub unsafe fn aes32dsi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
163
154
/// This function is safe to use if the `zknd` target feature is present.
164
155
#[ target_feature( enable = "zknd" ) ]
165
156
#[ rustc_legacy_const_generics( 2 ) ]
166
- #[ cfg_attr( test, assert_instr( aes32dsmi) ) ]
157
+ #[ cfg_attr( test, assert_instr( aes32dsmi, BS = 0 ) ) ]
167
158
#[ inline]
168
159
pub unsafe fn aes32dsmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
169
- static_assert_imm2 ! ( BS ) ;
160
+ static_assert ! ( BS < 4 ) ;
170
161
171
162
_aes32dsmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
172
163
}
0 commit comments