Commit b55a6731 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

MIPS: Minor bug fixes to macro-asm and simulator.

3 small fixes:
  - Fix erroneous use of reg t6 in macro-assembler.
  - Minor optimization to overflow-check macros.
  - Fix un-init var use (typo) in simulator FPCall handling.

None of these affected test cases.

BUG=
TEST=

Review URL: http://codereview.chromium.org//7236025
Patch from Paul Lind <plind44@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8418 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9310a8d7
...@@ -837,11 +837,11 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, FPURegister fs) { ...@@ -837,11 +837,11 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, FPURegister fs) {
void MacroAssembler::Trunc_uw_d(FPURegister fd, Register rs) { void MacroAssembler::Trunc_uw_d(FPURegister fd, Register rs) {
ASSERT(!fd.is(f22)); ASSERT(!fd.is(f22));
ASSERT(!rs.is(t6)); ASSERT(!rs.is(t8));
// Load 2^31 into f22. // Load 2^31 into f22.
Or(t6, zero_reg, 0x80000000); Or(t8, zero_reg, 0x80000000);
Cvt_d_uw(f22, t6); Cvt_d_uw(f22, t8);
// Test if f22 > fd. // Test if f22 > fd.
c(OLT, D, fd, f22); c(OLT, D, fd, f22);
...@@ -856,7 +856,7 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, Register rs) { ...@@ -856,7 +856,7 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, Register rs) {
sub_d(f22, fd, f22); sub_d(f22, fd, f22);
trunc_w_d(f22, f22); trunc_w_d(f22, f22);
mfc1(rs, f22); mfc1(rs, f22);
or_(rs, rs, t6); or_(rs, rs, t8);
Label done; Label done;
Branch(&done); Branch(&done);
...@@ -2563,8 +2563,8 @@ void MacroAssembler::AllocateHeapNumberWithValue(Register result, ...@@ -2563,8 +2563,8 @@ void MacroAssembler::AllocateHeapNumberWithValue(Register result,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
LoadRoot(t6, Heap::kHeapNumberMapRootIndex); LoadRoot(t8, Heap::kHeapNumberMapRootIndex);
AllocateHeapNumber(result, scratch1, scratch2, t6, gc_required); AllocateHeapNumber(result, scratch1, scratch2, t8, gc_required);
sdc1(value, FieldMemOperand(result, HeapNumber::kValueOffset)); sdc1(value, FieldMemOperand(result, HeapNumber::kValueOffset));
} }
...@@ -3248,23 +3248,18 @@ void MacroAssembler::AdduAndCheckForOverflow(Register dst, ...@@ -3248,23 +3248,18 @@ void MacroAssembler::AdduAndCheckForOverflow(Register dst,
ASSERT(!overflow_dst.is(right)); ASSERT(!overflow_dst.is(right));
ASSERT(!left.is(right)); ASSERT(!left.is(right));
// TODO(kalmard) There must be a way to optimize dst == left and dst == right
// cases.
if (dst.is(left)) { if (dst.is(left)) {
addu(overflow_dst, left, right); mov(scratch, left); // Preserve left.
xor_(dst, overflow_dst, left); addu(dst, left, right); // Left is overwritten.
xor_(scratch, overflow_dst, right); xor_(scratch, dst, scratch); // Original left.
and_(scratch, scratch, dst); xor_(overflow_dst, dst, right);
mov(dst, overflow_dst); and_(overflow_dst, overflow_dst, scratch);
mov(overflow_dst, scratch);
} else if (dst.is(right)) { } else if (dst.is(right)) {
addu(overflow_dst, left, right); mov(scratch, right); // Preserve right.
xor_(dst, overflow_dst, right); addu(dst, left, right); // Right is overwritten.
xor_(scratch, overflow_dst, left); xor_(scratch, dst, scratch); // Original right.
and_(scratch, scratch, dst); xor_(overflow_dst, dst, left);
mov(dst, overflow_dst); and_(overflow_dst, overflow_dst, scratch);
mov(overflow_dst, scratch);
} else { } else {
addu(dst, left, right); addu(dst, left, right);
xor_(overflow_dst, dst, left); xor_(overflow_dst, dst, left);
...@@ -3288,23 +3283,18 @@ void MacroAssembler::SubuAndCheckForOverflow(Register dst, ...@@ -3288,23 +3283,18 @@ void MacroAssembler::SubuAndCheckForOverflow(Register dst,
ASSERT(!scratch.is(left)); ASSERT(!scratch.is(left));
ASSERT(!scratch.is(right)); ASSERT(!scratch.is(right));
// TODO(kalmard) There must be a way to optimize dst == left and dst == right
// cases.
if (dst.is(left)) { if (dst.is(left)) {
subu(overflow_dst, left, right); mov(scratch, left); // Preserve left.
xor_(scratch, overflow_dst, left); subu(dst, left, right); // Left is overwritten.
xor_(dst, left, right); xor_(overflow_dst, dst, scratch); // scratch is original left.
and_(scratch, scratch, dst); xor_(scratch, scratch, right); // scratch is original left.
mov(dst, overflow_dst); and_(overflow_dst, scratch, overflow_dst);
mov(overflow_dst, scratch);
} else if (dst.is(right)) { } else if (dst.is(right)) {
subu(overflow_dst, left, right); mov(scratch, right); // Preserve right.
xor_(dst, left, right); subu(dst, left, right); // Right is overwritten.
xor_(scratch, overflow_dst, left); xor_(overflow_dst, dst, left);
and_(scratch, scratch, dst); xor_(scratch, left, scratch); // Original right.
mov(dst, overflow_dst); and_(overflow_dst, scratch, overflow_dst);
mov(overflow_dst, scratch);
} else { } else {
subu(dst, left, right); subu(dst, left, right);
xor_(overflow_dst, dst, left); xor_(overflow_dst, dst, left);
......
...@@ -1484,7 +1484,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { ...@@ -1484,7 +1484,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
case ExternalReference::BUILTIN_FP_CALL: case ExternalReference::BUILTIN_FP_CALL:
GetFpArgs(&dval0); GetFpArgs(&dval0);
PrintF("Call to host function at %p with arg %f", PrintF("Call to host function at %p with arg %f",
FUNCTION_ADDR(target), dval1); FUNCTION_ADDR(target), dval0);
break; break;
case ExternalReference::BUILTIN_FP_INT_CALL: case ExternalReference::BUILTIN_FP_INT_CALL:
GetFpArgs(&dval0, &ival); GetFpArgs(&dval0, &ival);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment