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

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

Issue 426863006: MIPS64: Add support for architecture revision 6. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 5 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/mips64/full-codegen-mips64.cc ('k') | src/mips64/lithium-mips64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/lithium-codegen-mips64.cc
diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc
index 4a625610d879295c86a0dbd00ab0bb0462c48483..d1bdacd680b346c76c931136973ab53953742f73 100644
--- a/src/mips64/lithium-codegen-mips64.cc
+++ b/src/mips64/lithium-codegen-mips64.cc
@@ -1119,7 +1119,7 @@ void LCodeGen::DoModI(LModI* instr) {
const Register result_reg = ToRegister(instr->result());
// div runs in the background while we check for special cases.
- __ ddiv(left_reg, right_reg);
+ __ Dmod(result_reg, left_reg, right_reg);
Label done;
// Check for x % 0, we have to deopt in this case because we can't return a
@@ -1144,8 +1144,7 @@ void LCodeGen::DoModI(LModI* instr) {
}
// If we care about -0, test if the dividend is <0 and the result is 0.
- __ Branch(USE_DELAY_SLOT, &done, ge, left_reg, Operand(zero_reg));
- __ mfhi(result_reg);
+ __ Branch(&done, ge, left_reg, Operand(zero_reg));
if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
DeoptimizeIf(eq, instr->environment(), result_reg, Operand(zero_reg));
@@ -1235,7 +1234,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
// On MIPS div is asynchronous - it will run in the background while we
// check for special cases.
- __ ddiv(dividend, divisor);
+ __ Ddiv(result, dividend, divisor);
// Check for x / 0.
if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) {
@@ -1260,11 +1259,14 @@ void LCodeGen::DoDivI(LDivI* instr) {
}
if (!hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) {
- __ mfhi(result);
- DeoptimizeIf(ne, instr->environment(), result, Operand(zero_reg));
- __ mflo(result);
- } else {
- __ mflo(result);
+ // Calculate remainder.
+ Register remainder = ToRegister(instr->temp());
+ if (kArchVariant != kMips64r6) {
+ __ mfhi(remainder);
+ } else {
+ __ dmod(remainder, dividend, divisor);
+ }
+ DeoptimizeIf(ne, instr->environment(), remainder, Operand(zero_reg));
}
}
@@ -1391,7 +1393,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
// On MIPS div is asynchronous - it will run in the background while we
// check for special cases.
- __ ddiv(dividend, divisor);
+ __ Ddiv(result, dividend, divisor);
// Check for x / 0.
if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) {
@@ -1418,8 +1420,11 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
// We performed a truncating division. Correct the result if necessary.
Label done;
Register remainder = scratch0();
- __ mfhi(remainder);
- __ mflo(result);
+ if (kArchVariant != kMips64r6) {
+ __ mfhi(remainder);
+ } else {
+ __ dmod(remainder, dividend, divisor);
+ }
__ Branch(&done, eq, remainder, Operand(zero_reg), USE_DELAY_SLOT);
__ Xor(remainder, remainder, Operand(divisor));
__ Branch(&done, ge, remainder, Operand(zero_reg));
@@ -1507,21 +1512,16 @@ void LCodeGen::DoMulI(LMulI* instr) {
if (overflow) {
// hi:lo = left * right.
if (instr->hydrogen()->representation().IsSmi()) {
- __ SmiUntag(result, left);
- __ dmult(result, right);
- __ mfhi(scratch);
- __ mflo(result);
+ __ Dmulh(result, left, right);
} else {
- __ dmult(left, right);
- __ mfhi(scratch);
- __ mflo(result);
+ __ Dmul(result, left, right);
}
- __ dsra32(at, result, 31);
- DeoptimizeIf(ne, instr->environment(), scratch, Operand(at));
- if (!instr->hydrogen()->representation().IsSmi()) {
- DeoptimizeIf(gt, instr->environment(), result, Operand(kMaxInt));
- DeoptimizeIf(lt, instr->environment(), result, Operand(kMinInt));
+ __ dsra32(scratch, result, 0);
+ __ sra(at, result, 31);
+ if (instr->hydrogen()->representation().IsSmi()) {
+ __ SmiTag(result);
}
+ DeoptimizeIf(ne, instr->environment(), scratch, Operand(at));
} else {
if (instr->hydrogen()->representation().IsSmi()) {
__ SmiUntag(result, left);
« no previous file with comments | « src/mips64/full-codegen-mips64.cc ('k') | src/mips64/lithium-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698