[PATCH] DAGCombine: constant fold FMA
Mehdi AMINI
mehdi.amini at apple.com
Fri Jan 9 23:17:55 PST 2015
Fix precision :)
http://reviews.llvm.org/D6912
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6955,7 +6955,11 @@
if (isa<ConstantFPSDNode>(N0) &&
isa<ConstantFPSDNode>(N1) &&
isa<ConstantFPSDNode>(N2)) {
- return DAG.getNode(ISD::FMA, dl, VT, N0, N1, N2);
+ APFloat CstLHS = cast<ConstantFPSDNode>(N0)->getValueAPF();
+ APFloat CstMHS = cast<ConstantFPSDNode>(N1)->getValueAPF();
+ APFloat CstRHS = cast<ConstantFPSDNode>(N2)->getValueAPF();
+ CstLHS.fusedMultiplyAdd(CstMHS, CstRHS, APFloat::rmNearestTiesToEven);
+ return DAG.getConstantFP(CstLHS, VT);
}
if (DAG.getTarget().Options.UnsafeFPMath) {
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6912.17970.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150110/abe9f797/attachment.bin>
More information about the llvm-commits
mailing list