MIPS: Add rotate-right instruction to hydrogen and use it instead of bitwise operations of the form ((x >>> i) | (x << (32 - i))).

Port r12855 (be965042)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/11293140
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12971 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2012-11-15 12:41:35 +00:00
parent db4375e338
commit 5df210bd35
2 changed files with 11 additions and 0 deletions

View File

@ -1148,6 +1148,9 @@ void LCodeGen::DoShiftI(LShiftI* instr) {
// No need to mask the right operand on MIPS, it is built into the variable
// shift instructions.
switch (instr->op()) {
case Token::ROR:
__ Ror(result, left, Operand(ToRegister(right_op)));
break;
case Token::SAR:
__ srav(result, left, ToRegister(right_op));
break;
@ -1169,6 +1172,13 @@ void LCodeGen::DoShiftI(LShiftI* instr) {
int value = ToInteger32(LConstantOperand::cast(right_op));
uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
switch (instr->op()) {
case Token::ROR:
if (shift_count != 0) {
__ Ror(result, left, Operand(shift_count));
} else {
__ Move(result, left);
}
break;
case Token::SAR:
if (shift_count != 0) {
__ sra(result, left, shift_count);

View File

@ -177,6 +177,7 @@ const char* LArithmeticT::Mnemonic() const {
case Token::BIT_AND: return "bit-and-t";
case Token::BIT_OR: return "bit-or-t";
case Token::BIT_XOR: return "bit-xor-t";
case Token::ROR: return "ror-t";
case Token::SHL: return "sll-t";
case Token::SAR: return "sra-t";
case Token::SHR: return "srl-t";