@@ -32,6 +32,8 @@ pub enum Stability<AllowToggle> {
32
32
/// This target feature is unstable. It is only present in `#[cfg(target_feature)]` on
33
33
/// nightly and using it in `#[target_feature]` requires enabling the given nightly feature.
34
34
Unstable {
35
+ /// This must be a *language* feature, or else rustc will ICE when reporting a missing
36
+ /// feature gate!
35
37
nightly_feature : Symbol ,
36
38
/// See `Stable::allow_toggle` comment above.
37
39
allow_toggle : AllowToggle ,
@@ -168,6 +170,22 @@ const ARM_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
168
170
( "dotprod" , unstable ( sym:: arm_target_feature) , & [ "neon" ] ) ,
169
171
( "dsp" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
170
172
( "fp-armv8" , unstable ( sym:: arm_target_feature) , & [ "vfp4" ] ) ,
173
+ (
174
+ "fpregs" ,
175
+ Stability :: Unstable {
176
+ nightly_feature : sym:: arm_target_feature,
177
+ allow_toggle : |target : & Target | {
178
+ // Only allow toggling this if the target has `soft-float` set. With `soft-float`,
179
+ // `fpregs` isn't needed so changing it cannot affect the ABI.
180
+ if target. has_feature ( "soft-float" ) {
181
+ Ok ( ( ) )
182
+ } else {
183
+ Err ( "unsound on hard-float targets because it changes float ABI" )
184
+ }
185
+ } ,
186
+ } ,
187
+ & [ ] ,
188
+ ) ,
171
189
( "i8mm" , unstable ( sym:: arm_target_feature) , & [ "neon" ] ) ,
172
190
( "mclass" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
173
191
( "neon" , unstable ( sym:: arm_target_feature) , & [ "vfp3" ] ) ,
@@ -191,7 +209,6 @@ const ARM_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
191
209
( "vfp4" , unstable ( sym:: arm_target_feature) , & [ "vfp3" ] ) ,
192
210
( "virtualization" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
193
211
// tidy-alphabetical-end
194
- // FIXME: need to also forbid turning off `fpregs` on hardfloat targets
195
212
] ;
196
213
197
214
const AARCH64_FEATURES : & [ ( & str , StabilityUncomputed , ImpliedFeatures ) ] = & [
@@ -444,13 +461,28 @@ const X86_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
444
461
( "tbm" , unstable ( sym:: tbm_target_feature) , & [ ] ) ,
445
462
( "vaes" , unstable ( sym:: avx512_target_feature) , & [ "avx2" , "aes" ] ) ,
446
463
( "vpclmulqdq" , unstable ( sym:: avx512_target_feature) , & [ "avx" , "pclmulqdq" ] ) ,
464
+ (
465
+ "x87" ,
466
+ Stability :: Unstable {
467
+ nightly_feature : sym:: x87_target_feature,
468
+ allow_toggle : |target : & Target | {
469
+ // Only allow toggling this if the target has `soft-float` set. With `soft-float`,
470
+ // `fpregs` isn't needed so changing it cannot affect the ABI.
471
+ if target. has_feature ( "soft-float" ) {
472
+ Ok ( ( ) )
473
+ } else {
474
+ Err ( "unsound on hard-float targets because it changes float ABI" )
475
+ }
476
+ } ,
477
+ } ,
478
+ & [ ] ,
479
+ ) ,
447
480
( "xop" , unstable ( sym:: xop_target_feature) , & [ /*"fma4", */ "avx" , "sse4a" ] ) ,
448
481
( "xsave" , STABLE , & [ ] ) ,
449
482
( "xsavec" , STABLE , & [ "xsave" ] ) ,
450
483
( "xsaveopt" , STABLE , & [ "xsave" ] ) ,
451
484
( "xsaves" , STABLE , & [ "xsave" ] ) ,
452
485
// tidy-alphabetical-end
453
- // FIXME: need to also forbid turning off `x87` on hardfloat targets
454
486
] ;
455
487
456
488
const HEXAGON_FEATURES : & [ ( & str , StabilityUncomputed , ImpliedFeatures ) ] = & [
0 commit comments