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

Side by Side Diff: test/unittests/compiler/x64/instruction-selector-x64-unittest.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 | « test/cctest/compiler/test-run-machops.cc ('k') | no next file » | 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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 m.Return(m.TruncateInt64ToInt32(m.Parameter(0))); 68 m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
69 Stream s = m.Build(); 69 Stream s = m.Build();
70 ASSERT_EQ(1U, s.size()); 70 ASSERT_EQ(1U, s.size());
71 EXPECT_EQ(kX64Movl, s[0]->arch_opcode()); 71 EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
72 } 72 }
73 73
74 74
75 // ----------------------------------------------------------------------------- 75 // -----------------------------------------------------------------------------
76 // Loads and stores 76 // Loads and stores
77 77
78
78 namespace { 79 namespace {
79 80
80 struct MemoryAccess { 81 struct MemoryAccess {
81 MachineType type; 82 MachineType type;
82 ArchOpcode load_opcode; 83 ArchOpcode load_opcode;
83 ArchOpcode store_opcode; 84 ArchOpcode store_opcode;
84 }; 85 };
85 86
86 87
87 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) { 88 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); 131 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode());
131 EXPECT_EQ(3U, s[0]->InputCount()); 132 EXPECT_EQ(3U, s[0]->InputCount());
132 EXPECT_EQ(0U, s[0]->OutputCount()); 133 EXPECT_EQ(0U, s[0]->OutputCount());
133 } 134 }
134 135
135 136
136 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, 137 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
137 InstructionSelectorMemoryAccessTest, 138 InstructionSelectorMemoryAccessTest,
138 ::testing::ValuesIn(kMemoryAccesses)); 139 ::testing::ValuesIn(kMemoryAccesses));
139 140
141
140 // ----------------------------------------------------------------------------- 142 // -----------------------------------------------------------------------------
141 // ChangeUint32ToUint64. 143 // ChangeUint32ToUint64.
142 144
143 145
144 namespace { 146 namespace {
145 147
146 typedef Node* (RawMachineAssembler::*Constructor)(Node*, Node*); 148 typedef Node* (RawMachineAssembler::*Constructor)(Node*, Node*);
147 149
148 150
149 struct BinaryOperation { 151 struct BinaryOperation {
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 Stream s = m.Build(); 1021 Stream s = m.Build();
1020 ASSERT_EQ(4U, s.size()); 1022 ASSERT_EQ(4U, s.size());
1021 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode()); 1023 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode());
1022 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode()); 1024 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode());
1023 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode()); 1025 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode());
1024 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode()); 1026 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode());
1025 } 1027 }
1026 } 1028 }
1027 1029
1028 1030
1031 TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) {
1032 StreamBuilder m(this, kMachFloat64, kMachFloat64);
1033 Node* const p0 = m.Parameter(0);
1034 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
1035 m.Return(n);
1036 Stream s = m.Build();
1037 ASSERT_EQ(1U, s.size());
1038 EXPECT_EQ(kSSEFloat64Neg, s[0]->arch_opcode());
1039 ASSERT_EQ(1U, s[0]->InputCount());
1040 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1041 ASSERT_EQ(1U, s[0]->OutputCount());
1042 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1043 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
1044 }
1045
1046
1029 // ----------------------------------------------------------------------------- 1047 // -----------------------------------------------------------------------------
1030 // Miscellaneous. 1048 // Miscellaneous.
1031 1049
1032 1050
1033 TEST_F(InstructionSelectorTest, Uint64LessThanWithLoadAndLoadStackPointer) { 1051 TEST_F(InstructionSelectorTest, Uint64LessThanWithLoadAndLoadStackPointer) {
1034 StreamBuilder m(this, kMachBool); 1052 StreamBuilder m(this, kMachBool);
1035 Node* const sl = m.Load( 1053 Node* const sl = m.Load(
1036 kMachPtr, 1054 kMachPtr,
1037 m.ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); 1055 m.ExternalConstant(ExternalReference::address_of_stack_limit(isolate())));
1038 Node* const sp = m.LoadStackPointer(); 1056 Node* const sp = m.LoadStackPointer();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode()); 1175 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode());
1158 ASSERT_EQ(1U, s[0]->InputCount()); 1176 ASSERT_EQ(1U, s[0]->InputCount());
1159 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 1177 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1160 ASSERT_EQ(1U, s[0]->OutputCount()); 1178 ASSERT_EQ(1U, s[0]->OutputCount());
1161 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 1179 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1162 } 1180 }
1163 1181
1164 } // namespace compiler 1182 } // namespace compiler
1165 } // namespace internal 1183 } // namespace internal
1166 } // namespace v8 1184 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698