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

Unified Diff: src/mips64/macro-assembler-mips64.cc

Issue 2556793003: MIPS[64]: Fix `MIPS: Improve Float(32|64)(Max|Min)`. (Closed)
Patch Set: Modified according comments. Created 4 years 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/mips/macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/macro-assembler-mips64.cc
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc
index fbbb8b75d7a070c4a70754a0727091f4c5e08bba..54b40b3fe05485a7258d0bdf439011808b7d68aa 100644
--- a/src/mips64/macro-assembler-mips64.cc
+++ b/src/mips64/macro-assembler-mips64.cc
@@ -6302,7 +6302,10 @@ void MacroAssembler::JumpIfNotBothSequentialOneByteStrings(Register first,
void MacroAssembler::Float32Max(FPURegister dst, FPURegister src1,
FPURegister src2, Label* out_of_line) {
- DCHECK(!src1.is(src2));
+ if (src1.is(src2)) {
+ Move_s(dst, src1);
+ return;
+ }
// Check if one of operands is NaN.
BranchF32(nullptr, out_of_line, eq, src1, src2);
@@ -6312,28 +6315,20 @@ void MacroAssembler::Float32Max(FPURegister dst, FPURegister src1,
} else {
Label return_left, return_right, done;
- c(OLT, S, src1, src2);
- bc1t(&return_right);
- nop();
-
- c(OLT, S, src2, src1);
- bc1t(&return_left);
- nop();
+ BranchF32(&return_right, nullptr, lt, src1, src2);
+ BranchF32(&return_left, nullptr, lt, src2, src1);
// Operands are equal, but check for +/-0.
mfc1(t8, src1);
dsll32(t8, t8, 0);
- beq(t8, zero_reg, &return_left);
- nop();
- b(&return_right);
- nop();
+ Branch(&return_left, eq, t8, Operand(zero_reg));
+ Branch(&return_right);
bind(&return_right);
if (!src2.is(dst)) {
Move_s(dst, src2);
}
- b(&done);
- nop();
+ Branch(&done);
bind(&return_left);
if (!src1.is(dst)) {
@@ -6346,13 +6341,15 @@ void MacroAssembler::Float32Max(FPURegister dst, FPURegister src1,
void MacroAssembler::Float32MaxOutOfLine(FPURegister dst, FPURegister src1,
FPURegister src2) {
- DCHECK(!src1.is(src2));
add_s(dst, src1, src2);
}
void MacroAssembler::Float32Min(FPURegister dst, FPURegister src1,
FPURegister src2, Label* out_of_line) {
- DCHECK(!src1.is(src2));
+ if (src1.is(src2)) {
+ Move_s(dst, src1);
+ return;
+ }
// Check if one of operands is NaN.
BranchF32(nullptr, out_of_line, eq, src1, src2);
@@ -6362,28 +6359,20 @@ void MacroAssembler::Float32Min(FPURegister dst, FPURegister src1,
} else {
Label return_left, return_right, done;
- c(OLT, S, src1, src2);
- bc1t(&return_left);
- nop();
-
- c(OLT, S, src2, src1);
- bc1t(&return_right);
- nop();
+ BranchF32(&return_left, nullptr, lt, src1, src2);
+ BranchF32(&return_right, nullptr, lt, src2, src1);
// Left equals right => check for -0.
mfc1(t8, src1);
dsll32(t8, t8, 0);
- beq(t8, zero_reg, &return_right);
- nop();
- b(&return_left);
- nop();
+ Branch(&return_right, eq, t8, Operand(zero_reg));
+ Branch(&return_left);
bind(&return_right);
if (!src2.is(dst)) {
Move_s(dst, src2);
}
- b(&done);
- nop();
+ Branch(&done);
bind(&return_left);
if (!src1.is(dst)) {
@@ -6396,13 +6385,15 @@ void MacroAssembler::Float32Min(FPURegister dst, FPURegister src1,
void MacroAssembler::Float32MinOutOfLine(FPURegister dst, FPURegister src1,
FPURegister src2) {
- DCHECK(!src1.is(src2));
add_s(dst, src1, src2);
}
void MacroAssembler::Float64Max(FPURegister dst, FPURegister src1,
FPURegister src2, Label* out_of_line) {
- DCHECK(!src1.is(src2));
+ if (src1.is(src2)) {
+ Move_d(dst, src1);
+ return;
+ }
// Check if one of operands is NaN.
BranchF64(nullptr, out_of_line, eq, src1, src2);
@@ -6412,27 +6403,19 @@ void MacroAssembler::Float64Max(FPURegister dst, FPURegister src1,
} else {
Label return_left, return_right, done;
- c(OLT, D, src1, src2);
- bc1t(&return_right);
- nop();
-
- c(OLT, D, src2, src1);
- bc1t(&return_left);
- nop();
+ BranchF64(&return_right, nullptr, lt, src1, src2);
+ BranchF64(&return_left, nullptr, lt, src2, src1);
// Left equals right => check for -0.
dmfc1(t8, src1);
- beq(t8, zero_reg, &return_left);
- nop();
- b(&return_right);
- nop();
+ Branch(&return_left, eq, t8, Operand(zero_reg));
+ Branch(&return_right);
bind(&return_right);
if (!src2.is(dst)) {
Move_d(dst, src2);
}
- b(&done);
- nop();
+ Branch(&done);
bind(&return_left);
if (!src1.is(dst)) {
@@ -6445,13 +6428,15 @@ void MacroAssembler::Float64Max(FPURegister dst, FPURegister src1,
void MacroAssembler::Float64MaxOutOfLine(FPURegister dst, FPURegister src1,
FPURegister src2) {
- DCHECK(!src1.is(src2));
add_d(dst, src1, src2);
}
void MacroAssembler::Float64Min(FPURegister dst, FPURegister src1,
FPURegister src2, Label* out_of_line) {
- DCHECK(!src1.is(src2));
+ if (src1.is(src2)) {
+ Move_d(dst, src1);
+ return;
+ }
// Check if one of operands is NaN.
BranchF64(nullptr, out_of_line, eq, src1, src2);
@@ -6461,27 +6446,19 @@ void MacroAssembler::Float64Min(FPURegister dst, FPURegister src1,
} else {
Label return_left, return_right, done;
- c(OLT, D, src1, src2);
- bc1t(&return_left);
- nop();
-
- c(OLT, D, src2, src1);
- bc1t(&return_right);
- nop();
+ BranchF64(&return_left, nullptr, lt, src1, src2);
+ BranchF64(&return_right, nullptr, lt, src2, src1);
// Left equals right => check for -0.
dmfc1(t8, src1);
- beq(t8, zero_reg, &return_right);
- nop();
- b(&return_left);
- nop();
+ Branch(&return_right, eq, t8, Operand(zero_reg));
+ Branch(&return_left);
bind(&return_right);
if (!src2.is(dst)) {
Move_d(dst, src2);
}
- b(&done);
- nop();
+ Branch(&done);
bind(&return_left);
if (!src1.is(dst)) {
@@ -6494,7 +6471,6 @@ void MacroAssembler::Float64Min(FPURegister dst, FPURegister src1,
void MacroAssembler::Float64MinOutOfLine(FPURegister dst, FPURegister src1,
FPURegister src2) {
- DCHECK(!src1.is(src2));
add_d(dst, src1, src2);
}
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698