Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index bea7bc4a84cf876abc4afb680e625b70db6c3821..18d58ae1f4d31fe860284eba2f2b846e1379e5e8 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1367,7 +1367,9 @@ void LCodeGen::DoDivI(LDivI* instr) { |
} |
if (test_value != 0) { |
- if (instr->hydrogen()->CheckFlag( |
+ if (instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
+ __ sar(dividend, power); |
+ } else if (instr->hydrogen()->CheckFlag( |
HInstruction::kAllUsesTruncatingToInt32)) { |
Label done, negative; |
__ cmp(dividend, 0); |
@@ -1429,9 +1431,15 @@ void LCodeGen::DoDivI(LDivI* instr) { |
__ bind(&left_not_min_int); |
} |
- // Sign extend to edx. |
- __ cdq(); |
- __ idiv(right_reg); |
+ if (instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
+ // Zero out edx (don't use cdq, this is unsigned). |
+ __ xor_(edx, edx); |
+ __ div(right_reg); |
+ } else { |
+ // Sign extend to edx. |
+ __ cdq(); |
+ __ idiv(right_reg); |
+ } |
if (instr->is_flooring()) { |
Label done; |
@@ -2314,7 +2322,9 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
LOperand* right = instr->right(); |
int false_block = chunk_->LookupDestination(instr->false_block_id()); |
int true_block = chunk_->LookupDestination(instr->true_block_id()); |
- Condition cc = TokenToCondition(instr->op(), instr->is_double()); |
+ bool is_unsigned = |
+ instr->is_double() || instr->hydrogen()->CheckFlag(HInstruction::kUint32); |
+ Condition cc = TokenToCondition(instr->op(), is_unsigned); |
if (left->IsConstantOperand() && right->IsConstantOperand()) { |
// We can statically evaluate the comparison. |