OLD | NEW |
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/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 Emit(kMipsCvtSD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 395 Emit(kMipsCvtSD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 void InstructionSelector::VisitFloat64Add(Node* node) { | 399 void InstructionSelector::VisitFloat64Add(Node* node) { |
400 VisitRRR(this, kMipsAddD, node); | 400 VisitRRR(this, kMipsAddD, node); |
401 } | 401 } |
402 | 402 |
403 | 403 |
404 void InstructionSelector::VisitFloat64Sub(Node* node) { | 404 void InstructionSelector::VisitFloat64Sub(Node* node) { |
| 405 MipsOperandGenerator g(this); |
| 406 Float64BinopMatcher m(node); |
| 407 if (m.left().IsMinusZero() && m.right().IsFloat64RoundDown() && |
| 408 CanCover(m.node(), m.right().node())) { |
| 409 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && |
| 410 CanCover(m.right().node(), m.right().InputAt(0))) { |
| 411 Float64BinopMatcher mright0(m.right().InputAt(0)); |
| 412 if (mright0.left().IsMinusZero()) { |
| 413 Emit(kMipsFloat64RoundUp, g.DefineAsRegister(node), |
| 414 g.UseRegister(mright0.right().node())); |
| 415 return; |
| 416 } |
| 417 } |
| 418 } |
405 VisitRRR(this, kMipsSubD, node); | 419 VisitRRR(this, kMipsSubD, node); |
406 } | 420 } |
407 | 421 |
408 | 422 |
409 void InstructionSelector::VisitFloat64Mul(Node* node) { | 423 void InstructionSelector::VisitFloat64Mul(Node* node) { |
410 VisitRRR(this, kMipsMulD, node); | 424 VisitRRR(this, kMipsMulD, node); |
411 } | 425 } |
412 | 426 |
413 | 427 |
414 void InstructionSelector::VisitFloat64Div(Node* node) { | 428 void InstructionSelector::VisitFloat64Div(Node* node) { |
415 VisitRRR(this, kMipsDivD, node); | 429 VisitRRR(this, kMipsDivD, node); |
416 } | 430 } |
417 | 431 |
418 | 432 |
419 void InstructionSelector::VisitFloat64Mod(Node* node) { | 433 void InstructionSelector::VisitFloat64Mod(Node* node) { |
420 MipsOperandGenerator g(this); | 434 MipsOperandGenerator g(this); |
421 Emit(kMipsModD, g.DefineAsFixed(node, f0), g.UseFixed(node->InputAt(0), f12), | 435 Emit(kMipsModD, g.DefineAsFixed(node, f0), g.UseFixed(node->InputAt(0), f12), |
422 g.UseFixed(node->InputAt(1), f14))->MarkAsCall(); | 436 g.UseFixed(node->InputAt(1), f14))->MarkAsCall(); |
423 } | 437 } |
424 | 438 |
425 | 439 |
426 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 440 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
427 MipsOperandGenerator g(this); | 441 MipsOperandGenerator g(this); |
428 Emit(kMipsSqrtD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 442 Emit(kMipsSqrtD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
429 } | 443 } |
430 | 444 |
431 | 445 |
432 void InstructionSelector::VisitFloat64Floor(Node* node) { | 446 void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
433 VisitRR(this, kMipsFloat64Floor, node); | 447 VisitRR(this, kMipsFloat64RoundDown, node); |
434 } | 448 } |
435 | 449 |
436 | 450 |
437 void InstructionSelector::VisitFloat64Ceil(Node* node) { | |
438 VisitRR(this, kMipsFloat64Ceil, node); | |
439 } | |
440 | |
441 | |
442 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 451 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
443 VisitRR(this, kMipsFloat64RoundTruncate, node); | 452 VisitRR(this, kMipsFloat64RoundTruncate, node); |
444 } | 453 } |
445 | 454 |
446 | 455 |
447 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 456 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
448 UNREACHABLE(); | 457 UNREACHABLE(); |
449 } | 458 } |
450 | 459 |
451 | 460 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 Node* right = node->InputAt(1); | 923 Node* right = node->InputAt(1); |
915 Emit(kMipsFmoveHighDUw, g.DefineSameAsFirst(node), g.UseRegister(left), | 924 Emit(kMipsFmoveHighDUw, g.DefineSameAsFirst(node), g.UseRegister(left), |
916 g.UseRegister(right)); | 925 g.UseRegister(right)); |
917 } | 926 } |
918 | 927 |
919 | 928 |
920 // static | 929 // static |
921 MachineOperatorBuilder::Flags | 930 MachineOperatorBuilder::Flags |
922 InstructionSelector::SupportedMachineOperatorFlags() { | 931 InstructionSelector::SupportedMachineOperatorFlags() { |
923 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { | 932 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
924 return MachineOperatorBuilder::kFloat64Floor | | 933 return MachineOperatorBuilder::kFloat64RoundDown | |
925 MachineOperatorBuilder::kFloat64Ceil | | |
926 MachineOperatorBuilder::kFloat64RoundTruncate; | 934 MachineOperatorBuilder::kFloat64RoundTruncate; |
927 } | 935 } |
928 return MachineOperatorBuilder::kNoFlags; | 936 return MachineOperatorBuilder::kNoFlags; |
929 } | 937 } |
930 | 938 |
931 } // namespace compiler | 939 } // namespace compiler |
932 } // namespace internal | 940 } // namespace internal |
933 } // namespace v8 | 941 } // namespace v8 |
OLD | NEW |