[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Sep 28 15:50:36 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelDAGToDAG.cpp updated: 1.83 -> 1.84
---
Log message:
disentangle FP from INT versions of div/mul
---
Diffs of the changes: (+16 -18)
PPC32ISelDAGToDAG.cpp | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
Index: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.83 llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.84
--- llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.83 Wed Sep 28 17:47:28 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp Wed Sep 28 17:50:24 2005
@@ -820,7 +820,6 @@
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
- case ISD::FMUL:
case ISD::MUL: {
unsigned Imm, Opc;
if (isIntImmediate(N->getOperand(1), Imm) && isInt16(Imm)) {
@@ -828,18 +827,17 @@
Select(N->getOperand(0)), getI32Imm(Lo16(Imm)));
return SDOperand(N, 0);
}
- switch (N->getValueType(0)) {
- default: assert(0 && "Unhandled multiply type!");
- case MVT::i32: Opc = PPC::MULLW; break;
- case MVT::f32: Opc = PPC::FMULS; break;
- case MVT::f64: Opc = PPC::FMUL; break;
- }
- CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ CurDAG->SelectNodeTo(N, PPC::MULLW, MVT::i32, Select(N->getOperand(0)),
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
- case ISD::SDIV:
- case ISD::FDIV: {
+ case ISD::FMUL: {
+ unsigned Opc = N->getValueType(0) == MVT::f32 ? PPC::FMULS : PPC::FMUL;
+ CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ return SDOperand(N, 0);
+ }
+ case ISD::SDIV: {
unsigned Imm;
if (isIntImmediate(N->getOperand(1), Imm)) {
if ((signed)Imm > 0 && isPowerOf2_32(Imm)) {
@@ -869,17 +867,17 @@
}
}
- unsigned Opc;
- switch (N->getValueType(0)) {
- default: assert(0 && "Unknown type to ISD::SDIV");
- case MVT::i32: Opc = PPC::DIVW; break;
- case MVT::f32: Opc = PPC::FDIVS; break;
- case MVT::f64: Opc = PPC::FDIV; break;
- }
- CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ CurDAG->SelectNodeTo(N, PPC::DIVW, MVT::i32, Select(N->getOperand(0)),
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
+ case ISD::FDIV: {
+ unsigned Opc = N->getValueType(0) == MVT::f32 ? PPC::FDIVS : PPC::FDIV;
+ CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ return SDOperand(N, 0);
+ }
+
case ISD::UDIV: {
// If this is a divide by constant, we can emit code using some magic
// constants to implement it as a multiply instead.
More information about the llvm-commits
mailing list