From 4fa13f65ece3b68fe3d8722d679ebab8656bbf99 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Mon, 6 Jul 2015 18:11:54 +0100 Subject: Fuse long and FP compare & condition on ARM in Optimizing. Also: - Stylistic changes in corresponding parts on the x86 and x86-64 code generators. - Update and improve the documentation of art::arm::Condition. Bug: 21120453 Change-Id: If144772046e7d21362c3c2086246cb7d011d49ce --- compiler/optimizing/nodes.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 0db1ac32b3..d19170195a 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2149,7 +2149,7 @@ class HBinaryOperation : public HExpression<2> { // The comparison bias applies for floating point operations and indicates how NaN // comparisons are treated: -enum ComparisonBias { +enum class ComparisonBias { kNoBias, // bias is not applicable (i.e. for long operation) kGtBias, // return 1 for NaN comparisons kLtBias, // return -1 for NaN comparisons @@ -2160,7 +2160,7 @@ class HCondition : public HBinaryOperation { HCondition(HInstruction* first, HInstruction* second) : HBinaryOperation(Primitive::kPrimBoolean, first, second), needs_materialization_(true), - bias_(kNoBias) {} + bias_(ComparisonBias::kNoBias) {} bool NeedsMaterialization() const { return needs_materialization_; } void ClearNeedsMaterialization() { needs_materialization_ = false; } @@ -2175,7 +2175,7 @@ class HCondition : public HBinaryOperation { virtual IfCondition GetOppositeCondition() const = 0; - bool IsGtBias() { return bias_ == kGtBias; } + bool IsGtBias() const { return bias_ == ComparisonBias::kGtBias; } void SetBias(ComparisonBias bias) { bias_ = bias; } @@ -2183,6 +2183,18 @@ class HCondition : public HBinaryOperation { return bias_ == other->AsCondition()->bias_; } + bool IsFPConditionTrueIfNaN() const { + DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())); + IfCondition if_cond = GetCondition(); + return IsGtBias() ? ((if_cond == kCondGT) || (if_cond == kCondGE)) : (if_cond == kCondNE); + } + + bool IsFPConditionFalseIfNaN() const { + DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())); + IfCondition if_cond = GetCondition(); + return IsGtBias() ? ((if_cond == kCondLT) || (if_cond == kCondLE)) : (if_cond == kCondEQ); + } + private: // For register allocation purposes, returns whether this instruction needs to be // materialized (that is, not just be in the processor flags). @@ -2390,7 +2402,7 @@ class HCompare : public HBinaryOperation { ComparisonBias GetBias() const { return bias_; } - bool IsGtBias() { return bias_ == kGtBias; } + bool IsGtBias() { return bias_ == ComparisonBias::kGtBias; } uint32_t GetDexPc() const { return dex_pc_; } -- cgit v1.2.3-59-g8ed1b