rust/tests
León Orell Valerian Liehr 16152661ff
Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3
Apply ABI attributes on return types in `rustc_codegen_cranelift`

- The [x86-64 System V ABI standard](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build) doesn't sign/zero-extend integer arguments or return types.
- But the de-facto standard as implemented by Clang and GCC is to sign/zero-extend arguments to 32 bits (but not return types).
- Additionally, Apple targets [sign/zero-extend both arguments and return values to 32 bits](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms#Pass-arguments-to-functions-correctly).
- However, the `rustc_target` ABI adjustment code currently [unconditionally extends both arguments and return values to 32 bits](https://github.com/rust-lang/rust/blame/e703dff8fe220b78195c53478e83fb2f68d8499c/compiler/rustc_target/src/callconv/x86_64.rs#L240) on all targets.
- This doesn't cause a miscompilation when compiling with LLVM as LLVM will ignore the `signext`/`zeroext` attribute when applied to return types on non-Apple x86-64 targets.
- Cranelift, however, does not have a similar special case, requiring `rustc` to set the argument extension attribute correctly.
- However, `rustc_codegen_cranelift` doesn't currently apply ABI attributes to return types at all, meaning `rustc_codegen_cranelift` will currently miscompile `i8`/`u8`/`i16`/`u16` returns on x86-64 Apple targets as those targets require sign/zero-extension of return types.

This PR fixes the bug(s) by making the `rustc_target` x86-64 System V ABI only mark return types as sign/zero-extended on Apple platforms, while also making `rustc_codegen_cranelift` apply ABI attributes to return types. The RISC-V and s390x C ABIs also require sign/zero extension of return types, so this will fix those targets when building with `rustc_codegen_cranelift` too.

r? `````@bjorn3`````
2025-06-15 23:51:56 +02:00
..
assembly Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3 2025-06-15 23:51:56 +02:00
auxiliary
codegen Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3 2025-06-15 23:51:56 +02:00
codegen-units Remove mono item collection strategy override from -Zprint-mono-items 2025-05-09 12:19:09 +02:00
coverage coverage: Revert "unused local file IDs" due to empty function names 2025-05-27 23:33:29 +10:00
coverage-run-rustdoc
crashes Rollup merge of #142347 - azhogin:azhogin/async-drop-storage-live-dead-fix, r=oli-obk 2025-06-15 23:51:56 +02:00
debuginfo tests: Change "fastcall" to "system" in some tests 2025-06-09 16:10:21 -07:00
incremental tests: Change "fastcall" to "system" in some tests 2025-06-09 16:10:21 -07:00
mir-opt Rollup merge of #142347 - azhogin:azhogin/async-drop-storage-live-dead-fix, r=oli-obk 2025-06-15 23:51:56 +02:00
pretty Rollup merge of #134847 - dtolnay:asymmetrical, r=fmease 2025-06-13 05:16:54 +02:00
run-make Rollup merge of #142297 - jieyouxu:needs-target-std, r=Kobzol 2025-06-11 13:48:11 +02:00
rustdoc Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr 2025-06-13 17:44:15 +00:00
rustdoc-gui Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=GuillaumeGomez 2025-05-25 04:00:55 +02:00
rustdoc-js yeet CanonicalVarInfo 2025-05-23 12:10:53 +00:00
rustdoc-js-std Consistent trait bounds for ExtractIf Debug impls 2025-05-05 19:46:46 -07:00
rustdoc-json rustdoc-json: Rearrange deck chairs in ABI testing 2025-06-09 16:11:06 -07:00
rustdoc-ui Add new extracted option doctest ui test for result returning doctest 2025-06-10 13:54:47 +02:00
ui Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3 2025-06-15 23:51:56 +02:00
ui-fulldeps Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=workingjubilee,saethlin 2025-06-15 23:51:54 +02:00
COMPILER_TESTS.md