https://bugs.llvm.org/show_bug.cgi?id=46317

            Bug ID: 46317
           Summary: [RV64] Wrong libcall emitted
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: RISC-V
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

consider below testcase for problem overview.

$cat test.c

int foo(double x){
    return x;
}


$clang -O2 -target riscv64 -march=rv64imac -mabi=lp64 test.c -S

$cat test.s

foo(double): # @foo(double)
  addi sp, sp, -16
  sd ra, 8(sp)
  call __fixdfdi // this is incorrect.
  ld ra, 8(sp)
  addi sp, sp, 16
  ret

while libcall emitted by gcc looks right.

$riscv64-gcc -O2 -march=rv64imac -mabi=lp64 -S test.c

$cat test.s
foo(double):
        addi    sp,sp,-16
        sd      ra,8(sp)
        call    __fixdfsi  // This is correct.
        ld      ra,8(sp)
        sext.w  a0,a0
        addi    sp,sp,16
        jr      ra


as it can be observed clang emitted wrong lib call?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to