Skip to content

rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe - #157140

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
taiki-e:powerpcspe-asm
Jun 4, 2026
Merged

rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe #157140
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
taiki-e:powerpcspe-asm

Conversation

@taiki-e

@taiki-etaiki-e commented May 30, 2026

Copy link
Copy Markdown
Member

When self-reviewing #157137, I recalled a previous my comment (#153876 (comment)) about a case where cfg_abi is referred but rustc_abi should be referred.

There is another powerpc code that refers to abi field, but it should be changed to refer to the target feature.

tests/codegen-llvm/asm/powerpc-clobbers.rs contains a test to check whether this detection is working properly:

// powerpcspe: asm sideeffect "nop", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer},~{spe_acc}"()

r? @RalfJung

@rustbot label +O-PowerPC +A-target-feature

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 30, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot added A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. O-PowerPC Target: PowerPC processors labels May 30, 2026

pub(crate) fn is_spe(target_features: &FxIndexSet<Symbol>) -> bool {
target_features.contains(&sym::spe)
}

@RalfJungRalfJungMay 30, 2026

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.

No, we can't do this. Target features are not guaranteed to be consistent across the crate graph. Also we shouldn't parse the target feature like this. Instead, we have the target unambiguously indicate the ABI and then we force the target features to match.

I am working on extending #157085 with SPE support.

@RalfJungRalfJungMay 30, 2026

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.

Here's a patch that extends our existing ABI tracking to also cover SPE:
751237abda7

@rust-bors

This comment has been minimized.

@taiki-etaiki-e changed the title rustc_target: Use target_feature instead of cfg_abi to detect powerpcspe rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe Jun 4, 2026
@taiki-e

Copy link
Copy Markdown
MemberAuthor

Updated to refer rustc_abi.

@taiki-e
taiki-e marked this pull request as ready for review June 4, 2026 16:10
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2026
@RalfJung

Copy link
Copy Markdown
Member

@bors r+ rollup

Nice, removing more cfg_abi usage in the compiler is always a good sign.

@rust-bors

rust-borsBot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d4e6f26 has been approved by RalfJung

It is now in the queue for this repository.

@rust-borsrust-borsBot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 4, 2026
…uwer
Rollup of 8 pull requests
Successful merges:
- #156281 (Emit nofree attribute)
- #157305 (Eagerly decide whether relaxed bounds are allowed or not)
- #148713 (rustc_borrowck: fix async closure error note to report AsyncFn rather than Fn)
- #156266 (Don't ICE in has_self_borrows when coroutine captures-by-ref ty is still inferred)
- #156417 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented)
- #156956 (Support generic params in `Lift_Generic`)
- #157140 ( rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe )
- #157423 (Refactor/expand rustc_attr_parsing docs)
@rust-bors
rust-borsBot merged commit 7ff0bb8 into rust-lang:mainJun 4, 2026
12 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jun 4, 2026
rust-timer added a commit that referenced this pull request Jun 4, 2026
Rollup merge of #157140 - taiki-e:powerpcspe-asm, r=RalfJung
rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe
When self-reviewing #157137, I recalled a previous my comment (#153876 (comment)) about a case where cfg_abi is referred but rustc_abi should be referred.
> There is another powerpc code that [refers to `abi` field](https://github.com/rust-lang/rust/blob/bfc05d6b072585dfd0c792ec1b8728c08a3511fe/compiler/rustc_target/src/asm/powerpc.rs#L125), but it should be changed to refer to the target feature.
`tests/codegen-llvm/asm/powerpc-clobbers.rs` contains a test to check whether this detection is working properly:
https://github.com/rust-lang/rust/blob/6368fd52cb9f230dfb156097625993e7a8891800/tests/codegen-llvm/asm/powerpc-clobbers.rs#L123
r? @RalfJung@rustbot label +O-PowerPC +A-target-feature
@taiki-e
taiki-e deleted the powerpcspe-asm branch June 5, 2026 00:51
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 5fb2ec4

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5fb2ec4): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.1%[0.1%, 0.1%]1
Improvements ✅
(primary)
-0.7%[-0.7%, -0.7%]1
Improvements ✅
(secondary)
-0.1%[-0.4%, -0.0%]4
All ❌✅ (primary)-0.7%[-0.7%, -0.7%]1

Max RSS (memory usage)

Results (primary -1.3%, secondary 1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
4.5%[2.9%, 6.2%]2
Regressions ❌
(secondary)
5.7%[5.7%, 5.7%]1
Improvements ✅
(primary)
-5.2%[-6.0%, -4.1%]3
Improvements ✅
(secondary)
-2.2%[-2.2%, -2.2%]1
All ❌✅ (primary)-1.3%[-6.0%, 6.2%]5

Cycles

Results (primary -3.6%, secondary -3.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
3.6%[3.0%, 4.2%]2
Improvements ✅
(primary)
-3.6%[-7.6%, -1.4%]118
Improvements ✅
(secondary)
-3.5%[-8.1%, -1.6%]101
All ❌✅ (primary)-3.6%[-7.6%, -1.4%]118

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 512.944s -> 512.514s (-0.08%)
Artifact size: 398.65 MiB -> 398.64 MiB (-0.00%)

@rustbotrustbot added the perf-regression Performance regression. label Jun 5, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rustbot label: +perf-regression-triaged
Noise

@rustbotrustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 5, 2026
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 20, 2026
…uwer
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#156281 (Emit nofree attribute)
- rust-lang/rust#157305 (Eagerly decide whether relaxed bounds are allowed or not)
- rust-lang/rust#148713 (rustc_borrowck: fix async closure error note to report AsyncFn rather than Fn)
- rust-lang/rust#156266 (Don't ICE in has_self_borrows when coroutine captures-by-ref ty is still inferred)
- rust-lang/rust#156417 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented)
- rust-lang/rust#156956 (Support generic params in `Lift_Generic`)
- rust-lang/rust#157140 ( rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe )
- rust-lang/rust#157423 (Refactor/expand rustc_attr_parsing docs)
Kobzol pushed a commit to Kobzol/rust that referenced this pull request Jun 21, 2026
…nathanBrouwer
Rollup of 8 pull requests
Successful merges:
- rust-lang#156281 (Emit nofree attribute)
- rust-lang#157305 (Eagerly decide whether relaxed bounds are allowed or not)
- rust-lang#148713 (rustc_borrowck: fix async closure error note to report AsyncFn rather than Fn)
- rust-lang#156266 (Don't ICE in has_self_borrows when coroutine captures-by-ref ty is still inferred)
- rust-lang#156417 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented)
- rust-lang#156956 (Support generic params in `Lift_Generic`)
- rust-lang#157140 ( rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe )
- rust-lang#157423 (Refactor/expand rustc_attr_parsing docs)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.O-PowerPCTarget: PowerPC processorsperf-regressionPerformance regression.perf-regression-triagedThe performance regression has been triaged.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@taiki-e@rustbot@RalfJung@JonathanBrouwer@rust-timer