llvm.org GIT mirror llvm / ad4e697
Fix using wrong result type for setcc. When reducing the bitwidth of a comparison against a constant, the original setcc's result type was used, which was incorrect. No test since I don't think any other in tree targets change the bitwidth of the setcc type depending on the bitwidth of the compared type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208236 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 6 years ago
3 changed file(s) with 21 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
555555 /// getZeroExtendInReg - Return the expression required to zero extend the Op
556556 /// value assuming it was the smaller SrcTy value.
557557 SDValue getZeroExtendInReg(SDValue Op, SDLoc DL, EVT SrcTy);
558
559 /// getBoolExtOrTrunc - Convert Op, which must be of integer type, to the
560 /// integer type VT, by using an extension appropriate for the target's
561 /// BooleanContent or truncating it.
562 SDValue getBoolExtOrTrunc(SDValue Op, SDLoc SL, EVT VT);
558563
559564 /// getNOT - Create a bitwise NOT operation as (XOR Val, -1).
560565 SDValue getNOT(SDLoc DL, SDValue Val, EVT VT);
960960 return VT.bitsGT(Op.getValueType()) ?
961961 getNode(ISD::ZERO_EXTEND, DL, VT, Op) :
962962 getNode(ISD::TRUNCATE, DL, VT, Op);
963 }
964
965 SDValue SelectionDAG::getBoolExtOrTrunc(SDValue Op, SDLoc SL, EVT VT) {
966 if (VT.bitsLE(Op.getValueType()))
967 return getNode(ISD::TRUNCATE, SL, VT, Op);
968
969 TargetLowering::BooleanContent BType = TLI->getBooleanContents(VT.isVector());
970 return getNode(TLI->getExtendForContent(BType), SL, VT, Op);
963971 }
964972
965973 SDValue SelectionDAG::getZeroExtendInReg(SDValue Op, SDLoc DL, EVT VT) {
13811381 EVT newVT = N0.getOperand(0).getValueType();
13821382 if (DCI.isBeforeLegalizeOps() ||
13831383 (isOperationLegal(ISD::SETCC, newVT) &&
1384 getCondCodeAction(Cond, newVT.getSimpleVT())==Legal))
1385 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1386 DAG.getConstant(C1.trunc(InSize), newVT),
1387 Cond);
1384 getCondCodeAction(Cond, newVT.getSimpleVT()) == Legal)) {
1385 EVT NewSetCCVT = getSetCCResultType(*DAG.getContext(), newVT);
1386 SDValue NewConst = DAG.getConstant(C1.trunc(InSize), newVT);
1387
1388 SDValue NewSetCC = DAG.getSetCC(dl, NewSetCCVT, N0.getOperand(0),
1389 NewConst, Cond);
1390 return DAG.getBoolExtOrTrunc(NewSetCC, dl, VT);
1391 }
13881392 break;
13891393 }
13901394 default: