Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: src/ia32/lithium-codegen-ia32.cc

Issue 288853003: Allow div and cmp to work in uint32 mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698