@@ -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 ) ] = & [
@@ -450,13 +467,28 @@ const X86_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
450
467
( "tbm" , unstable ( sym:: tbm_target_feature) , & [ ] ) ,
451
468
( "vaes" , unstable ( sym:: avx512_target_feature) , & [ "avx2" , "aes" ] ) ,
452
469
( "vpclmulqdq" , unstable ( sym:: avx512_target_feature) , & [ "avx" , "pclmulqdq" ] ) ,
470
+ (
471
+ "x87" ,
472
+ Stability :: Unstable {
473
+ nightly_feature : sym:: x87_target_feature,
474
+ allow_toggle : |target : & Target | {
475
+ // Only allow toggling this if the target has `soft-float` set. With `soft-float`,
476
+ // `fpregs` isn't needed so changing it cannot affect the ABI.
477
+ if target. has_feature ( "soft-float" ) {
478
+ Ok ( ( ) )
479
+ } else {
480
+ Err ( "unsound on hard-float targets because it changes float ABI" )
481
+ }
482
+ } ,
483
+ } ,
484
+ & [ ] ,
485
+ ) ,
453
486
( "xop" , unstable ( sym:: xop_target_feature) , & [ /*"fma4", */ "avx" , "sse4a" ] ) ,
454
487
( "xsave" , STABLE , & [ ] ) ,
455
488
( "xsavec" , STABLE , & [ "xsave" ] ) ,
456
489
( "xsaveopt" , STABLE , & [ "xsave" ] ) ,
457
490
( "xsaves" , STABLE , & [ "xsave" ] ) ,
458
491
// tidy-alphabetical-end
459
- // FIXME: need to also forbid turning off `x87` on hardfloat targets
460
492
] ;
461
493
462
494
const HEXAGON_FEATURES : & [ ( & str , StabilityUncomputed , ImpliedFeatures ) ] = & [
0 commit comments