[PATCH] D151284: [RISCV] Custom lower FP_TO_FP16 and FP16_TO_FP to correct ABI of of libcall

Jun Sha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 19:48:57 PDT 2023


joshua-arch1 added a comment.
Herald added a subscriber: sunshaoce.

It seems that the return value is still passed in GPR instead of FPR when lowered to a libcall to  __truncdfhf2 (double) without D support.

  define void @test_fptrunc_double(double %d, ptr %p) nounwind {
    %a = fptrunc double %d to half
    store half %a, ptr %p
    ret void
  }

llc a.ll  -mtriple=riscv32 -mattr +f -target-abi ilp32f

  addi    sp, sp, -16
  sw    ra, 12(sp) 
  sw    s0, 8(sp) 
  mv    s0, a2
  call    __truncdfhf2 at plt
  sh    a0, 0(s0)
  lw    ra, 12(sp) 
  lw    s0, 8(sp)
  addi    sp, sp, 16
  ret


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151284/new/

https://reviews.llvm.org/D151284



More information about the llvm-commits mailing list