Skip to content

Commit

Permalink
[X86] Support EVT types in supportedVectorShift* helpers. NFCI.
Browse files Browse the repository at this point in the history
Move the isSimple() check inside the helpers to avoid a lot of extra checking in a future patch.
  • Loading branch information
RKSimon committed Apr 24, 2023
1 parent 3e3e41b commit 73499ca
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30831,8 +30831,11 @@ SDValue X86TargetLowering::LowerWin64_INT128_TO_FP(SDValue Op,

// Return true if the required (according to Opcode) shift-imm form is natively
// supported by the Subtarget
static bool supportedVectorShiftWithImm(MVT VT, const X86Subtarget &Subtarget,
static bool supportedVectorShiftWithImm(EVT VT, const X86Subtarget &Subtarget,
unsigned Opcode) {
if (!VT.isSimple())
return false;

if (!(VT.is128BitVector() || VT.is256BitVector() || VT.is512BitVector()))
return false;

Expand All @@ -30854,15 +30857,18 @@ static bool supportedVectorShiftWithImm(MVT VT, const X86Subtarget &Subtarget,
// The shift amount is a variable, but it is the same for all vector lanes.
// These instructions are defined together with shift-immediate.
static
bool supportedVectorShiftWithBaseAmnt(MVT VT, const X86Subtarget &Subtarget,
bool supportedVectorShiftWithBaseAmnt(EVT VT, const X86Subtarget &Subtarget,
unsigned Opcode) {
return supportedVectorShiftWithImm(VT, Subtarget, Opcode);
}

// Return true if the required (according to Opcode) variable-shift form is
// natively supported by the Subtarget
static bool supportedVectorVarShift(MVT VT, const X86Subtarget &Subtarget,
static bool supportedVectorVarShift(EVT VT, const X86Subtarget &Subtarget,
unsigned Opcode) {
if (!VT.isSimple())
return false;

if (!(VT.is128BitVector() || VT.is256BitVector() || VT.is512BitVector()))
return false;

Expand Down Expand Up @@ -49719,7 +49725,7 @@ static SDValue combineAndMaskToShift(SDNode *N, SelectionDAG &DAG,
// If the bitcasts can't be eliminated, then it is unlikely that this fold
// will be profitable.
if (N->getValueType(0) == VT &&
supportedVectorShiftWithImm(VT.getSimpleVT(), Subtarget, ISD::SRA)) {
supportedVectorShiftWithImm(VT, Subtarget, ISD::SRA)) {
SDValue X, Y;
if (Op1.getOpcode() == X86ISD::PCMPGT &&
isAllOnesOrAllOnesSplat(Op1.getOperand(1)) && Op1.hasOneUse()) {
Expand Down Expand Up @@ -49748,7 +49754,7 @@ static SDValue combineAndMaskToShift(SDNode *N, SelectionDAG &DAG,
if (isBitwiseNot(Op0))
return SDValue();

if (!supportedVectorShiftWithImm(VT.getSimpleVT(), Subtarget, ISD::SRL))
if (!supportedVectorShiftWithImm(VT, Subtarget, ISD::SRL))
return SDValue();

unsigned EltBitWidth = VT.getScalarSizeInBits();
Expand Down

0 comments on commit 73499ca

Please sign in to comment.