Skip to content

Commit 5f3eab9

Browse files
authored
[AVR] Remove extra ROL / ROR operands (#117510)
The nodes have one input, shift amount of 1 is implied.
1 parent 02408d6 commit 5f3eab9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

llvm/lib/Target/AVR/AVRISelLowering.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,24 +412,20 @@ SDValue AVRTargetLowering::LowerShifts(SDValue Op, SelectionDAG &DAG) const {
412412
} else if (Op.getOpcode() == ISD::ROTL && ShiftAmount == 3) {
413413
// Optimize left rotation 3 bits to swap then right rotation 1 bit.
414414
Victim = DAG.getNode(AVRISD::SWAP, dl, VT, Victim);
415-
Victim =
416-
DAG.getNode(AVRISD::ROR, dl, VT, Victim, DAG.getConstant(1, dl, VT));
415+
Victim = DAG.getNode(AVRISD::ROR, dl, VT, Victim);
417416
ShiftAmount = 0;
418417
} else if (Op.getOpcode() == ISD::ROTR && ShiftAmount == 3) {
419418
// Optimize right rotation 3 bits to swap then left rotation 1 bit.
420419
Victim = DAG.getNode(AVRISD::SWAP, dl, VT, Victim);
421-
Victim =
422-
DAG.getNode(AVRISD::ROL, dl, VT, Victim, DAG.getConstant(1, dl, VT));
420+
Victim = DAG.getNode(AVRISD::ROL, dl, VT, Victim);
423421
ShiftAmount = 0;
424422
} else if (Op.getOpcode() == ISD::ROTL && ShiftAmount == 7) {
425423
// Optimize left rotation 7 bits to right rotation 1 bit.
426-
Victim =
427-
DAG.getNode(AVRISD::ROR, dl, VT, Victim, DAG.getConstant(1, dl, VT));
424+
Victim = DAG.getNode(AVRISD::ROR, dl, VT, Victim);
428425
ShiftAmount = 0;
429426
} else if (Op.getOpcode() == ISD::ROTR && ShiftAmount == 7) {
430427
// Optimize right rotation 7 bits to left rotation 1 bit.
431-
Victim =
432-
DAG.getNode(AVRISD::ROL, dl, VT, Victim, DAG.getConstant(1, dl, VT));
428+
Victim = DAG.getNode(AVRISD::ROL, dl, VT, Victim);
433429
ShiftAmount = 0;
434430
} else if ((Op.getOpcode() == ISD::ROTR || Op.getOpcode() == ISD::ROTL) &&
435431
ShiftAmount >= 4) {

0 commit comments

Comments
 (0)