Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index dba1fae9759f0e323e72a23a443192cca9d9f6f9..95a0064f62715cbc55c0d3e01473297bfbec56ba 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -1915,8 +1915,6 @@ void MacroAssembler::Ins(Register rt, |
} |
void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { |
- Register scratch1 = t8; |
- Register scratch2 = t9; |
if (IsMipsArchVariant(kMips32r2)) { |
Label is_nan, done; |
Register scratch1 = t8; |
@@ -1926,7 +1924,6 @@ void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { |
// For NaN input, neg_s will return the same NaN value, |
// while the sign has to be changed separately. |
neg_s(fd, fs); // In delay slot. |
- |
bind(&is_nan); |
mfc1(scratch1, fs); |
And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
@@ -1936,26 +1933,21 @@ void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { |
mtc1(scratch2, fd); |
bind(&done); |
} else { |
- mfc1(scratch1, fs); |
- And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
- And(scratch1, scratch1, Operand(kBinary32SignMask)); |
- Xor(scratch1, scratch1, Operand(kBinary32SignMask)); |
- Or(scratch2, scratch2, scratch1); |
- mtc1(scratch2, fd); |
+ // r6 neg_s changes the sign for NaN-like operands as well. |
+ neg_s(fd, fs); |
} |
} |
void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { |
- Register scratch1 = t8; |
- Register scratch2 = t9; |
if (IsMipsArchVariant(kMips32r2)) { |
Label is_nan, done; |
+ Register scratch1 = t8; |
+ Register scratch2 = t9; |
BranchF64(nullptr, &is_nan, eq, fs, fs); |
Branch(USE_DELAY_SLOT, &done); |
// For NaN input, neg_d will return the same NaN value, |
// while the sign has to be changed separately. |
neg_d(fd, fs); // In delay slot. |
- |
bind(&is_nan); |
Mfhc1(scratch1, fs); |
And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
@@ -1965,13 +1957,8 @@ void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { |
Mthc1(scratch2, fd); |
bind(&done); |
} else { |
- Move_d(fd, fs); |
- Mfhc1(scratch1, fs); |
- And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
- And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
- Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
- Or(scratch2, scratch2, scratch1); |
- Mthc1(scratch2, fd); |
+ // r6 neg_d changes the sign for NaN-like operands as well. |
+ neg_d(fd, fs); |
} |
} |