summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
authorMark Mendell <mark.p.mendell@intel.com>2015-04-15 19:57:22 -0400
committerMark Mendell <mark.p.mendell@intel.com>2015-04-20 14:26:10 -0400
commitb0bd8915cb257cdaf46ba663c450a6543bca75af (patch)
tree0af66cce65abb2958d03579bd7fb660ffdda929b /compiler/optimizing/nodes.cc
parentb9791aa606834160b085dec7c5b32ccbeaf9a186 (diff)
downloadart-b0bd8915cb257cdaf46ba663c450a6543bca75af.tar.gz
art-b0bd8915cb257cdaf46ba663c450a6543bca75af.tar.bz2
art-b0bd8915cb257cdaf46ba663c450a6543bca75af.zip
[optimizing] Replace FP divide by power of 2
Replace a floating point division by a power of two by a multiplication of the reciprocal. This is guarenteed to have the exact same result as it is exactly representable. Add routines to allow generation of float and double constants after the SSA Builder. I was unsure if float and double caches should be implemented. Under the assumption that there is probably not a lot of repetition of FP values. Please let me know. Change-Id: I3a6c3847b49b4e747a7e7e8843ca32bb174b1584 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 5fca4fab22..6020196493 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -343,6 +343,18 @@ HConstant* HGraph::GetConstant(Primitive::Type type, int64_t value) {
}
}
+HFloatConstant* HGraph::GetFloatConstant(float value) {
+ HFloatConstant *constant = new (arena_) HFloatConstant(value);
+ InsertConstant(constant);
+ return constant;
+}
+
+HDoubleConstant* HGraph::GetDoubleConstant(double value) {
+ HDoubleConstant *constant = new (arena_) HDoubleConstant(value);
+ InsertConstant(constant);
+ return constant;
+}
+
void HLoopInformation::Add(HBasicBlock* block) {
blocks_.SetBit(block->GetBlockId());
}