Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/rustc_target/src/asm/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ 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`.

@RalfJung RalfJung Sep 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this, IMO we should just always error here, and never allow these registers to be used on AIX. This would remove the last cfg_abi check in the asm logic, which is good -- hopefully we'll never accidentally add any new such checks in the future. :)
@taiki-e @Amanieu would that be okay?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it's fine to always emit error here. If you decide to use vec-default as the default, enabling vec-extabi will likely require adding a target modifier, so there's no need to refer to the cfg_abi.

match &target.options.cfg_abi {
CfgAbi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
CfgAbi::VecExtAbi => Ok(()),
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_target/src/spec/base/aix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ use crate::spec::{

pub(crate) fn opts() -> TargetOptions {
TargetOptions {
cfg_abi: CfgAbi::VecExtAbi,
// 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`.
cfg_abi: CfgAbi::VecDefault,
code_model: Some(CodeModel::Large),
cpu: "pwr7".into(),
os: Os::Aix,
Expand Down
Loading
Loading