[all-commits] [llvm/llvm-project] 8c51ac: [RISCV][GISEL] Legalize G_SELECT for scalable vectors

Michael Maitland via All-commits all-commits at lists.llvm.org
Mon Mar 25 10:35:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c51ac9ddb026ca247b25b08b1d08e32b1ed58ec
      https://github.com/llvm/llvm-project/commit/8c51ac9ddb026ca247b25b08b1d08e32b1ed58ec
  Author: Michael Maitland <michaeltmaitland at gmail.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
    A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rvv/legalize-select.mir

  Log Message:
  -----------
  [RISCV][GISEL] Legalize G_SELECT for scalable vectors


  Commit: 973e9dbd57bcdfcc3e0deef37d1c37fc4fbbb856
      https://github.com/llvm/llvm-project/commit/973e9dbd57bcdfcc3e0deef37d1c37fc4fbbb856
  Author: Michael Maitland <michaeltmaitland at gmail.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
    A llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/rvv/select.mir

  Log Message:
  -----------
  [RISCV][GISEL] Regbank select for scalable G_SELECT


  Commit: 05840c8714d798c8f2873c205aeac146b4993ae5
      https://github.com/llvm/llvm-project/commit/05840c8714d798c8f2873c205aeac146b4993ae5
  Author: Michael Maitland <michaeltmaitland at gmail.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    M llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
    A llvm/test/CodeGen/RISCV/GlobalISel/instruction-select/rvv/select.mir

  Log Message:
  -----------
  [RISCV][GISEL] Instruction select for scalable G_SELECT

SelectionDAG has SELECT and VSELECT

SELECT restricts the condition operand to an i1 and the true and false operands
can be vectors. The result of a SELECT has the same type as the true and
false operands.

VSELECT has a vector condition operand and the true and false operands
must be vectors. The result of a VSELECT has a vector result.

GlobalISel has G_SELECT which has condition operand that is an i1 if the
true and false operands are scalar and a vector type with i1 elements if
the true and false operands are vector.

A G_SELECT acts like a ISD::SELECT when the operands are all scalar, and
an ISD::VSELECT when the operands are are scalar. A G_SELECT cannot act
like a ISD::SELECT with an i1 condition and vector operands because the
type system.

In this patch, we would like to take advantage of the patterns written
for SELECT and VSELECT, so we mark G_SELECT equivalent to both SELECT
and VSELECT to reuse the patterns. Since we cannot write a `G_SELECT (s1),
(vector-ty), (vector-ty)`, we don't have to worry about accidently
matching the SDAG patterns of that nature.

We will probably need a way to represent an i1 condition with vector
true and false operands in the future. That can be the topic of another
patch.


Compare: https://github.com/llvm/llvm-project/compare/d179176f3e35...05840c8714d7

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list