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

Side by Side Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 2871663002: MIPS64: Add/fix bit insertion/extraction instrs. (Closed)
Patch Set: Remove pps variable use Created 3 years, 7 months 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
« no previous file with comments | « no previous file | src/mips64/assembler-mips64.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 break; 1209 break;
1210 case kMips64Ins: 1210 case kMips64Ins:
1211 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) { 1211 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) {
1212 __ Ins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2)); 1212 __ Ins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2));
1213 } else { 1213 } else {
1214 __ Ins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), 1214 __ Ins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1215 i.InputInt8(2)); 1215 i.InputInt8(2));
1216 } 1216 }
1217 break; 1217 break;
1218 case kMips64Dext: { 1218 case kMips64Dext: {
1219 int16_t pos = i.InputInt8(1); 1219 __ Dext(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1220 int16_t size = i.InputInt8(2); 1220 i.InputInt8(2));
1221 if (size > 0 && size <= 32 && pos >= 0 && pos < 32) {
1222 __ Dext(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1223 i.InputInt8(2));
1224 } else if (size > 32 && size <= 64 && pos >= 0 && pos < 32) {
1225 __ Dextm(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1226 i.InputInt8(2));
1227 } else {
1228 DCHECK(size > 0 && size <= 32 && pos >= 32 && pos < 64);
1229 __ Dextu(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1230 i.InputInt8(2));
1231 }
1232 break; 1221 break;
1233 } 1222 }
1234 case kMips64Dins: 1223 case kMips64Dins:
1235 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) { 1224 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) {
1236 __ Dins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2)); 1225 __ Dins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2));
1237 } else { 1226 } else {
1238 __ Dins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), 1227 __ Dins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1),
1239 i.InputInt8(2)); 1228 i.InputInt8(2));
1240 } 1229 }
1241 break; 1230 break;
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 // MIPS does not have condition code flags, so compare and branch are 2397 // MIPS does not have condition code flags, so compare and branch are
2409 // implemented differently than on the other arch's. The compare operations 2398 // implemented differently than on the other arch's. The compare operations
2410 // emit mips pseudo-instructions, which are checked and handled here. 2399 // emit mips pseudo-instructions, which are checked and handled here.
2411 2400
2412 if (instr->arch_opcode() == kMips64Tst) { 2401 if (instr->arch_opcode() == kMips64Tst) {
2413 cc = FlagsConditionToConditionTst(condition); 2402 cc = FlagsConditionToConditionTst(condition);
2414 if (instr->InputAt(1)->IsImmediate() && 2403 if (instr->InputAt(1)->IsImmediate() &&
2415 base::bits::IsPowerOfTwo64(i.InputOperand(1).immediate())) { 2404 base::bits::IsPowerOfTwo64(i.InputOperand(1).immediate())) {
2416 uint16_t pos = 2405 uint16_t pos =
2417 base::bits::CountTrailingZeros64(i.InputOperand(1).immediate()); 2406 base::bits::CountTrailingZeros64(i.InputOperand(1).immediate());
2418 __ ExtractBits(result, i.InputRegister(0), pos, 1); 2407 __ Dext(result, i.InputRegister(0), pos, 1);
2419 } else { 2408 } else {
2420 __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1)); 2409 __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1));
2421 __ Sltu(result, zero_reg, kScratchReg); 2410 __ Sltu(result, zero_reg, kScratchReg);
2422 } 2411 }
2423 if (cc == eq) { 2412 if (cc == eq) {
2424 // Sltu produces 0 for equality, invert the result. 2413 // Sltu produces 0 for equality, invert the result.
2425 __ xori(result, result, 1); 2414 __ xori(result, result, 1);
2426 } 2415 }
2427 return; 2416 return;
2428 } else if (instr->arch_opcode() == kMips64Dadd || 2417 } else if (instr->arch_opcode() == kMips64Dadd ||
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 padding_size -= v8::internal::Assembler::kInstrSize; 2929 padding_size -= v8::internal::Assembler::kInstrSize;
2941 } 2930 }
2942 } 2931 }
2943 } 2932 }
2944 2933
2945 #undef __ 2934 #undef __
2946 2935
2947 } // namespace compiler 2936 } // namespace compiler
2948 } // namespace internal 2937 } // namespace internal
2949 } // namespace v8 2938 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698