[all-commits] [llvm/llvm-project] d4ee84: [RISCV] Support FP_TO_S/UINT_SAT for i32 and i64.

Craig Topper via All-commits all-commits at lists.llvm.org
Sat Aug 7 16:06:22 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4ee84ceee454c15e963a5da6f5e1d89121594c9
      https://github.com/llvm/llvm-project/commit/d4ee84ceee454c15e963a5da6f5e1d89121594c9
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-08-07 (Sat, 07 Aug 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    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-convert.ll
    M llvm/test/CodeGen/RISCV/float-convert.ll
    M llvm/test/CodeGen/RISCV/half-convert.ll

  Log Message:
  -----------
  [RISCV] Support FP_TO_S/UINT_SAT for i32 and i64.

The fcvt fp to integer instructions saturate if their input is
infinity or out of range, but the instructions produce a maximum
integer for nan instead of 0 required for the ISD opcodes.

This means we can use the instructions to do the saturating
conversion, but we'll need to fix up the nan case at the end.

We can probably improve the i8 and i16 default codegen as well,
but I'll leave that for a follow up.

Reviewed By: luismarques

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




More information about the All-commits mailing list