[all-commits] [llvm/llvm-project] 12d51f: [RISCV] Implement lround*/llround*/lrint*/llrint* ...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Jul 6 11:45:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12d51f95fe7fe8d4aec234c2b842478f75154273
      https://github.com/llvm/llvm-project/commit/12d51f95fe7fe8d4aec234c2b842478f75154273
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-07-06 (Tue, 06 Jul 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfoD.td
    M llvm/lib/Target/RISCV/RISCVInstrInfoF.td
    M llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td
    M llvm/test/CodeGen/RISCV/double-intrinsics.ll
    M llvm/test/CodeGen/RISCV/float-intrinsics.ll
    M llvm/test/CodeGen/RISCV/half-intrinsics.ll

  Log Message:
  -----------
  [RISCV] Implement lround*/llround*/lrint*/llrint* with fcvt instruction with -fno-math-errno

These are fp->int conversions using either RMM or dynamic rounding modes.

The lround and lrint opcodes have a return type of either i32 or
i64 depending on sizeof(long) in the frontend which should follow
xlen. llround/llrint should always return i64 so we'll need a libcall
for those on rv32.

The frontend will only emit the intrinsics if -fno-math-errno is in
effect otherwise a libcall will be emitted which will not use
these ISD opcodes.

gcc also does this optimization.

Reviewed By: arcbbb

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




More information about the All-commits mailing list