Skip to content

Commit 64d2c1c

Browse files
toppercmemfrob
authored andcommitted
[RISCV] Remove floating point condition code legalization from lowerFixedLengthVectorSetccToRVV.
After D98939, this is done by LegalizeVectorOps making this code dead. Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D99519
1 parent e15789d commit 64d2c1c

File tree

1 file changed

+2
-80
lines changed

1 file changed

+2
-80
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,89 +3459,11 @@ RISCVTargetLowering::lowerFixedLengthVectorSetccToRVV(SDValue Op,
34593459
SDValue VL =
34603460
DAG.getConstant(VT.getVectorNumElements(), DL, Subtarget.getXLenVT());
34613461

3462-
ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand(2))->get();
3463-
3464-
bool Invert = false;
3465-
Optional<unsigned> LogicOpc;
3466-
if (ContainerVT.isFloatingPoint()) {
3467-
bool Swap = false;
3468-
switch (CC) {
3469-
default:
3470-
break;
3471-
case ISD::SETULE:
3472-
case ISD::SETULT:
3473-
Swap = true;
3474-
LLVM_FALLTHROUGH;
3475-
case ISD::SETUGE:
3476-
case ISD::SETUGT:
3477-
CC = getSetCCInverse(CC, ContainerVT);
3478-
Invert = true;
3479-
break;
3480-
case ISD::SETOGE:
3481-
case ISD::SETOGT:
3482-
case ISD::SETGE:
3483-
case ISD::SETGT:
3484-
Swap = true;
3485-
break;
3486-
case ISD::SETUEQ:
3487-
// Use !((OLT Op1, Op2) || (OLT Op2, Op1))
3488-
Invert = true;
3489-
LogicOpc = RISCVISD::VMOR_VL;
3490-
CC = ISD::SETOLT;
3491-
break;
3492-
case ISD::SETONE:
3493-
// Use ((OLT Op1, Op2) || (OLT Op2, Op1))
3494-
LogicOpc = RISCVISD::VMOR_VL;
3495-
CC = ISD::SETOLT;
3496-
break;
3497-
case ISD::SETO:
3498-
// Use (OEQ Op1, Op1) && (OEQ Op2, Op2)
3499-
LogicOpc = RISCVISD::VMAND_VL;
3500-
CC = ISD::SETOEQ;
3501-
break;
3502-
case ISD::SETUO:
3503-
// Use (UNE Op1, Op1) || (UNE Op2, Op2)
3504-
LogicOpc = RISCVISD::VMOR_VL;
3505-
CC = ISD::SETUNE;
3506-
break;
3507-
}
3508-
3509-
if (Swap) {
3510-
CC = getSetCCSwappedOperands(CC);
3511-
std::swap(Op1, Op2);
3512-
}
3513-
}
3514-
35153462
MVT MaskVT = MVT::getVectorVT(MVT::i1, ContainerVT.getVectorElementCount());
35163463
SDValue Mask = DAG.getNode(RISCVISD::VMSET_VL, DL, MaskVT, VL);
35173464

3518-
// There are 3 cases we need to emit.
3519-
// 1. For (OEQ Op1, Op1) && (OEQ Op2, Op2) or (UNE Op1, Op1) || (UNE Op2, Op2)
3520-
// we need to compare each operand with itself.
3521-
// 2. For (OLT Op1, Op2) || (OLT Op2, Op1) we need to compare Op1 and Op2 in
3522-
// both orders.
3523-
// 3. For any other case we just need one compare with Op1 and Op2.
3524-
SDValue Cmp;
3525-
if (LogicOpc && (CC == ISD::SETOEQ || CC == ISD::SETUNE)) {
3526-
Cmp = DAG.getNode(RISCVISD::SETCC_VL, DL, MaskVT, Op1, Op1,
3527-
DAG.getCondCode(CC), Mask, VL);
3528-
SDValue Cmp2 = DAG.getNode(RISCVISD::SETCC_VL, DL, MaskVT, Op2, Op2,
3529-
DAG.getCondCode(CC), Mask, VL);
3530-
Cmp = DAG.getNode(*LogicOpc, DL, MaskVT, Cmp, Cmp2, VL);
3531-
} else {
3532-
Cmp = DAG.getNode(RISCVISD::SETCC_VL, DL, MaskVT, Op1, Op2,
3533-
DAG.getCondCode(CC), Mask, VL);
3534-
if (LogicOpc) {
3535-
SDValue Cmp2 = DAG.getNode(RISCVISD::SETCC_VL, DL, MaskVT, Op2, Op1,
3536-
DAG.getCondCode(CC), Mask, VL);
3537-
Cmp = DAG.getNode(*LogicOpc, DL, MaskVT, Cmp, Cmp2, VL);
3538-
}
3539-
}
3540-
3541-
if (Invert) {
3542-
SDValue AllOnes = DAG.getNode(RISCVISD::VMSET_VL, DL, MaskVT, VL);
3543-
Cmp = DAG.getNode(RISCVISD::VMXOR_VL, DL, MaskVT, Cmp, AllOnes, VL);
3544-
}
3465+
SDValue Cmp = DAG.getNode(RISCVISD::SETCC_VL, DL, MaskVT, Op1, Op2,
3466+
Op.getOperand(2), Mask, VL);
35453467

35463468
return convertFromScalableVector(VT, Cmp, DAG, Subtarget);
35473469
}

0 commit comments

Comments
 (0)