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

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

Issue 1046893002: [x64] Match -0 - x with sign bit flip. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unittest Created 5 years, 8 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 | « src/compiler/x64/instruction-codes-x64.h ('k') | test/cctest/compiler/test-run-machops.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 <algorithm> 5 #include <algorithm>
6 6
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 } // namespace 852 } // namespace
853 853
854 854
855 void InstructionSelector::VisitFloat32Add(Node* node) { 855 void InstructionSelector::VisitFloat32Add(Node* node) {
856 VisitFloatBinop(this, node, kAVXFloat32Add, kSSEFloat32Add); 856 VisitFloatBinop(this, node, kAVXFloat32Add, kSSEFloat32Add);
857 } 857 }
858 858
859 859
860 void InstructionSelector::VisitFloat32Sub(Node* node) { 860 void InstructionSelector::VisitFloat32Sub(Node* node) {
861 X64OperandGenerator g(this);
862 Float32BinopMatcher m(node);
863 if (m.left().IsMinusZero()) {
864 Emit(kSSEFloat32Neg, g.DefineSameAsFirst(node),
865 g.UseRegister(m.right().node()));
866 return;
867 }
861 VisitFloatBinop(this, node, kAVXFloat32Sub, kSSEFloat32Sub); 868 VisitFloatBinop(this, node, kAVXFloat32Sub, kSSEFloat32Sub);
862 } 869 }
863 870
864 871
865 void InstructionSelector::VisitFloat32Mul(Node* node) { 872 void InstructionSelector::VisitFloat32Mul(Node* node) {
866 VisitFloatBinop(this, node, kAVXFloat32Mul, kSSEFloat32Mul); 873 VisitFloatBinop(this, node, kAVXFloat32Mul, kSSEFloat32Mul);
867 } 874 }
868 875
869 876
870 void InstructionSelector::VisitFloat32Div(Node* node) { 877 void InstructionSelector::VisitFloat32Div(Node* node) {
(...skipping 18 matching lines...) Expand all
889 896
890 897
891 void InstructionSelector::VisitFloat64Add(Node* node) { 898 void InstructionSelector::VisitFloat64Add(Node* node) {
892 VisitFloatBinop(this, node, kAVXFloat64Add, kSSEFloat64Add); 899 VisitFloatBinop(this, node, kAVXFloat64Add, kSSEFloat64Add);
893 } 900 }
894 901
895 902
896 void InstructionSelector::VisitFloat64Sub(Node* node) { 903 void InstructionSelector::VisitFloat64Sub(Node* node) {
897 X64OperandGenerator g(this); 904 X64OperandGenerator g(this);
898 Float64BinopMatcher m(node); 905 Float64BinopMatcher m(node);
899 if (m.left().IsMinusZero() && m.right().IsFloat64RoundDown() && 906 if (m.left().IsMinusZero()) {
900 CanCover(m.node(), m.right().node())) { 907 if (m.right().IsFloat64RoundDown() &&
901 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && 908 CanCover(m.node(), m.right().node())) {
902 CanCover(m.right().node(), m.right().InputAt(0))) { 909 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
903 Float64BinopMatcher mright0(m.right().InputAt(0)); 910 CanCover(m.right().node(), m.right().InputAt(0))) {
904 if (mright0.left().IsMinusZero()) { 911 Float64BinopMatcher mright0(m.right().InputAt(0));
905 Emit(kSSEFloat64Round | MiscField::encode(kRoundUp), 912 if (mright0.left().IsMinusZero()) {
906 g.DefineAsRegister(node), g.UseRegister(mright0.right().node())); 913 Emit(kSSEFloat64Round | MiscField::encode(kRoundUp),
907 return; 914 g.DefineAsRegister(node), g.UseRegister(mright0.right().node()));
915 return;
916 }
908 } 917 }
909 } 918 }
919 Emit(kSSEFloat64Neg, g.DefineSameAsFirst(node),
920 g.UseRegister(m.right().node()));
921 return;
910 } 922 }
911 VisitFloatBinop(this, node, kAVXFloat64Sub, kSSEFloat64Sub); 923 VisitFloatBinop(this, node, kAVXFloat64Sub, kSSEFloat64Sub);
912 } 924 }
913 925
914 926
915 void InstructionSelector::VisitFloat64Mul(Node* node) { 927 void InstructionSelector::VisitFloat64Mul(Node* node) {
916 VisitFloatBinop(this, node, kAVXFloat64Mul, kSSEFloat64Mul); 928 VisitFloatBinop(this, node, kAVXFloat64Mul, kSSEFloat64Mul);
917 } 929 }
918 930
919 931
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 if (CpuFeatures::IsSupported(SSE4_1)) { 1516 if (CpuFeatures::IsSupported(SSE4_1)) {
1505 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1517 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1506 MachineOperatorBuilder::kFloat64RoundTruncate; 1518 MachineOperatorBuilder::kFloat64RoundTruncate;
1507 } 1519 }
1508 return flags; 1520 return flags;
1509 } 1521 }
1510 1522
1511 } // namespace compiler 1523 } // namespace compiler
1512 } // namespace internal 1524 } // namespace internal
1513 } // namespace v8 1525 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-codes-x64.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698