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

Side by Side Diff: src/compiler/mips/instruction-selector-mips.cc

Issue 1503053002: MIPS: [turbofan] Make Int32Div and Uint32Div safe. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-mips64.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 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 void InstructionSelector::VisitUint32MulHigh(Node* node) { 435 void InstructionSelector::VisitUint32MulHigh(Node* node) {
436 MipsOperandGenerator g(this); 436 MipsOperandGenerator g(this);
437 Emit(kMipsMulHighU, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 437 Emit(kMipsMulHighU, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)),
438 g.UseRegister(node->InputAt(1))); 438 g.UseRegister(node->InputAt(1)));
439 } 439 }
440 440
441 441
442 void InstructionSelector::VisitInt32Div(Node* node) { 442 void InstructionSelector::VisitInt32Div(Node* node) {
443 MipsOperandGenerator g(this); 443 MipsOperandGenerator g(this);
444 Int32BinopMatcher m(node); 444 Int32BinopMatcher m(node);
445 Emit(kMipsDiv, g.DefineAsRegister(node), g.UseRegister(m.left().node()), 445 Emit(kMipsDiv, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()),
446 g.UseRegister(m.right().node())); 446 g.UseRegister(m.right().node()));
447 } 447 }
448 448
449 449
450 void InstructionSelector::VisitUint32Div(Node* node) { 450 void InstructionSelector::VisitUint32Div(Node* node) {
451 MipsOperandGenerator g(this); 451 MipsOperandGenerator g(this);
452 Int32BinopMatcher m(node); 452 Int32BinopMatcher m(node);
453 Emit(kMipsDivU, g.DefineAsRegister(node), g.UseRegister(m.left().node()), 453 Emit(kMipsDivU, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()),
454 g.UseRegister(m.right().node())); 454 g.UseRegister(m.right().node()));
455 } 455 }
456 456
457 457
458 void InstructionSelector::VisitInt32Mod(Node* node) { 458 void InstructionSelector::VisitInt32Mod(Node* node) {
459 MipsOperandGenerator g(this); 459 MipsOperandGenerator g(this);
460 Int32BinopMatcher m(node); 460 Int32BinopMatcher m(node);
461 Emit(kMipsMod, g.DefineAsRegister(node), g.UseRegister(m.left().node()), 461 Emit(kMipsMod, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
462 g.UseRegister(m.right().node())); 462 g.UseRegister(m.right().node()));
463 } 463 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 MachineOperatorBuilder::Flags 1212 MachineOperatorBuilder::Flags
1213 InstructionSelector::SupportedMachineOperatorFlags() { 1213 InstructionSelector::SupportedMachineOperatorFlags() {
1214 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags; 1214 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags;
1215 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && 1215 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) &&
1216 IsFp64Mode()) { 1216 IsFp64Mode()) {
1217 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1217 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1218 MachineOperatorBuilder::kFloat64RoundUp | 1218 MachineOperatorBuilder::kFloat64RoundUp |
1219 MachineOperatorBuilder::kFloat64RoundTruncate | 1219 MachineOperatorBuilder::kFloat64RoundTruncate |
1220 MachineOperatorBuilder::kFloat64RoundTiesEven; 1220 MachineOperatorBuilder::kFloat64RoundTiesEven;
1221 } 1221 }
1222 return flags | MachineOperatorBuilder::kWord32ShiftIsSafe | 1222 return flags | MachineOperatorBuilder::kInt32DivIsSafe |
1223 MachineOperatorBuilder::kUint32DivIsSafe |
1224 MachineOperatorBuilder::kWord32ShiftIsSafe |
1223 MachineOperatorBuilder::kFloat64Min | 1225 MachineOperatorBuilder::kFloat64Min |
1224 MachineOperatorBuilder::kFloat64Max | 1226 MachineOperatorBuilder::kFloat64Max |
1225 MachineOperatorBuilder::kFloat32Min | 1227 MachineOperatorBuilder::kFloat32Min |
1226 MachineOperatorBuilder::kFloat32Max | 1228 MachineOperatorBuilder::kFloat32Max |
1227 MachineOperatorBuilder::kFloat32RoundDown | 1229 MachineOperatorBuilder::kFloat32RoundDown |
1228 MachineOperatorBuilder::kFloat32RoundUp | 1230 MachineOperatorBuilder::kFloat32RoundUp |
1229 MachineOperatorBuilder::kFloat32RoundTruncate | 1231 MachineOperatorBuilder::kFloat32RoundTruncate |
1230 MachineOperatorBuilder::kFloat32RoundTiesEven; 1232 MachineOperatorBuilder::kFloat32RoundTiesEven;
1231 } 1233 }
1232 1234
1233 } // namespace compiler 1235 } // namespace compiler
1234 } // namespace internal 1236 } // namespace internal
1235 } // namespace v8 1237 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698