x86: Correctly pass larger structs/types in registers with -Zregparm by sulix · Pull Request #147628 · rust-lang/rust
rustbot
added
S-waiting-on-review
labels
Oct 13, 2025
sulix
mentioned this pull request
This was referenced
Oct 13, 2025
rustbot
added
S-waiting-on-author
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Oct 13, 2025The -Zregparm option for 32-bit x86 modifies the calling convention to pass a number of arguments in registers instead of on the stack. (This is primarily used by the Linux kernel.) Currently, rustc will only pass integers of size <= 32 bits in registers, but gcc (and clang) will pass larger integers (e.g., 64-bit integers) across two registers if possible. This is not the case with fastcall/vectorcall. Note that gcc/clang with -mregparm will also pass some structs in registers: this patch does not attempt to fix that case.
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