Reviewers: ulan, danno, Paul Lind, kisg,
Description:
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=
Please review this at https://chromiumcodereview.appspot.com/11293140/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/mips/lithium-codegen-mips.cc
M src/mips/lithium-mips.cc
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
7ae33429b2bfdcfd067dba531c75f44a0e2ad56e..301a6ac8e20aa63e91092ace4ae0298f87dadc31
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -1140,6 +1140,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;
@@ -1161,6 +1164,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);
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index
6dbb6a6b563d6f0f2599aa89b36aa79a92c798fa..74906e993faaa2ddbd412696687e21d581ef7632
100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -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";
@@ -1108,6 +1109,11 @@ LInstruction*
LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
}
+LInstruction* LChunkBuilder::DoRor(HRor* instr) {
+ return DoShift(Token::ROR, instr);
+}
+
+
LInstruction* LChunkBuilder::DoShr(HShr* instr) {
return DoShift(Token::SHR, instr);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev