summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-12-09 10:19:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-12-09 10:19:06 +0000
commit1f5f0f98b72530576f885ca7393d30b3ba7f40fc (patch)
tree0afbe452a6d75fc69ee0f3a036342c60b3ac1353 /compiler
parent5fd92d4b8dbb6bd3d4b698300c9f2ac524edbfd8 (diff)
parent486cc19e1e2eca4231f760117e95090c03e2d8c6 (diff)
downloadart-1f5f0f98b72530576f885ca7393d30b3ba7f40fc.zip
art-1f5f0f98b72530576f885ca7393d30b3ba7f40fc.tar.gz
art-1f5f0f98b72530576f885ca7393d30b3ba7f40fc.tar.bz2
Merge "Explicitly mask constants in shift operations."
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/code_generator_x86.cc2
-rw-r--r--compiler/optimizing/code_generator_x86_64.cc4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 8a0c2de..4757235 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -2391,7 +2391,7 @@ void InstructionCodeGeneratorX86::HandleShift(HBinaryOperation* op) {
__ shrl(first_reg, second_reg);
}
} else {
- Immediate imm(second.GetConstant()->AsIntConstant()->GetValue());
+ Immediate imm(second.GetConstant()->AsIntConstant()->GetValue() & kMaxIntShiftValue);
if (op->IsShl()) {
__ shll(first_reg, imm);
} else if (op->IsShr()) {
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 233f4a4..f8651f6 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -2223,7 +2223,7 @@ void InstructionCodeGeneratorX86_64::HandleShift(HBinaryOperation* op) {
__ shrl(first_reg, second_reg);
}
} else {
- Immediate imm(second.GetConstant()->AsIntConstant()->GetValue());
+ Immediate imm(second.GetConstant()->AsIntConstant()->GetValue() & kMaxIntShiftValue);
if (op->IsShl()) {
__ shll(first_reg, imm);
} else if (op->IsShr()) {
@@ -2245,7 +2245,7 @@ void InstructionCodeGeneratorX86_64::HandleShift(HBinaryOperation* op) {
__ shrq(first_reg, second_reg);
}
} else {
- Immediate imm(second.GetConstant()->AsIntConstant()->GetValue());
+ Immediate imm(second.GetConstant()->AsIntConstant()->GetValue() & kMaxLongShiftValue);
if (op->IsShl()) {
__ shlq(first_reg, imm);
} else if (op->IsShr()) {