Skip to content

mark f128 as reliable on powerpc64 with +vsx - #162979

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:ppc-enable-f128
Sep 19, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:ppc-enable-f128

Conversation

@folkertdev

Copy link
Copy Markdown
Contributor

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

@folkertdev folkertdev added the F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` label Sep 18, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 18, 2026
@rust-log-analyzer

This comment has been minimized.

@beetrees

Copy link
Copy Markdown
Contributor

This will result in target_has_reliable_f128 being different e.g. if linking core/std compiled without vsx to a test compiled with -Ctarget-feature=+vsx, but that's not how compiler tests are ran in practice and this is an internal cfg so I think that's fine.

@bors r+

@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b540652 has been approved by beetrees

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 18, 2026
@beetrees

Copy link
Copy Markdown
Contributor

@bors r-

Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall.

Seems to work on compiler explorer?

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 18, 2026
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@folkertdev

Copy link
Copy Markdown
Contributor Author

I think LLVM just emits that symbol, but it does not actually exist

#![feature(f128)]

#[unsafe(no_mangle)]
pub fn square(num: f128) -> f128 {
    num.sin()
}

fn main() {
    dbg!(square(3.14));
    dbg!(3.14f32.sin());
}

with cargo +stage1 run --target powerpc64-unknown-linux-gnu gives

error: linking with `powerpc64-linux-gnu-gcc` failed: exit status: 1
  |
  = note:  "powerpc64-linux-gnu-gcc" "-m64" "/home/folkertdev/rust/playground/target/powerpc64-unknown-linux-gnu/debug/build/playground/fc020cdbc196014d/out/rustc1Mxegi/symbols.o" "<15 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/powerpc64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/home/folkertdev/rust/playground/target/powerpc64-unknown-linux-gnu/debug/build/playground/fc020cdbc196014d/out/rustc1Mxegi/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/powerpc64-unknown-linux-gnu/lib" "-o" "/home/folkertdev/rust/playground/target/powerpc64-unknown-linux-gnu/debug/build/playground/fc020cdbc196014d/out/playground" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/lib/gcc-cross/powerpc64-linux-gnu/13/../../../../powerpc64-linux-gnu/bin/ld: /home/folkertdev/rust/playground/target/powerpc64-unknown-linux-gnu/debug/build/playground/fc020cdbc196014d/out/playground.86r5npe4uuwy526gz589nbf7b.02b4q5j.rcgu.o: in function `<f128>::sin':
          /home/folkertdev/rust/rust/library/std/src/num/f128.rs:381:(.text._RNvMNtCs2SUpeEcTk1l_3std4f128C4f1283sinCs33bJLyDsXdB_10playground+0x14): undefined reference to `sinf128'
          collect2: error: ld returned 1 exit status

That is different from the x86 issue though (which means I must be misunderstanding the x86 problem in LLVM, or it just does not actually apply here and really is x86-specific). I'll adjust the comment.

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
@folkertdev

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot 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 Sep 18, 2026
@beetrees

Copy link
Copy Markdown
Contributor

A quick check on compiler explorer suggests LLVM has emitted the correct libcalls for x86_64 since LLVM 19. I think the main blocker now on most major targets is implementing the symbols in compiler builtins. That does lead me to wonder whether the blanket (_, Os::Linux) if target_pointer_width == 64 => true is accurate, if they're not available on big-endian 64-bit PowerPC. Regardless, this change is an improvement over the status quo, so @bors r+

@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a3ad87e has been approved by beetrees

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 18, 2026
@folkertdev

Copy link
Copy Markdown
Contributor Author

A quick check on compiler explorer suggests LLVM has emitted the correct libcalls for x86_64 since LLVM 19.

Right, but only on gnu targets. I ran into this before

llvm/llvm-project#44744 (comment)

For powerpc even with the musl targets the names are correct. Just, musl does not provide any f128 implementations as far as I'm aware.

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
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup of 18 pull requests

Successful merges:

 - #162499 (`rustc_codegen_gcc` subtree update)
 - #161424 (implement `VaArgSafe` for `f128`)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - #161743 (Add performance notes for the floating-point round method)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - #162873 (Adjust `bug!`/`span_bug!` emission)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - #162981 (rustc-dev-guide subtree update)

Failed merges:

 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup of 18 pull requests

Successful merges:

 - #162499 (`rustc_codegen_gcc` subtree update)
 - #161424 (implement `VaArgSafe` for `f128`)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - #161743 (Add performance notes for the floating-point round method)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - #162873 (Adjust `bug!`/`span_bug!` emission)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - #162981 (rustc-dev-guide subtree update)

Failed merges:

 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
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 that referenced this pull request Sep 19, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #163001 (Temporarily disable `test-x86_64-fuchsia`)
 - #162880 (Mini optimization in `rustc_hir_typeck::upvar::restrict_precision_for_drop_types`)
 - #161424 (implement `VaArgSafe` for `f128`)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - #162924 (Remove applying inline attributes at the callsite)
 - #162940 (Use spawned `SBDebugger` instance)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - #161743 (Add performance notes for the floating-point round method)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - #162873 (Adjust `bug!`/`span_bug!` emission)
 - #162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - #162971 (libtest harness: avoid 'extern crate test' with custom runner)
 - #162981 (rustc-dev-guide subtree update)
 - #162985 (Error on invalid placements for unstable attributes)
@rust-bors
rust-bors Bot merged commit e69c8f3 into rust-lang:main Sep 19, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 19, 2026
rust-bors Bot pushed a commit 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
@tgross35

Copy link
Copy Markdown
Member

I guess AIX has VSX but is still broken llvm/llvm-project#101545, seems like this may have broken builds on the target https://github.com/rust-lang/libc/actions/runs/35495229282/job/106036887284?pr=5411

dybucc added a commit to dybucc/libc that referenced this pull request Sep 20, 2026
Skip AIX targets from CI tests while rust-lang/rust#162979 gets sorted
out.
@folkertdev folkertdev added the O-PowerPC Target: PowerPC processors label Sep 20, 2026
pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Sep 20, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#163001 (Temporarily disable `test-x86_64-fuchsia`)
 - rust-lang/rust#162880 (Mini optimization in `rustc_hir_typeck::upvar::restrict_precision_for_drop_types`)
 - rust-lang/rust#161424 (implement `VaArgSafe` for `f128`)
 - rust-lang/rust#161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - rust-lang/rust#162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - rust-lang/rust#162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - rust-lang/rust#162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - rust-lang/rust#162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - rust-lang/rust#162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - rust-lang/rust#162924 (Remove applying inline attributes at the callsite)
 - rust-lang/rust#162940 (Use spawned `SBDebugger` instance)
 - rust-lang/rust#162950 (More AST lowering cleanups)
 - rust-lang/rust#162964 (Update `browser-ui-test` version to `0.25.2`)
 - rust-lang/rust#162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - rust-lang/rust#161743 (Add performance notes for the floating-point round method)
 - rust-lang/rust#162797 (yeet AliasConstKind::opt_def_id)
 - rust-lang/rust#162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - rust-lang/rust#162873 (Adjust `bug!`/`span_bug!` emission)
 - rust-lang/rust#162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - rust-lang/rust#162971 (libtest harness: avoid 'extern crate test' with custom runner)
 - rust-lang/rust#162981 (rustc-dev-guide subtree update)
 - rust-lang/rust#162985 (Error on invalid placements for unstable attributes)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 20, 2026
don't mark `f128` as reliable on AIX

In fact the type is really not supported at all there.

In rust-lang#162979 we made `f128` reliable on powerpc64 when the `vsx` feature is enabled. Apparently this is the case on AIX, but it just does not implement `f128` at all.

r? tgross35
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 20, 2026
don't mark `f128` as reliable on AIX

In fact the type is really not supported at all there.

In rust-lang#162979 we made `f128` reliable on powerpc64 when the `vsx` feature is enabled. Apparently this is the case on AIX, but it just does not implement `f128` at all.

r? tgross35
renovate-bot pushed a commit to renovate-bot/rust-lang-_-libc that referenced this pull request Sep 20, 2026
Skip AIX targets from CI tests while rust-lang/rust#162979 gets sorted
out.
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 20, 2026
Skip AIX targets from CI tests while rust-lang/rust#162979 gets sorted
out.
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Rollup merge of #163066 - folkertdev:f128-not-aix, r=beetrees

don't mark `f128` as reliable on AIX

In fact the type is really not supported at all there.

In #162979 we made `f128` reliable on powerpc64 when the `vsx` feature is enabled. Apparently this is the case on AIX, but it just does not implement `f128` at all.

r? tgross35
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 21, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#163001 (Temporarily disable `test-x86_64-fuchsia`)
 - rust-lang/rust#162880 (Mini optimization in `rustc_hir_typeck::upvar::restrict_precision_for_drop_types`)
 - rust-lang/rust#161424 (implement `VaArgSafe` for `f128`)
 - rust-lang/rust#161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - rust-lang/rust#162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - rust-lang/rust#162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - rust-lang/rust#162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - rust-lang/rust#162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - rust-lang/rust#162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - rust-lang/rust#162924 (Remove applying inline attributes at the callsite)
 - rust-lang/rust#162940 (Use spawned `SBDebugger` instance)
 - rust-lang/rust#162950 (More AST lowering cleanups)
 - rust-lang/rust#162964 (Update `browser-ui-test` version to `0.25.2`)
 - rust-lang/rust#162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - rust-lang/rust#161743 (Add performance notes for the floating-point round method)
 - rust-lang/rust#162797 (yeet AliasConstKind::opt_def_id)
 - rust-lang/rust#162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - rust-lang/rust#162873 (Adjust `bug!`/`span_bug!` emission)
 - rust-lang/rust#162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - rust-lang/rust#162971 (libtest harness: avoid 'extern crate test' with custom runner)
 - rust-lang/rust#162981 (rustc-dev-guide subtree update)
 - rust-lang/rust#162985 (Error on invalid placements for unstable attributes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` O-PowerPC Target: PowerPC processors S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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