- SDValue NewAdd;
-
- // FIXME: Handle arbitrary powers of 2.
- switch (MulAmt >> ShiftAmt) {
- case 3: // 2 + 1
- NewAdd = DAG.getNode(ISD::ADD, DL, VT,
- V, DAG.getNode(ISD::SHL, DL, VT,
- V, DAG.getConstant(1, MVT::i32)));
- break;
- case 5: // 4 + 1
- NewAdd = DAG.getNode(ISD::ADD, DL, VT,
- V, DAG.getNode(ISD::SHL, DL, VT,
- V, DAG.getConstant(2, MVT::i32)));
- break;
- case 7: // 8 - 1
- NewAdd = DAG.getNode(ISD::SUB, DL, VT,
- DAG.getNode(ISD::SHL, DL, VT,
- V, DAG.getConstant(3, MVT::i32)),
- V);
- break;
- case 9: // 8 + 1
- NewAdd = DAG.getNode(ISD::ADD, DL, VT,
- V, DAG.getNode(ISD::SHL, DL, VT,
- V, DAG.getConstant(3, MVT::i32)));
- break;
- default: return SDValue();
- }