Constant fold int-to-long-double conversions;
use APFloat for int-to-float/double; use
round-to-nearest for these (implementation-defined,
seems to match gcc).

llvm-svn: 42484
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 042868d..e286eb0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1598,7 +1598,7 @@
       (void)apf.convertFromInteger(&Val, 
                                MVT::getSizeInBits(Operand.getValueType()), 
                                Opcode==ISD::SINT_TO_FP,
-                               APFloat::rmTowardZero);
+                               APFloat::rmNearestTiesToEven);
       return getConstantFP(apf, VT);
     }
     case ISD::BIT_CONVERT: