diff options
author | 2016-12-12 14:28:21 -0800 | |
---|---|---|
committer | 2016-12-13 11:43:48 -0800 | |
commit | 9186ced255f2e7402646b5b286deebb540640734 (patch) | |
tree | 833c25fd3bbb47749265947705b4fc0f0c1ba796 /compiler/optimizing/instruction_simplifier.cc | |
parent | aa2657d6d9dda2e44c6452e5f5901db78ef9b3cc (diff) |
ART: Clean up utils.h
Remove functionality provided by libbase. Move some single-use
functions to their respective users.
Test: m test-art-host
Change-Id: I75594035fa975200d638cc29bb9f31bc6e6cb29f
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 658b80468e..c615df1f1d 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -1185,6 +1185,18 @@ void InstructionSimplifierVisitor::VisitCondition(HCondition* condition) { RecordSimplification(); } +// Return whether x / divisor == x * (1.0f / divisor), for every float x. +static constexpr bool CanDivideByReciprocalMultiplyFloat(int32_t divisor) { + // True, if the most significant bits of divisor are 0. + return ((divisor & 0x7fffff) == 0); +} + +// Return whether x / divisor == x * (1.0 / divisor), for every double x. +static constexpr bool CanDivideByReciprocalMultiplyDouble(int64_t divisor) { + // True, if the most significant bits of divisor are 0. + return ((divisor & ((UINT64_C(1) << 52) - 1)) == 0); +} + void InstructionSimplifierVisitor::VisitDiv(HDiv* instruction) { HConstant* input_cst = instruction->GetConstantRight(); HInstruction* input_other = instruction->GetLeastConstantLeft(); |