Refactor powerpc64 call ABI handling#128643
Conversation
|
r? @bjorn3 (feel free to reroll, or, I can open a T-compiler thread asking for a suitable reviewer) |
|
cc @ecnelises and @bzEq since you were listed as powerpc64-ibm-aix target maintainers, and this affects your target AFAICT. |
|
Is a codegen regression test possible here? |
|
An assembly test would be nice. |
|
Thank you! This looks right to me. I'll do a test run on my PPC64 musl workstation soon (it is currently doing some LLVM work) and will let you know the result. |
Thanks for heads up. However, AIX has its own ABI and is not using ELFv1/v2. Anyway, I'll test this PR on AIX. |
|
Further, I don't think AIX ABI is a blocker for this PR. If it breaks AIX in our buildbot, we will upstream AIX change. |
|
I've added an assembly test for the PowerPC64 struct ABI. |
This comment has been minimized.
This comment has been minimized.
|
I've just queued the latest version of this patch (dd2fc07) on my powerpc64-musl build system, and will let you know the result in about two hours when it finishes. |
This comment has been minimized.
This comment has been minimized.
|
All tests pass here on powerpc64-musl (BE)! Including the new tests that the CI bot seems to believe are failing: This system is using LLVM 18.1.8, so perhaps it is an LLVM 17 issue. |
1c55e73 to
6308d13
Compare
|
I've fixed the test so that it works on LLVM 17. |
|
By the way did you try abi-cafe with these changes? It is pretty good at finding abi divergences between compilers. |
|
r=me if abi-cafe passes. |
|
I've ran |
|
I see the same on powerpc64-musl here; i128/u128 failures but otherwise |
|
Thanls for testing. The u128/i128 issue can be fixed later. @bors r+ |
Refactor `powerpc64` call ABI handling As the [specification](https://openpowerfoundation.org/specifications/64bitelfabi/) for the ELFv2 ABI states that returned aggregates are returned like arguments as long as they are at most two doublewords, I've merged the `classify_arg` and `classify_ret` functions to reduce code duplication. The only functional change is to fix rust-lang#128579: the `classify_ret` function was incorrectly handling aggregates where `bits > 64 && bits < 128`. I've used the aggregate handling implementation from `classify_arg` which doesn't have this issue. `@awilfox` could you test this on `powerpc64-unknown-linux-musl`? I'm only able to cross-test on `powerpc64-unknown-linux-gnu` and `powerpc64le-unknown-linux-gnu` locally at the moment, and as a tier 3 target `powerpc64-unknown-linux-musl` has zero CI coverage. Fixes: rust-lang#128579
Refactor `powerpc64` call ABI handling As the [specification](https://openpowerfoundation.org/specifications/64bitelfabi/) for the ELFv2 ABI states that returned aggregates are returned like arguments as long as they are at most two doublewords, I've merged the `classify_arg` and `classify_ret` functions to reduce code duplication. The only functional change is to fix rust-lang#128579: the `classify_ret` function was incorrectly handling aggregates where `bits > 64 && bits < 128`. I've used the aggregate handling implementation from `classify_arg` which doesn't have this issue. ``@awilfox`` could you test this on `powerpc64-unknown-linux-musl`? I'm only able to cross-test on `powerpc64-unknown-linux-gnu` and `powerpc64le-unknown-linux-gnu` locally at the moment, and as a tier 3 target `powerpc64-unknown-linux-musl` has zero CI coverage. Fixes: rust-lang#128579
Rollup of 5 pull requests Successful merges: - rust-lang#128643 (Refactor `powerpc64` call ABI handling) - rust-lang#128873 (Add windows-targets crate to std's sysroot) - rust-lang#128916 (Tidy up `dump-ice-to-disk` and make assertion failures dump ICE messages) - rust-lang#128929 (Fix codegen-units tests that were disabled 8 years ago) - rust-lang#128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`) r? `@ghost` `@rustbot` modify labels: rollup
|
Failed in #128968 (comment). |
6308d13 to
715728f
Compare
|
I've fixed the test. |
|
@bors r+ |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128643 (Refactor `powerpc64` call ABI handling) - rust-lang#128655 (std: refactor UNIX random data generation) - rust-lang#128745 (Remove unused lifetime parameter from spawn_unchecked) - rust-lang#128841 (bootstrap: don't use rustflags for `--rustc-args`) - rust-lang#128983 (Slightly refactor `TargetSelection` in bootstrap) - rust-lang#129026 (CFI: Move CFI ui tests to cfi directory) - rust-lang#129040 (Fix blessing of rmake tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128643 - beetrees:ppc64-abi-fix, r=bjorn3 Refactor `powerpc64` call ABI handling As the [specification](https://openpowerfoundation.org/specifications/64bitelfabi/) for the ELFv2 ABI states that returned aggregates are returned like arguments as long as they are at most two doublewords, I've merged the `classify_arg` and `classify_ret` functions to reduce code duplication. The only functional change is to fix rust-lang#128579: the `classify_ret` function was incorrectly handling aggregates where `bits > 64 && bits < 128`. I've used the aggregate handling implementation from `classify_arg` which doesn't have this issue. `@awilfox` could you test this on `powerpc64-unknown-linux-musl`? I'm only able to cross-test on `powerpc64-unknown-linux-gnu` and `powerpc64le-unknown-linux-gnu` locally at the moment, and as a tier 3 target `powerpc64-unknown-linux-musl` has zero CI coverage. Fixes: rust-lang#128579
As the specification for the ELFv2 ABI states that returned aggregates are returned like arguments as long as they are at most two doublewords, I've merged the
classify_argandclassify_retfunctions to reduce code duplication. The only functional change is to fix #128579: theclassify_retfunction was incorrectly handling aggregates wherebits > 64 && bits < 128. I've used the aggregate handling implementation fromclassify_argwhich doesn't have this issue.@awilfox could you test this on
powerpc64-unknown-linux-musl? I'm only able to cross-test onpowerpc64-unknown-linux-gnuandpowerpc64le-unknown-linux-gnulocally at the moment, and as a tier 3 targetpowerpc64-unknown-linux-muslhas zero CI coverage.Fixes: #128579