@@ -32,6 +32,8 @@ pub enum Stability<AllowToggle> {
3232 /// This target feature is unstable. It is only present in `#[cfg(target_feature)]` on
3333 /// nightly and using it in `#[target_feature]` requires enabling the given nightly feature.
3434 Unstable {
35+ /// This must be a *language* feature, or else rustc will ICE when reporting a missing
36+ /// feature gate!
3537 nightly_feature : Symbol ,
3638 /// See `Stable::allow_toggle` comment above.
3739 allow_toggle : AllowToggle ,
@@ -168,6 +170,22 @@ const ARM_FEATURES: &[(&str, StabilityLazy, ImpliedFeatures)] = &[
168170 ( "dotprod" , unstable ( sym:: arm_target_feature) , & [ "neon" ] ) ,
169171 ( "dsp" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
170172 ( "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+ ) ,
171189 ( "i8mm" , unstable ( sym:: arm_target_feature) , & [ "neon" ] ) ,
172190 ( "mclass" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
173191 ( "neon" , unstable ( sym:: arm_target_feature) , & [ "vfp3" ] ) ,
@@ -191,7 +209,6 @@ const ARM_FEATURES: &[(&str, StabilityLazy, ImpliedFeatures)] = &[
191209 ( "vfp4" , unstable ( sym:: arm_target_feature) , & [ "vfp3" ] ) ,
192210 ( "virtualization" , unstable ( sym:: arm_target_feature) , & [ ] ) ,
193211 // tidy-alphabetical-end
194- // FIXME: need to also forbid turning off `fpregs` on hardfloat targets
195212] ;
196213
197214const AARCH64_FEATURES : & [ ( & str , StabilityLazy , ImpliedFeatures ) ] = & [
@@ -444,13 +461,28 @@ const X86_FEATURES: &[(&str, StabilityLazy, ImpliedFeatures)] = &[
444461 ( "tbm" , unstable ( sym:: tbm_target_feature) , & [ ] ) ,
445462 ( "vaes" , unstable ( sym:: avx512_target_feature) , & [ "avx2" , "aes" ] ) ,
446463 ( "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+ ) ,
447480 ( "xop" , unstable ( sym:: xop_target_feature) , & [ /*"fma4", */ "avx" , "sse4a" ] ) ,
448481 ( "xsave" , STABLE , & [ ] ) ,
449482 ( "xsavec" , STABLE , & [ "xsave" ] ) ,
450483 ( "xsaveopt" , STABLE , & [ "xsave" ] ) ,
451484 ( "xsaves" , STABLE , & [ "xsave" ] ) ,
452485 // tidy-alphabetical-end
453- // FIXME: need to also forbid turning off `x87` on hardfloat targets
454486] ;
455487
456488const HEXAGON_FEATURES : & [ ( & str , StabilityLazy , ImpliedFeatures ) ] = & [
0 commit comments