diff --git a/compiler/rustc_target/src/asm/powerpc.rs b/compiler/rustc_target/src/asm/powerpc.rs index 36a8657c5d4..54a93935afa 100644 --- a/compiler/rustc_target/src/asm/powerpc.rs +++ b/compiler/rustc_target/src/asm/powerpc.rs @@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_span::Symbol; use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use crate::spec::{CfgAbi, RelocModel, RustcAbi, Target}; +use crate::spec::{RelocModel, RustcAbi, Target}; def_reg_class! { PowerPC PowerPCInlineAsmRegClass { @@ -107,15 +107,8 @@ fn reserved_v20to31( _is_clobber: bool, ) -> Result<(), &'static str> { if target.is_like_aix { - // FIXME: using `cfg_abi` here is wrong -- that's not a source of truth, it's just - // what we display to the user. Instead we need to check the knob that controls - // whether the ABI is actually used. Currently there is no such knob, a Rust target - // can therefore never actually use `vec-extabi`. - match &target.options.cfg_abi { - CfgAbi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"), - CfgAbi::VecExtAbi => Ok(()), - abi => unreachable!("unrecognized AIX ABI: {abi}"), - } + // We do not support the vec-extabi at the moment. + Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI") } else { Ok(()) } diff --git a/compiler/rustc_target/src/spec/base/aix.rs b/compiler/rustc_target/src/spec/base/aix.rs index 5d172cc8b0f..1f581a01b16 100644 --- a/compiler/rustc_target/src/spec/base/aix.rs +++ b/compiler/rustc_target/src/spec/base/aix.rs @@ -8,10 +8,11 @@ use crate::spec::{ pub(crate) fn opts() -> TargetOptions { TargetOptions { // It makes no sense to set "vec-extabi" here without also actually configuring LLVM to use - // that ABI. This needs a new target spec knob to control the relevant LLVM flag. If you are - // adding such a knob, make sure to also: - // - adjust the logic in `asm/powerpc.rs` to check that knob instead of checking `cfg_abi`. - // - adjust the logic in `spec/consistency.rs` to correlate that knob with `cfg_abi`. + // that ABI. Since https://github.com/llvm/llvm-project/pull/221670 this probably just needs + // `llvm_abiname` to be set properly. If you are doing that, make sure to also: + // - adjust the logic in `reserved_v20to31` in `asm/powerpc.rs` to allow the extra registers + // to be used depending on `llvm_abiname`. + // - adjust the logic in `spec/consistency.rs` to correlate `llvm_abiname` with `cfg_abi`. cfg_abi: CfgAbi::VecDefault, code_model: Some(CodeModel::Large), cpu: "pwr7".into(), diff --git a/compiler/rustc_target/src/spec/consistency.rs b/compiler/rustc_target/src/spec/consistency.rs index cdfbd6c2acb..5f88c352d33 100644 --- a/compiler/rustc_target/src/spec/consistency.rs +++ b/compiler/rustc_target/src/spec/consistency.rs @@ -484,7 +484,7 @@ impl Target { // (vec-default vs vec-ext). check_matches!( (&self.llvm_abiname, &self.cfg_abi), - (LlvmAbi::Unspecified, CfgAbi::VecDefault | CfgAbi::VecExtAbi), + (LlvmAbi::Unspecified, CfgAbi::VecDefault), "invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\ ABI name: {}\n\ cfg(target_abi): {}", diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 9f97a33bfdc..42d817c7daa 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1950,7 +1950,6 @@ crate::target_spec_enum! { Spe = "spe", Uwp = "uwp", VecDefault = "vec-default", - VecExtAbi = "vec-extabi", X32 = "x32", V8Plus = "v8plus", Unspecified = "",