Skip to content

Commit

Permalink
[SelectionDAG] Support more VP reduction mask operation.
Browse files Browse the repository at this point in the history
This patch uses VP_REDUCE_AND and VP_REDUCE_OR to replace VP_REDUCE_SMAX,VP_REDUCE_SMIN,VP_REDUCE_UMAX and VP_REDUCE_UMIN for mask vector type.

Differential Revision: https://reviews.llvm.org/D125002
  • Loading branch information
jacquesguan authored and jacquesguan committed May 17, 2022
1 parent 05ad4d4 commit 26593e7
Show file tree
Hide file tree
Showing 3 changed files with 995 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Expand Up @@ -8865,6 +8865,20 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
if (VT == MVT::i1)
Opcode = ISD::VP_REDUCE_XOR;
break;
case ISD::VP_REDUCE_SMAX:
case ISD::VP_REDUCE_UMIN:
// If it is VP_REDUCE_SMAX/VP_REDUCE_UMIN mask operation then turn it to
// VP_REDUCE_AND.
if (VT == MVT::i1)
Opcode = ISD::VP_REDUCE_AND;
break;
case ISD::VP_REDUCE_SMIN:
case ISD::VP_REDUCE_UMAX:
// If it is VP_REDUCE_SMIN/VP_REDUCE_UMAX mask operation then turn it to
// VP_REDUCE_OR.
if (VT == MVT::i1)
Opcode = ISD::VP_REDUCE_OR;
break;
}

// Memoize nodes.
Expand Down

0 comments on commit 26593e7

Please sign in to comment.