[llvm-bugs] [Bug 46317] New: [RV64] Wrong libcall emitted

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 14 04:27:52 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: kamleshbhalui at gmail.com
                CC: asb at lowrisc.org, llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200614/768917b1/attachment.html>


More information about the llvm-bugs mailing list