@@ -176,8 +176,7 @@ static SDValue selectImmSeq(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
176
176
RISCVMatInt::InstSeq &Seq) {
177
177
SDValue SrcReg = CurDAG->getRegister (RISCV::X0, VT);
178
178
for (const RISCVMatInt::Inst &Inst : Seq) {
179
- SDValue SDImm =
180
- CurDAG->getSignedConstant (Inst.getImm (), DL, VT, /* isTarget=*/ true );
179
+ SDValue SDImm = CurDAG->getSignedTargetConstant (Inst.getImm (), DL, VT);
181
180
SDNode *Result = nullptr ;
182
181
switch (Inst.getOpndKind ()) {
183
182
case RISCVMatInt::Imm:
@@ -208,10 +207,10 @@ static SDValue selectImm(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
208
207
209
208
// Use a rematerializable pseudo instruction for short sequences if enabled.
210
209
if (Seq.size () == 2 && UsePseudoMovImm)
211
- return SDValue (CurDAG-> getMachineNode (RISCV::PseudoMovImm, DL, VT,
212
- CurDAG->getSignedConstant (
213
- Imm, DL, VT, /* isTarget= */ true )),
214
- 0 );
210
+ return SDValue (
211
+ CurDAG->getMachineNode (RISCV::PseudoMovImm, DL, VT,
212
+ CurDAG-> getSignedTargetConstant ( Imm, DL, VT)),
213
+ 0 );
215
214
216
215
// See if we can create this constant as (ADD (SLLI X, C), X) where X is at
217
216
// worst an LUI+ADDIW. This will require an extra register, but avoids a
@@ -594,7 +593,7 @@ bool RISCVDAGToDAGISel::tryShrinkShlLogicImm(SDNode *Node) {
594
593
595
594
SDNode *BinOp = CurDAG->getMachineNode (
596
595
BinOpc, DL, VT, Shift.getOperand (0 ),
597
- CurDAG->getSignedConstant (ShiftedVal, DL, VT, /* isTarget= */ true ));
596
+ CurDAG->getSignedTargetConstant (ShiftedVal, DL, VT));
598
597
SDNode *SLLI =
599
598
CurDAG->getMachineNode (ShOpc, DL, VT, SDValue (BinOp, 0 ),
600
599
CurDAG->getTargetConstant (ShAmt, DL, VT));
@@ -723,11 +722,10 @@ bool RISCVDAGToDAGISel::tryIndexedLoad(SDNode *Node) {
723
722
return false ;
724
723
725
724
EVT Ty = Ld->getOffset ().getValueType ();
726
- SDValue Ops[] = {Ld->getBasePtr (),
727
- CurDAG->getSignedConstant (Offset >> Shift, SDLoc (Node), Ty,
728
- /* isTarget=*/ true ),
729
- CurDAG->getTargetConstant (Shift, SDLoc (Node), Ty),
730
- Ld->getChain ()};
725
+ SDValue Ops[] = {
726
+ Ld->getBasePtr (),
727
+ CurDAG->getSignedTargetConstant (Offset >> Shift, SDLoc (Node), Ty),
728
+ CurDAG->getTargetConstant (Shift, SDLoc (Node), Ty), Ld->getChain ()};
731
729
SDNode *New = CurDAG->getMachineNode (Opcode, SDLoc (Node), Ld->getValueType (0 ),
732
730
Ld->getValueType (1 ), MVT::Other, Ops);
733
731
@@ -2515,8 +2513,8 @@ bool RISCVDAGToDAGISel::SelectFrameAddrRegImm(SDValue Addr, SDValue &Base,
2515
2513
if (isInt<12 >(CVal)) {
2516
2514
Base = CurDAG->getTargetFrameIndex (FIN->getIndex (),
2517
2515
Subtarget->getXLenVT ());
2518
- Offset = CurDAG->getSignedConstant (
2519
- CVal, SDLoc (Addr), Subtarget->getXLenVT (), /* isTarget= */ true );
2516
+ Offset = CurDAG->getSignedTargetConstant (CVal, SDLoc (Addr),
2517
+ Subtarget->getXLenVT ());
2520
2518
return true ;
2521
2519
}
2522
2520
}
@@ -2555,7 +2553,7 @@ static bool selectConstantAddr(SelectionDAG *CurDAG, const SDLoc &DL,
2555
2553
} else {
2556
2554
Base = CurDAG->getRegister (RISCV::X0, VT);
2557
2555
}
2558
- Offset = CurDAG->getSignedConstant (Lo12, DL, VT, /* isTarget= */ true );
2556
+ Offset = CurDAG->getSignedTargetConstant (Lo12, DL, VT);
2559
2557
return true ;
2560
2558
}
2561
2559
@@ -2577,7 +2575,7 @@ static bool selectConstantAddr(SelectionDAG *CurDAG, const SDLoc &DL,
2577
2575
assert (!Seq.empty () && " Expected more instructions in sequence" );
2578
2576
2579
2577
Base = selectImmSeq (CurDAG, DL, VT, Seq);
2580
- Offset = CurDAG->getSignedConstant (Lo12, DL, VT, /* isTarget= */ true );
2578
+ Offset = CurDAG->getSignedTargetConstant (Lo12, DL, VT);
2581
2579
return true ;
2582
2580
}
2583
2581
@@ -2727,7 +2725,7 @@ bool RISCVDAGToDAGISel::SelectAddrRegImm(SDValue Addr, SDValue &Base,
2727
2725
2728
2726
if (auto *FIN = dyn_cast<FrameIndexSDNode>(Base))
2729
2727
Base = CurDAG->getTargetFrameIndex (FIN->getIndex (), VT);
2730
- Offset = CurDAG->getSignedConstant (CVal, DL, VT, /* isTarget= */ true );
2728
+ Offset = CurDAG->getSignedTargetConstant (CVal, DL, VT);
2731
2729
return true ;
2732
2730
}
2733
2731
}
@@ -2744,11 +2742,10 @@ bool RISCVDAGToDAGISel::SelectAddrRegImm(SDValue Addr, SDValue &Base,
2744
2742
if (CVal >= -4096 && CVal <= (4094 - RV32ZdinxRange)) {
2745
2743
int64_t Adj = CVal < 0 ? -2048 : 2047 ;
2746
2744
Base = SDValue (
2747
- CurDAG->getMachineNode (
2748
- RISCV::ADDI, DL, VT, Addr.getOperand (0 ),
2749
- CurDAG->getSignedConstant (Adj, DL, VT, /* isTarget=*/ true )),
2745
+ CurDAG->getMachineNode (RISCV::ADDI, DL, VT, Addr.getOperand (0 ),
2746
+ CurDAG->getSignedTargetConstant (Adj, DL, VT)),
2750
2747
0 );
2751
- Offset = CurDAG->getSignedConstant (CVal - Adj, DL, VT, /* isTarget= */ true );
2748
+ Offset = CurDAG->getSignedTargetConstant (CVal - Adj, DL, VT);
2752
2749
return true ;
2753
2750
}
2754
2751
@@ -2802,7 +2799,7 @@ bool RISCVDAGToDAGISel::SelectAddrRegImmLsb00000(SDValue Addr, SDValue &Base,
2802
2799
2803
2800
if (auto *FIN = dyn_cast<FrameIndexSDNode>(Base))
2804
2801
Base = CurDAG->getTargetFrameIndex (FIN->getIndex (), VT);
2805
- Offset = CurDAG->getSignedConstant (CVal, DL, VT, /* isTarget= */ true );
2802
+ Offset = CurDAG->getSignedTargetConstant (CVal, DL, VT);
2806
2803
return true ;
2807
2804
}
2808
2805
}
@@ -2818,12 +2815,12 @@ bool RISCVDAGToDAGISel::SelectAddrRegImmLsb00000(SDValue Addr, SDValue &Base,
2818
2815
if ((-2049 >= CVal && CVal >= -4096 ) || (4065 >= CVal && CVal >= 2017 )) {
2819
2816
int64_t Adj = CVal < 0 ? -2048 : 2016 ;
2820
2817
int64_t AdjustedOffset = CVal - Adj;
2821
- Base = SDValue (CurDAG-> getMachineNode (
2822
- RISCV::ADDI, DL, VT, Addr. getOperand ( 0 ),
2823
- CurDAG-> getSignedConstant (AdjustedOffset , DL, VT,
2824
- /* isTarget= */ true )),
2825
- 0 );
2826
- Offset = CurDAG->getSignedConstant (Adj, DL, VT, /* isTarget= */ true );
2818
+ Base =
2819
+ SDValue (CurDAG-> getMachineNode (
2820
+ RISCV::ADDI , DL, VT, Addr. getOperand ( 0 ) ,
2821
+ CurDAG-> getSignedTargetConstant (AdjustedOffset, DL, VT )),
2822
+ 0 );
2823
+ Offset = CurDAG->getSignedTargetConstant (Adj, DL, VT);
2827
2824
return true ;
2828
2825
}
2829
2826
@@ -2969,21 +2966,21 @@ bool RISCVDAGToDAGISel::selectSETCC(SDValue N, ISD::CondCode ExpectedCCVal,
2969
2966
// If the RHS is -2048, we can use xori to produce 0 if the LHS is -2048 and
2970
2967
// non-zero otherwise.
2971
2968
if (CVal == -2048 ) {
2972
- Val = SDValue (CurDAG-> getMachineNode (
2973
- RISCV::XORI, DL, N-> getValueType ( 0 ), LHS,
2974
- CurDAG-> getSignedConstant (CVal , DL, N->getValueType (0 ),
2975
- /* isTarget= */ true )),
2976
- 0 );
2969
+ Val = SDValue (
2970
+ CurDAG-> getMachineNode (
2971
+ RISCV::XORI , DL, N->getValueType (0 ), LHS ,
2972
+ CurDAG-> getSignedTargetConstant (CVal, DL, N-> getValueType ( 0 ) )),
2973
+ 0 );
2977
2974
return true ;
2978
2975
}
2979
2976
// If the RHS is [-2047,2048], we can use addi with -RHS to produce 0 if the
2980
2977
// LHS is equal to the RHS and non-zero otherwise.
2981
2978
if (isInt<12 >(CVal) || CVal == 2048 ) {
2982
- Val = SDValue (CurDAG-> getMachineNode (
2983
- RISCV::ADDI, DL, N-> getValueType ( 0 ), LHS,
2984
- CurDAG-> getSignedConstant (-CVal , DL, N->getValueType (0 ),
2985
- /* isTarget= */ true )),
2986
- 0 );
2979
+ Val = SDValue (
2980
+ CurDAG-> getMachineNode (
2981
+ RISCV::ADDI , DL, N->getValueType (0 ), LHS ,
2982
+ CurDAG-> getSignedTargetConstant (-CVal, DL, N-> getValueType ( 0 ) )),
2983
+ 0 );
2987
2984
return true ;
2988
2985
}
2989
2986
if (isPowerOf2_64 (CVal) && Subtarget->hasStdExtZbs ()) {
@@ -3424,8 +3421,7 @@ bool RISCVDAGToDAGISel::selectSimm5Shl2(SDValue N, SDValue &Simm5,
3424
3421
return false ;
3425
3422
3426
3423
EVT Ty = N->getValueType (0 );
3427
- Simm5 = CurDAG->getSignedConstant (Offset >> Shift, SDLoc (N), Ty,
3428
- /* isTarget=*/ true );
3424
+ Simm5 = CurDAG->getSignedTargetConstant (Offset >> Shift, SDLoc (N), Ty);
3429
3425
Shl2 = CurDAG->getTargetConstant (Shift, SDLoc (N), Ty);
3430
3426
return true ;
3431
3427
}
@@ -3442,16 +3438,16 @@ bool RISCVDAGToDAGISel::selectVLOp(SDValue N, SDValue &VL) {
3442
3438
N->getValueType (0 ));
3443
3439
} else if (C && C->isAllOnes ()) {
3444
3440
// Treat all ones as VLMax.
3445
- VL = CurDAG->getSignedConstant (RISCV::VLMaxSentinel, SDLoc (N),
3446
- N->getValueType (0 ), /* isTarget= */ true );
3441
+ VL = CurDAG->getSignedTargetConstant (RISCV::VLMaxSentinel, SDLoc (N),
3442
+ N->getValueType (0 ));
3447
3443
} else if (isa<RegisterSDNode>(N) &&
3448
3444
cast<RegisterSDNode>(N)->getReg () == RISCV::X0) {
3449
3445
// All our VL operands use an operand that allows GPRNoX0 or an immediate
3450
3446
// as the register class. Convert X0 to a special immediate to pass the
3451
3447
// MachineVerifier. This is recognized specially by the vsetvli insertion
3452
3448
// pass.
3453
- VL = CurDAG->getSignedConstant (RISCV::VLMaxSentinel, SDLoc (N),
3454
- N->getValueType (0 ), /* isTarget= */ true );
3449
+ VL = CurDAG->getSignedTargetConstant (RISCV::VLMaxSentinel, SDLoc (N),
3450
+ N->getValueType (0 ));
3455
3451
} else {
3456
3452
VL = N;
3457
3453
}
@@ -3509,8 +3505,8 @@ static bool selectVSplatImmHelper(SDValue N, SDValue &SplatVal,
3509
3505
if (!ValidateImm (SplatImm))
3510
3506
return false ;
3511
3507
3512
- SplatVal = DAG. getSignedConstant (SplatImm, SDLoc (N), Subtarget. getXLenVT (),
3513
- /* isTarget= */ true );
3508
+ SplatVal =
3509
+ DAG. getSignedTargetConstant (SplatImm, SDLoc (N), Subtarget. getXLenVT () );
3514
3510
return true ;
3515
3511
}
3516
3512
@@ -3610,8 +3606,8 @@ bool RISCVDAGToDAGISel::selectRVVSimm5(SDValue N, unsigned Width,
3610
3606
if (!isInt<5 >(ImmVal))
3611
3607
return false ;
3612
3608
3613
- Imm = CurDAG->getSignedConstant (ImmVal, SDLoc (N), Subtarget-> getXLenVT ( ),
3614
- /* isTarget= */ true );
3609
+ Imm = CurDAG->getSignedTargetConstant (ImmVal, SDLoc (N),
3610
+ Subtarget-> getXLenVT () );
3615
3611
return true ;
3616
3612
}
3617
3613
0 commit comments