@@ -1723,7 +1723,7 @@ getDefaultVLOps(MVT VecVT, MVT ContainerVT, SDLoc DL, SelectionDAG &DAG,
17231723 MVT XLenVT = Subtarget.getXLenVT ();
17241724 SDValue VL = VecVT.isFixedLengthVector ()
17251725 ? DAG .getConstant (VecVT.getVectorNumElements (), DL , XLenVT)
1726- : DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , XLenVT);
1726+ : DAG .getRegister (RISCV ::X0 , XLenVT);
17271727 MVT MaskVT = MVT::getVectorVT (MVT ::i1, ContainerVT.getVectorElementCount ());
17281728 SDValue Mask = DAG .getNode (RISCVISD ::VMSET_VL , DL , MaskVT, VL );
17291729 return {Mask, VL };
@@ -2370,14 +2370,12 @@ static SDValue splatPartsI64WithVL(const SDLoc &DL, MVT VT, SDValue Lo,
23702370 // If vl is equal to XLEN_MAX and Hi constant is equal to Lo, we could use
23712371 // vmv.v.x whose EEW = 32 to lower it.
23722372 auto *Const = dyn_cast<ConstantSDNode>(VL );
2373- if (LoC == HiC && Const && Const->isAllOnesValue () &&
2374- Const->getOpcode () != ISD ::TargetConstant) {
2373+ if (LoC == HiC && Const && Const->isAllOnesValue ()) {
23752374 MVT InterVT = MVT::getVectorVT (MVT ::i32 , VT .getVectorElementCount () * 2 );
23762375 // TODO: if vl <= min(VLMAX), we can also do this. But we could not
23772376 // access the subtarget here now.
2378- auto InterVec = DAG .getNode (
2379- RISCVISD ::VMV_V_X_VL , DL , InterVT, Lo,
2380- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , MVT ::i32 ));
2377+ auto InterVec = DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , InterVT, Lo,
2378+ DAG .getRegister (RISCV ::X0 , MVT ::i32 ));
23812379 return DAG .getNode (ISD ::BITCAST , DL , VT , InterVec);
23822380 }
23832381 }
@@ -4159,22 +4157,20 @@ SDValue RISCVTargetLowering::lowerSPLAT_VECTOR_PARTS(SDValue Op,
41594157 // If Hi constant is all the same sign bit as Lo, lower this as a custom
41604158 // node in order to try and match RVV vector/scalar instructions.
41614159 if ((LoC >> 31 ) == HiC)
4162- return DAG .getNode (
4163- RISCVISD ::VMV_V_X_VL , DL , VecVT, Lo,
4164- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , MVT ::i32 ));
4160+ return DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, Lo,
4161+ DAG .getRegister (RISCV ::X0 , MVT ::i32 ));
41654162 }
41664163
41674164 // Detect cases where Hi is (SRA Lo, 31) which means Hi is Lo sign extended.
41684165 if (Hi.getOpcode () == ISD ::SRA && Hi.getOperand (0 ) == Lo &&
41694166 isa<ConstantSDNode>(Hi.getOperand (1 )) &&
41704167 Hi.getConstantOperandVal (1 ) == 31 )
4171- return DAG .getNode (
4172- RISCVISD ::VMV_V_X_VL , DL , VecVT, Lo,
4173- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , MVT ::i32 ));
4168+ return DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, Lo,
4169+ DAG .getRegister (RISCV ::X0 , MVT ::i32 ));
41744170
41754171 // Fall back to use a stack store and stride x0 vector load. Use X0 as VL.
41764172 return DAG .getNode (RISCVISD ::SPLAT_VECTOR_SPLIT_I64_VL , DL , VecVT, Lo, Hi,
4177- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , MVT ::i32 ));
4173+ DAG .getRegister (RISCV ::X0 , MVT ::i32 ));
41784174}
41794175
41804176// Custom-lower extensions from mask vectors by using a vselect either with 1
@@ -4206,12 +4202,10 @@ SDValue RISCVTargetLowering::lowerVectorMaskExt(SDValue Op, SelectionDAG &DAG,
42064202 SplatZero = DAG .getSplatVector (VecVT, DL , SplatZero);
42074203 SplatTrueVal = DAG .getSplatVector (VecVT, DL , SplatTrueVal);
42084204 } else {
4209- SplatZero =
4210- DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, SplatZero,
4211- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , XLenVT));
4212- SplatTrueVal =
4213- DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, SplatTrueVal,
4214- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , XLenVT));
4205+ SplatZero = DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, SplatZero,
4206+ DAG .getRegister (RISCV ::X0 , XLenVT));
4207+ SplatTrueVal = DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VecVT, SplatTrueVal,
4208+ DAG .getRegister (RISCV ::X0 , XLenVT));
42154209 }
42164210
42174211 return DAG .getNode (ISD ::VSELECT , DL , VecVT, Src, SplatTrueVal, SplatZero);
@@ -5528,9 +5522,8 @@ SDValue RISCVTargetLowering::lowerVECTOR_REVERSE(SDValue Op,
55285522 if (!IsRV32E64)
55295523 SplatVL = DAG .getSplatVector (IntVT, DL , VLMinus1);
55305524 else
5531- SplatVL =
5532- DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , IntVT, VLMinus1,
5533- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL , XLenVT));
5525+ SplatVL = DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , IntVT, VLMinus1,
5526+ DAG .getRegister (RISCV ::X0 , XLenVT));
55345527
55355528 SDValue VID = DAG .getNode (RISCVISD ::VID_VL , DL , IntVT, Mask, VL );
55365529 SDValue Indices =
@@ -8255,8 +8248,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
82558248 SDLoc DL (N);
82568249 EVT VT = N->getValueType (0 );
82578250 ShAmt = DAG .getNode (RISCVISD ::VMV_V_X_VL , DL , VT , ShAmt.getOperand (0 ),
8258- DAG .getTargetConstant (RISCV ::VLMaxSentinel, DL ,
8259- Subtarget.getXLenVT ()));
8251+ DAG .getRegister (RISCV ::X0 , Subtarget.getXLenVT ()));
82608252 return DAG .getNode (N->getOpcode (), DL , VT , N->getOperand (0 ), ShAmt);
82618253 }
82628254 break ;
0 commit comments