[llvm] 5f3eab9 - [AVR] Remove extra ROL / ROR operands (#117510)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 24 18:15:24 PST 2024
Author: Sergei Barannikov
Date: 2024-11-25T05:15:20+03:00
New Revision: 5f3eab9e453c0237ccfafb6775b5af55bf028c84
URL: https://github.com/llvm/llvm-project/commit/5f3eab9e453c0237ccfafb6775b5af55bf028c84
DIFF: https://github.com/llvm/llvm-project/commit/5f3eab9e453c0237ccfafb6775b5af55bf028c84.diff
LOG: [AVR] Remove extra ROL / ROR operands (#117510)
The nodes have one input, shift amount of 1 is implied.
Added:
Modified:
llvm/lib/Target/AVR/AVRISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp
index 1737ec7b671992..07c79f6f227b02 100644
--- a/llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp
@@ -412,24 +412,20 @@ SDValue AVRTargetLowering::LowerShifts(SDValue Op, SelectionDAG &DAG) const {
} else if (Op.getOpcode() == ISD::ROTL && ShiftAmount == 3) {
// Optimize left rotation 3 bits to swap then right rotation 1 bit.
Victim = DAG.getNode(AVRISD::SWAP, dl, VT, Victim);
- Victim =
- DAG.getNode(AVRISD::ROR, dl, VT, Victim, DAG.getConstant(1, dl, VT));
+ Victim = DAG.getNode(AVRISD::ROR, dl, VT, Victim);
ShiftAmount = 0;
} else if (Op.getOpcode() == ISD::ROTR && ShiftAmount == 3) {
// Optimize right rotation 3 bits to swap then left rotation 1 bit.
Victim = DAG.getNode(AVRISD::SWAP, dl, VT, Victim);
- Victim =
- DAG.getNode(AVRISD::ROL, dl, VT, Victim, DAG.getConstant(1, dl, VT));
+ Victim = DAG.getNode(AVRISD::ROL, dl, VT, Victim);
ShiftAmount = 0;
} else if (Op.getOpcode() == ISD::ROTL && ShiftAmount == 7) {
// Optimize left rotation 7 bits to right rotation 1 bit.
- Victim =
- DAG.getNode(AVRISD::ROR, dl, VT, Victim, DAG.getConstant(1, dl, VT));
+ Victim = DAG.getNode(AVRISD::ROR, dl, VT, Victim);
ShiftAmount = 0;
} else if (Op.getOpcode() == ISD::ROTR && ShiftAmount == 7) {
// Optimize right rotation 7 bits to left rotation 1 bit.
- Victim =
- DAG.getNode(AVRISD::ROL, dl, VT, Victim, DAG.getConstant(1, dl, VT));
+ Victim = DAG.getNode(AVRISD::ROL, dl, VT, Victim);
ShiftAmount = 0;
} else if ((Op.getOpcode() == ISD::ROTR || Op.getOpcode() == ISD::ROTL) &&
ShiftAmount >= 4) {
More information about the llvm-commits
mailing list