[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 3 13:31:49 PDT 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.151 -> 1.152
SelectionDAGPrinter.cpp updated: 1.16 -> 1.17
---
Log message:
Fix PR611: http://llvm.cs.uiuc.edu/PR611 , codegen'ing SREM of FP operands to fmod or fmodf instead of
the sequence used for integer ops
---
Diffs of the changes: (+14 -6)
LegalizeDAG.cpp | 18 ++++++++++++------
SelectionDAGPrinter.cpp | 2 ++
2 files changed, 14 insertions(+), 6 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.151 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.152
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.151 Mon Aug 1 13:16:37 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Aug 3 15:31:37 2005
@@ -1306,12 +1306,18 @@
case TargetLowering::Promote:
case TargetLowering::Custom:
assert(0 && "Cannot promote/custom handle this yet!");
- case TargetLowering::Expand: {
- MVT::ValueType VT = Node->getValueType(0);
- unsigned Opc = (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SDIV;
- Result = DAG.getNode(Opc, VT, Tmp1, Tmp2);
- Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2);
- Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result);
+ case TargetLowering::Expand:
+ if (MVT::isInteger(Node->getValueType(0))) {
+ MVT::ValueType VT = Node->getValueType(0);
+ unsigned Opc = (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SDIV;
+ Result = DAG.getNode(Opc, VT, Tmp1, Tmp2);
+ Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2);
+ Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result);
+ } else {
+ // Floating point mod -> fmod libcall.
+ const char *FnName = Node->getValueType(0) == MVT::f32 ? "fmodf":"fmod";
+ SDOperand Dummy;
+ Result = ExpandLibCall(FnName, Node, Dummy);
}
break;
}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.16 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.17
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.16 Fri Jul 15 17:48:31 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Wed Aug 3 15:31:37 2005
@@ -124,6 +124,7 @@
if (system((LLVM_PATH_GRAPHVIZ " " + Filename).c_str())) {
std::cerr << "Error viewing graph: 'Graphviz' not in path?\n";
} else {
+ system(("rm " + Filename).c_str());
return;
}
#endif
@@ -143,4 +144,5 @@
#endif
std::cerr << "SelectionDAG::viewGraph is only available in debug builds on "
<< "systems with Graphviz or gv!\n";
+ system(("rm " + Filename).c_str());
}
More information about the llvm-commits
mailing list