[all-commits] [llvm/llvm-project] 5adb09: [LoongArch] Fix codegen for [su]itofp instructions

wanglei via All-commits all-commits at lists.llvm.org
Wed Nov 2 20:41:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5adb090795914a4122492117f3af8dacaf69301f
      https://github.com/llvm/llvm-project/commit/5adb090795914a4122492117f3af8dacaf69301f
  Author: wanglei <wanglei at loongson.cn>
  Date:   2022-11-03 (Thu, 03 Nov 2022)

  Changed paths:
    M llvm/lib/Target/LoongArch/LoongArchFloat32InstrInfo.td
    M llvm/lib/Target/LoongArch/LoongArchFloat64InstrInfo.td
    M llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.h
    M llvm/test/CodeGen/LoongArch/ir-instruction/double-convert.ll
    M llvm/test/CodeGen/LoongArch/ir-instruction/float-convert.ll

  Log Message:
  -----------
  [LoongArch] Fix codegen for [su]itofp instructions

This patch fixes codegen for `[su]itofp` instructions.

In LoongArch, a legal int-to-float conversion is done in two steps:

1. Move the data from `GPR` to `FPR`. (FRLen >= GRLen)
2. Conversion in `FPR`. (the data in `FPR` is treated as a signed value)

Based on the above features, when the type's BitWidth meets the
requirements, all `SINT_TO_FP` are legal, all `UINT_TO_FP` are expand
and lowered to libcall when appropriate.
The only special case is, LoongArch64 with `+f,-d` features. At this
point, custom processing is required for `[SU]INT_TO_FP`. Of course, we
can also ignore it and use libcall directly.

Differential Revision: https://reviews.llvm.org/D136916




More information about the All-commits mailing list