diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-17 07:00:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-17 07:00:52 +0000 |
commit | 0bd4893a0726889b942405262e53d06cf3fe3be8 (patch) | |
tree | cf2cf61553bc58927d67b9140248a08ed6664b74 /lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp | |
parent | f51a9d4b3c3dc83b1184aa434e54db77c9ac992c (diff) |
* Introduce a new SelectionDAG::getIntPtrConstant method
and switch various codegen pieces and the X86 backend over
to using it.
* Add some comments to SelectionDAGNodes.h
* Introduce a second argument to FP_ROUND, which indicates
whether the FP_ROUND changes the value of its input. If
not it is safe to xform things like fp_extend(fp_round(x)) -> x.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp index 4b03c70ce5..ee565d2b31 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp @@ -144,8 +144,11 @@ SDOperand DAGTypeLegalizer::PromoteResult_INT_EXTEND(SDNode *N) { SDOperand DAGTypeLegalizer::PromoteResult_FP_ROUND(SDNode *N) { // NOTE: Assumes input is legal. - return DAG.getNode(ISD::FP_ROUND_INREG, N->getOperand(0).getValueType(), - N->getOperand(0), DAG.getValueType(N->getValueType(0))); + if (N->getConstantOperandVal(1) == 0) + return DAG.getNode(ISD::FP_ROUND_INREG, N->getOperand(0).getValueType(), + N->getOperand(0), DAG.getValueType(N->getValueType(0))); + // If the precision discard isn't needed, just return the operand unrounded. + return N->getOperand(0); } SDOperand DAGTypeLegalizer::PromoteResult_FP_TO_XINT(SDNode *N) { @@ -353,7 +356,8 @@ SDOperand DAGTypeLegalizer::PromoteOperand_FP_EXTEND(SDNode *N) { SDOperand DAGTypeLegalizer::PromoteOperand_FP_ROUND(SDNode *N) { SDOperand Op = GetPromotedOp(N->getOperand(0)); - return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Op); + return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Op, + DAG.getIntPtrConstant(0)); } SDOperand DAGTypeLegalizer::PromoteOperand_INT_TO_FP(SDNode *N) { |