rust/tests/assembly
bors a2a1206811 Auto merge of #131211 - bjorn3:rust_abi_follow_c_rules, r=nikic,jieyouxu
Return values larger than 2 registers using a return area pointer

LLVM and Cranelift disagree about how to return values that don't fit in the registers designated for return values. LLVM will force the entire return value to be passed by return area pointer, while Cranelift will look at each IR level return value independently and decide to pass it in a register or not, which would result in the return value being passed partially in registers and partially through a return area pointer.

While Cranelift may need to be fixed as the LLVM behavior is generally more correct with respect to the surface language, forcing this behavior in rustc itself makes it easier for other backends to conform to the Rust ABI and for the C ABI rustc already handles this behavior anyway.

In addition LLVM's decision to pass the return value in registers or using a return area pointer depends on how exactly the return type is lowered to an LLVM IR type. For example `Option<u128>` can be lowered as `{ i128, i128 }` in which case the x86_64 backend would use a return area pointer, or it could be passed as `{ i32, i128 }` in which case the x86_64 backend would pass it in registers by taking advantage of an LLVM ABI extension that allows using 3 registers for the x86_64 sysv call conv rather than the officially specified 2 registers.

This adjustment is only necessary for the Rust ABI as for other ABI's the calling convention implementations in rustc_target already ensure any return value which doesn't fit in the available amount of return registers is passed in the right way for the current target.

Helps with https://github.com/rust-lang/rustc_codegen_cranelift/issues/1525
cc https://github.com/bytecodealliance/wasmtime/issues/9250
2024-10-19 14:21:46 +00:00
..
asm Ban non-array SIMD 2024-09-09 19:39:43 -07:00
auxiliary Move /src/test to /tests 2023-01-11 09:32:08 +00:00
libs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-kernel-abi NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
simd Ignore reduce-fadd-unordered on SGX platform 2024-09-16 16:54:48 +02:00
stack-protector Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
targets Add assembly tests to satisfy 'tidy' 2024-10-05 12:14:35 +03:00
aarch64-naked-fn-no-bti-prolog.rs more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
aarch64-pointer-auth.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
align_offset.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
asm-comments.rs Always preserve user-written comments in assembly 2024-07-02 21:41:59 -04:00
closure-inherit-target-feature.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
cmse.rs Improve assembly test for CMSE ABIs 2024-09-23 18:57:38 +02:00
dwarf4.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dwarf5.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
is_aligned.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
issue-83585-small-pod-struct-equality.rs Fix tests for 32 bits targets 2024-06-11 07:45:16 +00:00
manual-eq-efficient.rs Add test for efficient codegen of manual eq implementations of a small struct 2024-04-30 13:21:08 +00:00
niche-prefer-zero.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-default.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-emit-asm.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-link-arg.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-target-cpu.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-atomics.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-c-abi-arg-v7.rs NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
nvptx-c-abi-ret-v7.rs NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
nvptx-internalizing.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-binary.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-cdylib.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-safe-naming.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
panic-no-unwind-no-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
panic-unwind-no-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pic-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
pie-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
powerpc64-struct-abi.rs add aix aggregate test 2024-10-07 20:40:55 -04:00
s390x-backchain-toggle.rs tests: add an assembly scanning test for s390x backchain switch 2024-09-04 08:10:53 -06:00
simd-bitmask.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-gather.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-mask-load.rs Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
simd-intrinsic-mask-reduce.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-mask-store.rs Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
simd-intrinsic-scatter.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-select.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
slice-is_ascii.rs Ignore less tests in debug builds 2024-02-23 18:04:01 -05:00
small_data_threshold.rs small_data_threshold.rs: Adapt to LLVM head changes 2024-09-12 09:53:59 +02:00
sparc-struct-abi.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
stack-probes.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
static-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
strict_provenance.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
target-feature-multiple.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
wasm_exceptions.rs Fix wasm_exceptions test 2024-06-19 21:26:48 +01:00
x86_64-array-pair-load-store-merge.rs Make more of the test suite run on Mac Catalyst 2024-05-28 12:31:33 +02:00
x86_64-cmp.rs llvm 20: adapt integer comparison tests 2024-08-22 13:23:00 +00:00
x86_64-floating-point-clamp.rs Add inline comments why we're forcing the target cpu 2024-05-01 16:54:20 -07:00
x86_64-fortanix-unknown-sgx-lvi-generic-load.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-function-return.rs Make more of the test suite run on Mac Catalyst 2024-05-28 12:31:33 +02:00
x86_64-naked-fn-no-cet-prolog.rs more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
x86_64-no-jump-tables.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-sse_crc.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-typed-swap.rs Avoid non-windows non-linux in assembly x64 test 2024-03-23 00:02:53 -07:00
x86_64-windows-float-abi.rs Match LLVM ABI in extern "C" functions for f128 on Windows 2024-07-30 20:23:33 +01:00
x86-return-float.rs Fix test expectations for 32bit x86 2024-10-19 13:09:21 +00:00