Commit e99b9272 authored by danno@chromium.org's avatar danno@chromium.org

MIPS: Fix for Ins macro-assembler instruction for non-mips32r2 platforms.

BUG=
TEST=

Review URL: http://codereview.chromium.org/8520023
Patch from Gergely Kis <gergely@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10015 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cfc54e4d
...@@ -910,34 +910,21 @@ void MacroAssembler::Ins(Register rt, ...@@ -910,34 +910,21 @@ void MacroAssembler::Ins(Register rt,
uint16_t pos, uint16_t pos,
uint16_t size) { uint16_t size) {
ASSERT(pos < 32); ASSERT(pos < 32);
ASSERT(pos + size < 32); ASSERT(pos + size <= 32);
ASSERT(size != 0);
if (mips32r2) { if (mips32r2) {
ins_(rt, rs, pos, size); ins_(rt, rs, pos, size);
} else { } else {
ASSERT(!rt.is(t8) && !rs.is(t8)); ASSERT(!rt.is(t8) && !rs.is(t8));
Subu(at, zero_reg, Operand(1));
srl(t8, rt, pos + size); srl(at, at, 32 - size);
// The left chunk from rt that needs to and_(t8, rs, at);
// be saved is on the right side of t8. sll(t8, t8, pos);
sll(at, t8, pos + size); sll(at, at, pos);
// The 'at' register now contains the left chunk on nor(at, at, zero_reg);
// the left (proper position) and zeroes. and_(at, rt, at);
sll(t8, rt, 32 - pos); or_(rt, t8, at);
// t8 now contains the right chunk on the left and zeroes.
srl(t8, t8, 32 - pos);
// t8 now contains the right chunk on
// the right (proper position) and zeroes.
or_(rt, at, t8);
// rt now contains the left and right chunks from the original rt
// in their proper position and zeroes in the middle.
sll(t8, rs, 32 - size);
// t8 now contains the chunk from rs on the left and zeroes.
srl(t8, t8, 32 - size - pos);
// t8 now contains the original chunk from rs in
// the middle (proper position).
or_(rt, rt, t8);
// rt now contains the result of the ins instruction in R2 mode.
} }
} }
......
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