aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-03 20:34:31 +0000
committerDan Gohman <gohman@apple.com>2009-09-03 20:34:31 +0000
commit8d44b28bc6f615b9ad79b066987d53b1ea2a2942 (patch)
tree4bfaf2eca9b8910a15985d9d8c2ddf10625a5f99 /lib/CodeGen/SelectionDAG
parent3653b13c52b9bce4fd9e2da3cbb893fc769adaec (diff)
downloadexternal_llvm-8d44b28bc6f615b9ad79b066987d53b1ea2a2942.zip
external_llvm-8d44b28bc6f615b9ad79b066987d53b1ea2a2942.tar.gz
external_llvm-8d44b28bc6f615b9ad79b066987d53b1ea2a2942.tar.bz2
Recognize more opportunities to use SSE min and max instructions,
swapping the operands if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 11f12c9..0a523fa 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2198,6 +2198,19 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
return std::max(FirstAnswer, std::min(VTBits, Mask.countLeadingZeros()));
}
+bool SelectionDAG::isKnownNeverNaN(SDValue Op) const {
+ // If we're told that NaNs won't happen, assume they won't.
+ if (FiniteOnlyFPMath())
+ return true;
+
+ // If the value is a constant, we can obviously see if it is a NaN or not.
+ if (const ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Op))
+ return !C->getValueAPF().isNaN();
+
+ // TODO: Recognize more cases here.
+
+ return false;
+}
bool SelectionDAG::isVerifiedDebugInfoDesc(SDValue Op) const {
GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Op);