Skip to content

LLVM 20 produces different assembly for rust/tests/assembly/riscv-soft-abi-with-float-features.rs #132139

Closed
@krasimirgg

Description

@krasimirgg
Contributor

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

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 25, 2024
krasimirgg

krasimirgg commented on Oct 25, 2024

@krasimirgg
ContributorAuthor

@rustbot label: A-LLVM

added
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
on Oct 25, 2024
jieyouxu

jieyouxu commented on Oct 25, 2024

@jieyouxu
Member

cc @beetrees @workingjubilee as you may know more about the intended behavior

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 25, 2024
changed the title [-]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[/+] on Oct 25, 2024
hanna-kruppe

hanna-kruppe commented on Oct 25, 2024

@hanna-kruppe
Contributor

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” load lw).

beetrees

beetrees commented on Oct 25, 2024

@beetrees
Contributor

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."

added
C-discussionCategory: Discussion or questions that doesn't represent real issues.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-discussionCategory: Discussion or questions that doesn't represent real issues.O-riscvTarget: RISC-V architectureT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @hanna-kruppe@krasimirgg@jieyouxu@rustbot@beetrees

      Issue actions

        LLVM 20 produces different assembly for rust/tests/assembly/riscv-soft-abi-with-float-features.rs · Issue #132139 · rust-lang/rust