summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_simplifier.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2016-03-22 14:57:31 +0000
committer Roland Levillain <rpl@google.com> 2016-03-22 14:57:31 +0000
commit5b5b9319ff970979ed47d41a41283e4faeffb602 (patch)
treee7795abf120cf512627786fd6302efd34535724b /compiler/optimizing/instruction_simplifier.cc
parent0c25da0276f5b6f6119793ae9d45d1bca8172c2b (diff)
Fix and improve shift and rotate operations.
- Define maximum int and long shift & rotate distances as int32_t constants, as shift & rotate distances are 32-bit integer values. - Consider the (long, long) inputs case as invalid for static evaluation of shift & rotate rotations. - Add more checks in shift & rotate operations constructors as well as in art::GraphChecker. Change-Id: I754b326c3a341c9cc567d1720b327dad6fcbf9d6
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r--compiler/optimizing/instruction_simplifier.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 4a8186a659..72ea4b6af6 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -240,8 +240,9 @@ void InstructionSimplifierVisitor::VisitShift(HBinaryOperation* instruction) {
if (input_cst != nullptr) {
int64_t cst = Int64FromConstant(input_cst);
- int64_t mask =
- (input_other->GetType() == Primitive::kPrimLong) ? kMaxLongShiftValue : kMaxIntShiftValue;
+ int64_t mask = (input_other->GetType() == Primitive::kPrimLong)
+ ? kMaxLongShiftDistance
+ : kMaxIntShiftDistance;
if ((cst & mask) == 0) {
// Replace code looking like
// SHL dst, src, 0