Skip to content

add c-variadic support for x87_f80 - #166510

Merged
rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
folkertdev:x87_f80-c-variadic
Nov 27, 2026
Merged

rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
folkertdev:x87_f80-c-variadic

Conversation

@folkertdev

@folkertdev folkertdev commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

tracking issue: #163982

The default paths already have the right behavior. Validated with abi-cafe.

@folkertdev folkertdev added F-c_variadic `#![feature(c_variadic)]` F-c_longdouble `#![feature(c_longdouble)]` labels Nov 24, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 24, 2026
Comment on lines +254 to +256
// X86_64-NEXT: mov rcx, qword ptr [rax]
// X86_64-NEXT: movzx edx, byte ptr [rax + 8]
// X86_64-NEXT: movzx eax, byte ptr [rax + 9]

@folkertdev folkertdev Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a 10-byte load which is worse assembly than a x87_fp80 load. Totally acceptable, certainly for now.

View changes since the review

@folkertdev

Copy link
Copy Markdown
Contributor Author

r? beetrees

@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

beetrees is currently at their maximum review capacity.
They may take a while to respond.

@folkertdev
folkertdev marked this pull request as ready for review November 24, 2026 19:11
@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 Nov 24, 2026

@beetrees beetrees left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR currently results in llvm_type being called on a Rust aggregate (x87_f80) and then the resulting LLVM aggregate being loaded, both of which should be avoided. One solution that would work in this particular case is to substitute cx.type_x87_f80() when layout.is_x87_f80() and let the llvm_value_to_intrinsicresult call at the bottom of codegen_rustc_intrinsic_call store it to the result place. This would work in this particular scenario (and would be fine for this PR), but won't work for other BackendRepr::Memory aggregates like Complex<x87_f80> that can't be represented as a LLVM primitive. The more long-term solution would be to pass result_place to emit_va_arg and directly memcpy the result into it.

Could you also add an codegen-llvm test for the IR emitted by next_arg::<x87_f80>()? Since this is the first Rust aggregate type to have va_arg support it would be good to have a test for what LLVM IR we emit.

View changes since this review

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2026
@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

This comment has been minimized.

@folkertdev folkertdev left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@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 Nov 24, 2026
@folkertdev folkertdev mentioned this pull request Nov 25, 2026
1 of 9 tasks
Comment thread library/core/src/ffi/va_list.rs Resolved
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2026

@folkertdev folkertdev left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread library/core/src/ffi/va_list.rs Resolved
@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 Nov 26, 2026
@rust-log-analyzer

This comment has been minimized.

I guess things got renamed and there were some editing mishaps.
@rustbot

rustbot commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@beetrees beetrees left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One nit, then r=me.

View changes since this review

)
}

/// A helper for llvm_type that ensures we don't call it on non-primitive types.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// A helper for llvm_type that ensures we don't call it on non-primitive types.
/// A helper for backend_type that ensures we don't call it on non-primitive types.

To match the method.

@folkertdev

Copy link
Copy Markdown
Contributor Author

@bors r=beetrees

@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b19a65d has been tentatively approved by beetrees

It will be put into the queue for this repository once PR CI succeeds.

@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 Nov 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 27, 2026
…eetrees

add c-variadic support for `x87_f80`

tracking issue: rust-lang#163982

The default paths already have the right behavior. Validated with abi-cafe.
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163895 (Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope)
 - #163910 (debugger: stabilize trim-paths unremap file loading)
 - #166175 (Use `__fastfail()` for `crash()` on Windows)
 - #166377 (fix: ignore format literal source availability in stable hashes)
 - #166510 (add c-variadic support for `x87_f80`)
 - #166650 (Don't round the number of bits passed to `{Size,Align}::from_bits`)
 - #161531 (Remove `T: Send + Sync` bound from `Arc::downcast`)
 - #166641 (fix: bootstrap build directory handling with --set)
 - #166655 (Submodule update of rustc-perf)
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163895 (Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope)
 - #163910 (debugger: stabilize trim-paths unremap file loading)
 - #166377 (fix: ignore format literal source availability in stable hashes)
 - #166510 (add c-variadic support for `x87_f80`)
 - #166631 (Remove `fn terminator()` and `terminator_mut()`)
 - #166650 (Don't round the number of bits passed to `{Size,Align}::from_bits`)
 - #161531 (Remove `T: Send + Sync` bound from `Arc::downcast`)
 - #166641 (fix: bootstrap build directory handling with --set)
 - #166655 (Submodule update of rustc-perf)
@rust-bors
rust-bors Bot merged commit 36eb36b into rust-lang:main Nov 27, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #166510 - folkertdev:x87_f80-c-variadic, r=beetrees

add c-variadic support for `x87_f80`

tracking issue: #163982

The default paths already have the right behavior. Validated with abi-cafe.
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-c_longdouble `#![feature(c_longdouble)]` F-c_variadic `#![feature(c_variadic)]` 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants