@@ -42,7 +42,8 @@ pub fn _bextri_u32<const CONTROL: u32>(a: u32) -> u32 {
4242#[ target_feature( enable = "tbm" ) ]
4343#[ cfg_attr( test, assert_instr( blcfill) ) ]
4444#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
45- pub fn _blcfill_u32 ( x : u32 ) -> u32 {
45+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
46+ pub const fn _blcfill_u32 ( x : u32 ) -> u32 {
4647 x & ( x. wrapping_add ( 1 ) )
4748}
4849
@@ -53,7 +54,8 @@ pub fn _blcfill_u32(x: u32) -> u32 {
5354#[ target_feature( enable = "tbm" ) ]
5455#[ cfg_attr( test, assert_instr( blci) ) ]
5556#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
56- pub fn _blci_u32 ( x : u32 ) -> u32 {
57+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
58+ pub const fn _blci_u32 ( x : u32 ) -> u32 {
5759 x | !x. wrapping_add ( 1 )
5860}
5961
@@ -64,7 +66,8 @@ pub fn _blci_u32(x: u32) -> u32 {
6466#[ target_feature( enable = "tbm" ) ]
6567#[ cfg_attr( test, assert_instr( blcic) ) ]
6668#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
67- pub fn _blcic_u32 ( x : u32 ) -> u32 {
69+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
70+ pub const fn _blcic_u32 ( x : u32 ) -> u32 {
6871 !x & x. wrapping_add ( 1 )
6972}
7073
@@ -76,7 +79,8 @@ pub fn _blcic_u32(x: u32) -> u32 {
7679#[ target_feature( enable = "tbm" ) ]
7780#[ cfg_attr( test, assert_instr( blcmsk) ) ]
7881#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
79- pub fn _blcmsk_u32 ( x : u32 ) -> u32 {
82+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
83+ pub const fn _blcmsk_u32 ( x : u32 ) -> u32 {
8084 x ^ x. wrapping_add ( 1 )
8185}
8286
@@ -87,7 +91,8 @@ pub fn _blcmsk_u32(x: u32) -> u32 {
8791#[ target_feature( enable = "tbm" ) ]
8892#[ cfg_attr( test, assert_instr( blcs) ) ]
8993#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
90- pub fn _blcs_u32 ( x : u32 ) -> u32 {
94+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
95+ pub const fn _blcs_u32 ( x : u32 ) -> u32 {
9196 x | x. wrapping_add ( 1 )
9297}
9398
@@ -98,7 +103,8 @@ pub fn _blcs_u32(x: u32) -> u32 {
98103#[ target_feature( enable = "tbm" ) ]
99104#[ cfg_attr( test, assert_instr( blsfill) ) ]
100105#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
101- pub fn _blsfill_u32 ( x : u32 ) -> u32 {
106+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
107+ pub const fn _blsfill_u32 ( x : u32 ) -> u32 {
102108 x | x. wrapping_sub ( 1 )
103109}
104110
@@ -109,7 +115,8 @@ pub fn _blsfill_u32(x: u32) -> u32 {
109115#[ target_feature( enable = "tbm" ) ]
110116#[ cfg_attr( test, assert_instr( blsic) ) ]
111117#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
112- pub fn _blsic_u32 ( x : u32 ) -> u32 {
118+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
119+ pub const fn _blsic_u32 ( x : u32 ) -> u32 {
113120 !x | x. wrapping_sub ( 1 )
114121}
115122
@@ -121,7 +128,8 @@ pub fn _blsic_u32(x: u32) -> u32 {
121128#[ target_feature( enable = "tbm" ) ]
122129#[ cfg_attr( test, assert_instr( t1mskc) ) ]
123130#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
124- pub fn _t1mskc_u32 ( x : u32 ) -> u32 {
131+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
132+ pub const fn _t1mskc_u32 ( x : u32 ) -> u32 {
125133 !x | x. wrapping_add ( 1 )
126134}
127135
@@ -133,12 +141,14 @@ pub fn _t1mskc_u32(x: u32) -> u32 {
133141#[ target_feature( enable = "tbm" ) ]
134142#[ cfg_attr( test, assert_instr( tzmsk) ) ]
135143#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
136- pub fn _tzmsk_u32 ( x : u32 ) -> u32 {
144+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
145+ pub const fn _tzmsk_u32 ( x : u32 ) -> u32 {
137146 !x & x. wrapping_sub ( 1 )
138147}
139148
140149#[ cfg( test) ]
141150mod tests {
151+ use crate :: core_arch:: assert_eq_const as assert_eq;
142152 use stdarch_test:: simd_test;
143153
144154 use crate :: core_arch:: x86:: * ;
@@ -149,13 +159,13 @@ mod tests {
149159 }
150160
151161 #[ simd_test( enable = "tbm" ) ]
152- unsafe fn test_blcfill_u32 ( ) {
162+ const unsafe fn test_blcfill_u32 ( ) {
153163 assert_eq ! ( _blcfill_u32( 0b0101_0111u32 ) , 0b0101_0000u32 ) ;
154164 assert_eq ! ( _blcfill_u32( 0b1111_1111u32 ) , 0u32 ) ;
155165 }
156166
157167 #[ simd_test( enable = "tbm" ) ]
158- unsafe fn test_blci_u32 ( ) {
168+ const unsafe fn test_blci_u32 ( ) {
159169 assert_eq ! (
160170 _blci_u32( 0b0101_0000u32 ) ,
161171 0b1111_1111_1111_1111_1111_1111_1111_1110u32
@@ -167,25 +177,25 @@ mod tests {
167177 }
168178
169179 #[ simd_test( enable = "tbm" ) ]
170- unsafe fn test_blcic_u32 ( ) {
180+ const unsafe fn test_blcic_u32 ( ) {
171181 assert_eq ! ( _blcic_u32( 0b0101_0001u32 ) , 0b0000_0010u32 ) ;
172182 assert_eq ! ( _blcic_u32( 0b1111_1111u32 ) , 0b1_0000_0000u32 ) ;
173183 }
174184
175185 #[ simd_test( enable = "tbm" ) ]
176- unsafe fn test_blcmsk_u32 ( ) {
186+ const unsafe fn test_blcmsk_u32 ( ) {
177187 assert_eq ! ( _blcmsk_u32( 0b0101_0001u32 ) , 0b0000_0011u32 ) ;
178188 assert_eq ! ( _blcmsk_u32( 0b1111_1111u32 ) , 0b1_1111_1111u32 ) ;
179189 }
180190
181191 #[ simd_test( enable = "tbm" ) ]
182- unsafe fn test_blcs_u32 ( ) {
192+ const unsafe fn test_blcs_u32 ( ) {
183193 assert_eq ! ( _blcs_u32( 0b0101_0001u32 ) , 0b0101_0011u32 ) ;
184194 assert_eq ! ( _blcs_u32( 0b1111_1111u32 ) , 0b1_1111_1111u32 ) ;
185195 }
186196
187197 #[ simd_test( enable = "tbm" ) ]
188- unsafe fn test_blsfill_u32 ( ) {
198+ const unsafe fn test_blsfill_u32 ( ) {
189199 assert_eq ! ( _blsfill_u32( 0b0101_0100u32 ) , 0b0101_0111u32 ) ;
190200 assert_eq ! (
191201 _blsfill_u32( 0u32 ) ,
@@ -194,7 +204,7 @@ mod tests {
194204 }
195205
196206 #[ simd_test( enable = "tbm" ) ]
197- unsafe fn test_blsic_u32 ( ) {
207+ const unsafe fn test_blsic_u32 ( ) {
198208 assert_eq ! (
199209 _blsic_u32( 0b0101_0100u32 ) ,
200210 0b1111_1111_1111_1111_1111_1111_1111_1011u32
@@ -206,7 +216,7 @@ mod tests {
206216 }
207217
208218 #[ simd_test( enable = "tbm" ) ]
209- unsafe fn test_t1mskc_u32 ( ) {
219+ const unsafe fn test_t1mskc_u32 ( ) {
210220 assert_eq ! (
211221 _t1mskc_u32( 0b0101_0111u32 ) ,
212222 0b1111_1111_1111_1111_1111_1111_1111_1000u32
@@ -218,7 +228,7 @@ mod tests {
218228 }
219229
220230 #[ simd_test( enable = "tbm" ) ]
221- unsafe fn test_tzmsk_u32 ( ) {
231+ const unsafe fn test_tzmsk_u32 ( ) {
222232 assert_eq ! ( _tzmsk_u32( 0b0101_1000u32 ) , 0b0000_0111u32 ) ;
223233 assert_eq ! ( _tzmsk_u32( 0b0101_1001u32 ) , 0b0000_0000u32 ) ;
224234 }
0 commit comments