[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
Nate Begeman
natebegeman at mac.com
Thu Aug 18 16:38:12 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelDAGToDAG.cpp updated: 1.12 -> 1.13
---
Log message:
Add shifts.
---
Diffs of the changes: (+45 -0)
PPC32ISelDAGToDAG.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+)
Index: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.12 llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.13
--- llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.12 Thu Aug 18 15:08:53 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp Thu Aug 18 18:38:00 2005
@@ -486,6 +486,51 @@
CurDAG->SelectNodeTo(N, MVT::i32, PPC::XOR, Select(N->getOperand(0)),
Select(N->getOperand(1)));
break;
+ case ISD::SHL: {
+ unsigned Imm, SH, MB, ME;
+ if (isOpcWithIntImmediate(N->getOperand(0).Val, ISD::AND, Imm) &&
+ isRotateAndMask(N, Imm, true, SH, MB, ME))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::RLWINM,
+ Select(N->getOperand(0).getOperand(0)),
+ getI32Imm(SH), getI32Imm(MB), getI32Imm(ME));
+ else if (isIntImmediate(N->getOperand(1), Imm))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::RLWINM, Select(N->getOperand(0)),
+ getI32Imm(Imm), getI32Imm(0), getI32Imm(31-Imm));
+ else
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::SLW, Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ break;
+ }
+ case ISD::SRL: {
+ unsigned Imm, SH, MB, ME;
+ if (isOpcWithIntImmediate(N->getOperand(0).Val, ISD::AND, Imm) &&
+ isRotateAndMask(N, Imm, true, SH, MB, ME))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::RLWINM,
+ Select(N->getOperand(0).getOperand(0)),
+ getI32Imm(SH), getI32Imm(MB), getI32Imm(ME));
+ else if (isIntImmediate(N->getOperand(1), Imm))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::RLWINM, Select(N->getOperand(0)),
+ getI32Imm(32-Imm), getI32Imm(Imm), getI32Imm(31));
+ else
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::SRW, Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ break;
+ }
+ case ISD::SRA: {
+ unsigned Imm, SH, MB, ME;
+ if (isOpcWithIntImmediate(N->getOperand(0).Val, ISD::AND, Imm) &&
+ isRotateAndMask(N, Imm, true, SH, MB, ME))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::RLWINM,
+ Select(N->getOperand(0).getOperand(0)),
+ getI32Imm(SH), getI32Imm(MB), getI32Imm(ME));
+ else if (isIntImmediate(N->getOperand(1), Imm))
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::SRAWI, Select(N->getOperand(0)),
+ getI32Imm(Imm));
+ else
+ CurDAG->SelectNodeTo(N, MVT::i32, PPC::SRAW, Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ break;
+ }
case ISD::FABS:
CurDAG->SelectNodeTo(N, N->getValueType(0), PPC::FABS,
Select(N->getOperand(0)));
More information about the llvm-commits
mailing list