remove incorrect cfg_abi check from asm/powerpc; that makes CfgAbi::VecExtAbi basically unused so remove it

This commit is contained in:
Ralf Jung
2026-09-21 18:35:35 +02:00
parent 22e16a4eae
commit 7dc9aeebf8
4 changed files with 9 additions and 16 deletions

View File

@@ -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(())
}

View File

@@ -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(),

View File

@@ -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): {}",

View File

@@ -1950,7 +1950,6 @@ crate::target_spec_enum! {
Spe = "spe",
Uwp = "uwp",
VecDefault = "vec-default",
VecExtAbi = "vec-extabi",
X32 = "x32",
V8Plus = "v8plus",
Unspecified = "",