Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 11293140: MIPS: Add rotate-right instruction to hydrogen and use it instead of bitwise operations of the form… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on r12963 Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/lithium-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so 1133 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so
1134 // result may alias either of them. 1134 // result may alias either of them.
1135 LOperand* right_op = instr->right(); 1135 LOperand* right_op = instr->right();
1136 Register left = ToRegister(instr->left()); 1136 Register left = ToRegister(instr->left());
1137 Register result = ToRegister(instr->result()); 1137 Register result = ToRegister(instr->result());
1138 1138
1139 if (right_op->IsRegister()) { 1139 if (right_op->IsRegister()) {
1140 // No need to mask the right operand on MIPS, it is built into the variable 1140 // No need to mask the right operand on MIPS, it is built into the variable
1141 // shift instructions. 1141 // shift instructions.
1142 switch (instr->op()) { 1142 switch (instr->op()) {
1143 case Token::ROR:
1144 __ Ror(result, left, Operand(ToRegister(right_op)));
1145 break;
1143 case Token::SAR: 1146 case Token::SAR:
1144 __ srav(result, left, ToRegister(right_op)); 1147 __ srav(result, left, ToRegister(right_op));
1145 break; 1148 break;
1146 case Token::SHR: 1149 case Token::SHR:
1147 __ srlv(result, left, ToRegister(right_op)); 1150 __ srlv(result, left, ToRegister(right_op));
1148 if (instr->can_deopt()) { 1151 if (instr->can_deopt()) {
1149 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); 1152 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg));
1150 } 1153 }
1151 break; 1154 break;
1152 case Token::SHL: 1155 case Token::SHL:
1153 __ sllv(result, left, ToRegister(right_op)); 1156 __ sllv(result, left, ToRegister(right_op));
1154 break; 1157 break;
1155 default: 1158 default:
1156 UNREACHABLE(); 1159 UNREACHABLE();
1157 break; 1160 break;
1158 } 1161 }
1159 } else { 1162 } else {
1160 // Mask the right_op operand. 1163 // Mask the right_op operand.
1161 int value = ToInteger32(LConstantOperand::cast(right_op)); 1164 int value = ToInteger32(LConstantOperand::cast(right_op));
1162 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); 1165 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1163 switch (instr->op()) { 1166 switch (instr->op()) {
1167 case Token::ROR:
1168 if (shift_count != 0) {
1169 __ Ror(result, left, Operand(shift_count));
1170 } else {
1171 __ Move(result, left);
1172 }
1173 break;
1164 case Token::SAR: 1174 case Token::SAR:
1165 if (shift_count != 0) { 1175 if (shift_count != 0) {
1166 __ sra(result, left, shift_count); 1176 __ sra(result, left, shift_count);
1167 } else { 1177 } else {
1168 __ Move(result, left); 1178 __ Move(result, left);
1169 } 1179 }
1170 break; 1180 break;
1171 case Token::SHR: 1181 case Token::SHR:
1172 if (shift_count != 0) { 1182 if (shift_count != 0) {
1173 __ srl(result, left, shift_count); 1183 __ srl(result, left, shift_count);
(...skipping 4286 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 __ Subu(scratch, result, scratch); 5470 __ Subu(scratch, result, scratch);
5461 __ lw(result, FieldMemOperand(scratch, 5471 __ lw(result, FieldMemOperand(scratch,
5462 FixedArray::kHeaderSize - kPointerSize)); 5472 FixedArray::kHeaderSize - kPointerSize));
5463 __ bind(&done); 5473 __ bind(&done);
5464 } 5474 }
5465 5475
5466 5476
5467 #undef __ 5477 #undef __
5468 5478
5469 } } // namespace v8::internal 5479 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698