Closed
Description
After #131807, we're seeing some test failures in our experimental rust + LLVM-at-HEAD build bot:
It seems that here the new assembly is just lw a0, 0(a0)
; not sure if that's OK.
After #131807, we're seeing some test failures in our experimental rust + LLVM-at-HEAD build bot:
It seems that here the new assembly is just lw a0, 0(a0)
; not sure if that's OK.
Activity
krasimirgg commentedon Oct 25, 2024
@rustbot label: A-LLVM
jieyouxu commentedon Oct 25, 2024
cc @beetrees @workingjubilee as you may know more about the intended behavior
[-]LLVM 20 produces different assembly for rust/tests/assembly /riscv-soft-abi-with-float-features.rs[/-][+]LLVM 20 produces different assembly for rust/tests/assembly/riscv-soft-abi-with-float-features.rs[/+]hanna-kruppe commentedon Oct 25, 2024
The change seems correct to me. It loads from the same location as before and puts the same bits in the return value register for the soft float ABI. Both variants just load 32 bits from memory into the low half of a0 (all of the involved instructions preserve non-canonical NaNs) and sign-extend to fill the upper 32 bits of a0 (previously in the
fmv.x.w
step, now it’s part of the “integer” loadlw
).beetrees commentedon Oct 25, 2024
The change is correct; the soft-float ABI for RISC-V states "Scalars that are at most XLEN bits wide are passed in a single argument register, or on the stack by value if none is available. [..] When passed in registers or on the stack, floating-point types narrower than XLEN bits are widened to XLEN bits, with the upper bits undefined."