@@ -91,6 +91,7 @@ HexagonTargetLowering::initializeHVXLowering() {
91
91
setOperationAction (ISD::XOR, T, Legal);
92
92
setOperationAction (ISD::ADD, T, Legal);
93
93
setOperationAction (ISD::SUB, T, Legal);
94
+ setOperationAction (ISD::MUL, T, Legal);
94
95
setOperationAction (ISD::CTPOP, T, Legal);
95
96
setOperationAction (ISD::CTLZ, T, Legal);
96
97
if (T != ByteV) {
@@ -103,7 +104,6 @@ HexagonTargetLowering::initializeHVXLowering() {
103
104
setOperationAction (ISD::LOAD, T, Custom);
104
105
setOperationAction (ISD::MLOAD, T, Custom);
105
106
setOperationAction (ISD::MSTORE, T, Custom);
106
- setOperationAction (ISD::MUL, T, Custom);
107
107
setOperationAction (ISD::MULHS, T, Custom);
108
108
setOperationAction (ISD::MULHU, T, Custom);
109
109
setOperationAction (ISD::BUILD_VECTOR, T, Custom);
@@ -1444,73 +1444,6 @@ HexagonTargetLowering::LowerHvxCttz(SDValue Op, SelectionDAG &DAG) const {
1444
1444
{VecW, DAG.getNode (ISD::CTLZ, dl, ResTy, A)});
1445
1445
}
1446
1446
1447
- SDValue
1448
- HexagonTargetLowering::LowerHvxMul (SDValue Op, SelectionDAG &DAG) const {
1449
- MVT ResTy = ty (Op);
1450
- assert (ResTy.isVector () && isHvxSingleTy (ResTy));
1451
- const SDLoc &dl (Op);
1452
- SmallVector<int ,256 > ShuffMask;
1453
-
1454
- MVT ElemTy = ResTy.getVectorElementType ();
1455
- unsigned VecLen = ResTy.getVectorNumElements ();
1456
- SDValue Vs = Op.getOperand (0 );
1457
- SDValue Vt = Op.getOperand (1 );
1458
-
1459
- switch (ElemTy.SimpleTy ) {
1460
- case MVT::i8 : {
1461
- // For i8 vectors Vs = (a0, a1, ...), Vt = (b0, b1, ...),
1462
- // V6_vmpybv Vs, Vt produces a pair of i16 vectors Hi:Lo,
1463
- // where Lo = (a0*b0, a2*b2, ...), Hi = (a1*b1, a3*b3, ...).
1464
- MVT ExtTy = typeExtElem (ResTy, 2 );
1465
- unsigned MpyOpc = ElemTy == MVT::i8 ? Hexagon::V6_vmpybv
1466
- : Hexagon::V6_vmpyhv;
1467
- SDValue M = getInstr (MpyOpc, dl, ExtTy, {Vs, Vt}, DAG);
1468
-
1469
- // Discard high halves of the resulting values, collect the low halves.
1470
- for (unsigned I = 0 ; I < VecLen; I += 2 ) {
1471
- ShuffMask.push_back (I); // Pick even element.
1472
- ShuffMask.push_back (I+VecLen); // Pick odd element.
1473
- }
1474
- VectorPair P = opSplit (opCastElem (M, ElemTy, DAG), dl, DAG);
1475
- SDValue BS = getByteShuffle (dl, P.first , P.second , ShuffMask, DAG);
1476
- return DAG.getBitcast (ResTy, BS);
1477
- }
1478
- case MVT::i16 :
1479
- // For i16 there is V6_vmpyih, which acts exactly like the MUL opcode.
1480
- // (There is also V6_vmpyhv, which behaves in an analogous way to
1481
- // V6_vmpybv.)
1482
- return getInstr (Hexagon::V6_vmpyih, dl, ResTy, {Vs, Vt}, DAG);
1483
- case MVT::i32 : {
1484
- auto MulL_V60 = [&](SDValue Vs, SDValue Vt) {
1485
- // Use the following sequence for signed word multiply:
1486
- // T0 = V6_vmpyiowh Vs, Vt
1487
- // T1 = V6_vaslw T0, 16
1488
- // T2 = V6_vmpyiewuh_acc T1, Vs, Vt
1489
- SDValue S16 = DAG.getConstant (16 , dl, MVT::i32 );
1490
- SDValue T0 = getInstr (Hexagon::V6_vmpyiowh, dl, ResTy, {Vs, Vt}, DAG);
1491
- SDValue T1 = getInstr (Hexagon::V6_vaslw, dl, ResTy, {T0, S16}, DAG);
1492
- SDValue T2 = getInstr (Hexagon::V6_vmpyiewuh_acc, dl, ResTy,
1493
- {T1, Vs, Vt}, DAG);
1494
- return T2;
1495
- };
1496
- auto MulL_V62 = [&](SDValue Vs, SDValue Vt) {
1497
- MVT PairTy = typeJoin ({ResTy, ResTy});
1498
- SDValue T0 = getInstr (Hexagon::V6_vmpyewuh_64, dl, PairTy,
1499
- {Vs, Vt}, DAG);
1500
- SDValue T1 = getInstr (Hexagon::V6_vmpyowh_64_acc, dl, PairTy,
1501
- {T0, Vs, Vt}, DAG);
1502
- return opSplit (T1, dl, DAG).first ;
1503
- };
1504
- if (Subtarget.useHVXV62Ops ())
1505
- return MulL_V62 (Vs, Vt);
1506
- return MulL_V60 (Vs, Vt);
1507
- }
1508
- default :
1509
- break ;
1510
- }
1511
- return SDValue ();
1512
- }
1513
-
1514
1447
SDValue
1515
1448
HexagonTargetLowering::LowerHvxMulh (SDValue Op, SelectionDAG &DAG) const {
1516
1449
MVT ResTy = ty (Op);
@@ -2100,7 +2033,6 @@ HexagonTargetLowering::LowerHvxOperation(SDValue Op, SelectionDAG &DAG) const {
2100
2033
case ISD::SRA:
2101
2034
case ISD::SHL:
2102
2035
case ISD::SRL: return LowerHvxShift (Op, DAG);
2103
- case ISD::MUL: return LowerHvxMul (Op, DAG);
2104
2036
case ISD::MULHS:
2105
2037
case ISD::MULHU: return LowerHvxMulh (Op, DAG);
2106
2038
case ISD::ANY_EXTEND_VECTOR_INREG: return LowerHvxExtend (Op, DAG);
0 commit comments