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
libs
nvptx-kernel-abi
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
align_offset.rs
asm-comments.rs
closure-inherit-target-feature.rs
cmse.rs Improve assembly test for CMSE ABIs 2024-09-23 18:57:38 +02:00
dwarf4.rs
dwarf5.rs
is_aligned.rs
issue-83585-small-pod-struct-equality.rs
manual-eq-efficient.rs
niche-prefer-zero.rs
nvptx-arch-default.rs
nvptx-arch-emit-asm.rs
nvptx-arch-link-arg.rs
nvptx-arch-target-cpu.rs
nvptx-atomics.rs
nvptx-c-abi-arg-v7.rs
nvptx-c-abi-ret-v7.rs
nvptx-internalizing.rs
nvptx-linking-binary.rs
nvptx-linking-cdylib.rs
nvptx-safe-naming.rs
panic-no-unwind-no-uwtable.rs
panic-unwind-no-uwtable.rs
pic-relocation-model.rs
pie-relocation-model.rs
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
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
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
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
stack-probes.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
static-relocation-model.rs
strict_provenance.rs
target-feature-multiple.rs
wasm_exceptions.rs
x86_64-array-pair-load-store-merge.rs
x86_64-cmp.rs llvm 20: adapt integer comparison tests 2024-08-22 13:23:00 +00:00
x86_64-floating-point-clamp.rs
x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs
x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs
x86_64-function-return.rs
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
x86_64-sse_crc.rs
x86_64-typed-swap.rs
x86_64-windows-float-abi.rs
x86-return-float.rs Fix test expectations for 32bit x86 2024-10-19 13:09:21 +00:00