[all-commits] [llvm/llvm-project] 98c90a: ISel: introduce vector ISD::LRINT, ISD::LLRINT; cu...

Ramkumar Ramachandra via All-commits all-commits at lists.llvm.org
Thu Oct 19 05:05:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 98c90a13c6b27768315eaecc92f036f75195eff4
      https://github.com/llvm/llvm-project/commit/98c90a13c6b27768315eaecc92f036f75195eff4
  Author: Ramkumar Ramachandra <Ramkumar.Ramachandra at imgtec.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/CodeGen/TargetLoweringBase.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/RISCV/fround.ll
    A llvm/test/CodeGen/AArch64/vector-llrint.ll
    A llvm/test/CodeGen/AArch64/vector-lrint.ll
    A llvm/test/CodeGen/PowerPC/vector-llrint.ll
    A llvm/test/CodeGen/PowerPC/vector-lrint.ll
    A llvm/test/CodeGen/RISCV/rvv/llrint-sdnode.ll
    A llvm/test/CodeGen/RISCV/rvv/lrint-sdnode.ll
    A llvm/test/CodeGen/X86/vector-llrint.ll
    A llvm/test/CodeGen/X86/vector-lrint.ll

  Log Message:
  -----------
  ISel: introduce vector ISD::LRINT, ISD::LLRINT; custom RISCV lowering (#66924)

The issue #55208 noticed that std::rint is vectorized by the
SLPVectorizer, but a very similar function, std::lrint, is not.
std::lrint corresponds to ISD::LRINT in the SelectionDAG, and
std::llrint is a familiar cousin corresponding to ISD::LLRINT. Now,
neither ISD::LRINT nor ISD::LLRINT have a corresponding vector variant,
and the LangRef makes this clear in the documentation of llvm.lrint.*
and llvm.llrint.*.

This patch extends the LangRef to include vector variants of
llvm.lrint.* and llvm.llrint.*, and lays the necessary ground-work of
scalarizing it for all targets. However, this patch would be devoid of
motivation unless we show the utility of these new vector variants.
Hence, the RISCV target has been chosen to implement a custom lowering
to the vfcvt.x.f.v instruction. The patch also includes a CostModel for
RISCV, and a trivial follow-up can potentially enable the SLPVectorizer
to vectorize std::lrint and std::llrint, fixing #55208.

The patch includes tests, obviously for the RISCV target, but also for
the X86, AArch64, and PowerPC targets to justify the addition of the
vector variants to the LangRef.




More information about the All-commits mailing list