forked from OSchip/llvm-project
Duncan's patch. Further to 64382. Takes care of illegal types for shift amount.
llvm-svn: 63523
This commit is contained in:
parent
f26a1d4ef7
commit
8e56d1898b
|
@ -684,6 +684,12 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
|
|||
case ISD::TRUNCATE: Res = PromoteIntOp_TRUNCATE(N); break;
|
||||
case ISD::UINT_TO_FP: Res = PromoteIntOp_UINT_TO_FP(N); break;
|
||||
case ISD::ZERO_EXTEND: Res = PromoteIntOp_ZERO_EXTEND(N); break;
|
||||
|
||||
case ISD::SHL:
|
||||
case ISD::SRA:
|
||||
case ISD::SRL:
|
||||
case ISD::ROTL:
|
||||
case ISD::ROTR: Res = PromoteIntOp_Shift(N); break;
|
||||
}
|
||||
|
||||
// If the result is null, the sub-method took care of registering results etc.
|
||||
|
@ -890,6 +896,11 @@ SDValue DAGTypeLegalizer::PromoteIntOp_SETCC(SDNode *N, unsigned OpNo) {
|
|||
return DAG.UpdateNodeOperands(SDValue(N, 0), LHS, RHS, N->getOperand(2));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::PromoteIntOp_Shift(SDNode *N) {
|
||||
return DAG.UpdateNodeOperands(SDValue(N, 0), N->getOperand(0),
|
||||
ZExtPromotedInteger(N->getOperand(1)));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::PromoteIntOp_SIGN_EXTEND(SDNode *N) {
|
||||
SDValue Op = GetPromotedInteger(N->getOperand(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
@ -1935,6 +1946,12 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
|
|||
case ISD::STORE: Res = ExpandIntOp_STORE(cast<StoreSDNode>(N), OpNo); break;
|
||||
case ISD::TRUNCATE: Res = ExpandIntOp_TRUNCATE(N); break;
|
||||
case ISD::UINT_TO_FP: Res = ExpandIntOp_UINT_TO_FP(N); break;
|
||||
|
||||
case ISD::SHL:
|
||||
case ISD::SRA:
|
||||
case ISD::SRL:
|
||||
case ISD::ROTL:
|
||||
case ISD::ROTR: Res = ExpandIntOp_Shift(N); break;
|
||||
}
|
||||
|
||||
// If the result is null, the sub-method took care of registering results etc.
|
||||
|
@ -2108,6 +2125,15 @@ SDValue DAGTypeLegalizer::ExpandIntOp_SETCC(SDNode *N) {
|
|||
DAG.getCondCode(CCCode));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ExpandIntOp_Shift(SDNode *N) {
|
||||
// The value being shifted is legal, but the shift amount is too big.
|
||||
// It follows that either the result of the shift is undefined, or the
|
||||
// upper half of the shift amount is zero. Just use the lower half.
|
||||
SDValue Lo, Hi;
|
||||
GetExpandedInteger(N->getOperand(1), Lo, Hi);
|
||||
return DAG.UpdateNodeOperands(SDValue(N, 0), N->getOperand(0), Lo);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(SDNode *N) {
|
||||
SDValue Op = N->getOperand(0);
|
||||
MVT DstVT = N->getValueType(0);
|
||||
|
|
|
@ -293,6 +293,7 @@ private:
|
|||
SDValue PromoteIntOp_SELECT(SDNode *N, unsigned OpNo);
|
||||
SDValue PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo);
|
||||
SDValue PromoteIntOp_SETCC(SDNode *N, unsigned OpNo);
|
||||
SDValue PromoteIntOp_Shift(SDNode *N);
|
||||
SDValue PromoteIntOp_SIGN_EXTEND(SDNode *N);
|
||||
SDValue PromoteIntOp_SINT_TO_FP(SDNode *N);
|
||||
SDValue PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo);
|
||||
|
@ -356,6 +357,7 @@ private:
|
|||
SDValue ExpandIntOp_EXTRACT_ELEMENT(SDNode *N);
|
||||
SDValue ExpandIntOp_SELECT_CC(SDNode *N);
|
||||
SDValue ExpandIntOp_SETCC(SDNode *N);
|
||||
SDValue ExpandIntOp_Shift(SDNode *N);
|
||||
SDValue ExpandIntOp_SINT_TO_FP(SDNode *N);
|
||||
SDValue ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo);
|
||||
SDValue ExpandIntOp_TRUNCATE(SDNode *N);
|
||||
|
|
Loading…
Reference in New Issue