Repository navigation
Fix fp128 reaching llvm_unreachable on 32-bit PowerPC - #216613
Merged
Merged
Conversation
|
@llvm/pr-subscribers-backend-powerpc Author: beetrees Changes
Fixes #213355 cc @folkertdev 2 Files Affected:
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index d599bba54079b..66f58106c9d9d 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4281,13 +4281,10 @@ SDValue PPCTargetLowering::LowerFormalArguments_32SVR4(
case MVT::v16i8:
case MVT::v8i16:
case MVT::v4i32:
- RC = &PPC::VRRCRegClass;
- break;
case MVT::v4f32:
- RC = &PPC::VRRCRegClass;
- break;
case MVT::v2f64:
case MVT::v2i64:
+ case MVT::f128:
RC = &PPC::VRRCRegClass;
break;
}
diff --git a/llvm/test/CodeGen/PowerPC/ppc32-f128-abi.ll b/llvm/test/CodeGen/PowerPC/ppc32-f128-abi.ll
new file mode 100644
index 0000000000000..967c39e551718
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/ppc32-f128-abi.ll
@@ -0,0 +1,9 @@
+; RUN: llc -verify-machineinstrs -mattr=+vsx < %s | FileCheck %s
+target triple = "powerpc-unknown-linux-gnu"
+
+; CHECK-LABEL: return_second:
+; CHECK: vmr 2, 3
+; CHECK-NEXT: blr
+define fp128 @return_second(fp128, fp128) {
+ ret fp128 %1
+}
|
Contributor
|
I guess I'll just ask: could this be backported? The blast radius is non-existent, and having this work one LLVM major version earlier would be convenient for Rust. |
Iasonaskrpr
pushed a commit
to Iasonaskrpr/llvm-project
that referenced
this pull request
Sep 4, 2026
`fp128` is a legal type that is passed in vector registers when `vsx` is enabled on 32-bit PowerPC: the switch statement didn't account for that, causing an LLVM assertion. Fixes llvm#213355 cc @folkertdev
asudarsa-qti
pushed a commit
to asudarsa-qti/llvm-project
that referenced
this pull request
Sep 4, 2026
`fp128` is a legal type that is passed in vector registers when `vsx` is enabled on 32-bit PowerPC: the switch statement didn't account for that, causing an LLVM assertion. Fixes llvm#213355 cc @folkertdev
addmisol
pushed a commit
to addmisol/llvm-project2
that referenced
this pull request
Sep 6, 2026
`fp128` is a legal type that is passed in vector registers when `vsx` is enabled on 32-bit PowerPC: the switch statement didn't account for that, causing an LLVM assertion. Fixes llvm#213355 cc @folkertdev
Contributor
|
Just hit this during development again, so it would be convenient to backport /cherry-pick 8d1b38f |
Member
Error: Command failed due to missing milestone. |
Contributor
|
/cherry-pick 8d1b38f |
Member
|
/pull-request #224574 |
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 19, 2026
…rees mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 19, 2026
…rees mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 19, 2026
…rees mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Sep 19, 2026
Rollup merge of #162979 - folkertdev:ppc-enable-f128, r=beetrees mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
dyung
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Sep 19, 2026
`fp128` is a legal type that is passed in vector registers when `vsx` is enabled on 32-bit PowerPC: the switch statement didn't account for that, causing an LLVM assertion. Fixes llvm#213355 cc @folkertdev (cherry picked from commit 8d1b38f)
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Sep 20, 2026
mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
github-actions Bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Sep 21, 2026
mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fp128is a legal type that is passed in vector registers whenvsxis enabled on 32-bit PowerPC: the switch statement didn't account for that, causing an LLVM assertion.Fixes #213355
cc @folkertdev