summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-03-05 01:30:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-03-05 01:30:59 +0000
commit0a62cb44ce11c4ab7119b1e7fa7d061ab94fd065 (patch)
tree1ce2058815403aaaf09f9d7f60601a51493a7f15 /llvm/lib/Target
parent855d024a83fac2913f993dc263923cad09cba411 (diff)
downloadbcm5719-llvm-0a62cb44ce11c4ab7119b1e7fa7d061ab94fd065.tar.gz
bcm5719-llvm-0a62cb44ce11c4ab7119b1e7fa7d061ab94fd065.zip
Add a target lowering hook to control whether it's worthwhile to compress fp constant.
For x86, if sse2 is available, it's not a good idea since cvtss2sd is slower than a movsd load and it prevents load folding. On x87, it's important to shrink fp constant since fldt is very expensive. llvm-svn: 47931
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index d9593a4ef64..e0ddf63bf0f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -434,6 +434,16 @@ namespace llvm {
virtual bool isVectorClearMaskLegal(std::vector<SDOperand> &BVOps,
MVT::ValueType EVT,
SelectionDAG &DAG) const;
+
+ /// ShouldShrinkFPConstant - If true, then instruction selection should
+ /// seek to shrink the FP constant of the specified type to a smaller type
+ /// in order to save space and / or reduce runtime.
+ virtual bool ShouldShrinkFPConstant(MVT::ValueType VT) const {
+ // Don't shrink FP constpool if SSE2 is available since cvtss2sd is more
+ // expensive than a straight movsd. On the other hand, it's important to
+ // shrink long double fp constant since fldt is very slow.
+ return !X86ScalarSSEf64 || VT == MVT::f80;
+ }
/// IsEligibleForTailCallOptimization - Check whether the call is eligible
/// for tail call optimization. Target which want to do tail call
OpenPOWER on IntegriCloud