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

Side by Side Diff: test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc

Issue 615393002: Move unit tests to test/unittests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 2 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 | Annotate | Revision Log
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/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
11 namespace { 11 namespace {
12 12
13 // Immediates (random subset). 13 // Immediates (random subset).
14 static const int32_t kImmediates[] = { 14 static const int32_t kImmediates[] = {
15 kMinInt, -42, -1, 0, 1, 2, 3, 4, 5, 15 kMinInt, -42, -1, 0, 1, 2, 3, 4, 5,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const MemoryAccess memacc = GetParam(); 195 const MemoryAccess memacc = GetParam();
196 TRACED_FOREACH(int32_t, base, kImmediates) { 196 TRACED_FOREACH(int32_t, base, kImmediates) {
197 StreamBuilder m(this, memacc.type, kMachPtr); 197 StreamBuilder m(this, memacc.type, kMachPtr);
198 m.Return(m.Load(memacc.type, m.Int32Constant(base), m.Parameter(0))); 198 m.Return(m.Load(memacc.type, m.Int32Constant(base), m.Parameter(0)));
199 Stream s = m.Build(); 199 Stream s = m.Build();
200 ASSERT_EQ(1U, s.size()); 200 ASSERT_EQ(1U, s.size());
201 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); 201 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode());
202 if (base == 0) { 202 if (base == 0) {
203 ASSERT_EQ(1U, s[0]->InputCount()); 203 ASSERT_EQ(1U, s[0]->InputCount());
204 } else { 204 } else {
205 ASSERT_EQ(2U, s[0]->InputCount()); 205 ASSERT_EQ(2U, s[0]->InputCount());
206 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); 206 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
207 EXPECT_EQ(base, s.ToInt32(s[0]->InputAt(1))); 207 EXPECT_EQ(base, s.ToInt32(s[0]->InputAt(1)));
208 } 208 }
209 EXPECT_EQ(1U, s[0]->OutputCount()); 209 EXPECT_EQ(1U, s[0]->OutputCount());
210 } 210 }
211 } 211 }
212 212
213 213
214 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) { 214 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) {
215 const MemoryAccess memacc = GetParam(); 215 const MemoryAccess memacc = GetParam();
216 TRACED_FOREACH(int32_t, index, kImmediates) { 216 TRACED_FOREACH(int32_t, index, kImmediates) {
217 StreamBuilder m(this, memacc.type, kMachPtr); 217 StreamBuilder m(this, memacc.type, kMachPtr);
218 m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index))); 218 m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
219 Stream s = m.Build(); 219 Stream s = m.Build();
220 ASSERT_EQ(1U, s.size()); 220 ASSERT_EQ(1U, s.size());
221 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); 221 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode());
222 if (index == 0) { 222 if (index == 0) {
223 ASSERT_EQ(1U, s[0]->InputCount()); 223 ASSERT_EQ(1U, s[0]->InputCount());
224 } else { 224 } else {
225 ASSERT_EQ(2U, s[0]->InputCount()); 225 ASSERT_EQ(2U, s[0]->InputCount());
226 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); 226 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
227 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); 227 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1)));
228 } 228 }
229 EXPECT_EQ(1U, s[0]->OutputCount()); 229 EXPECT_EQ(1U, s[0]->OutputCount());
230 } 230 }
231 } 231 }
232 232
233 233
234 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { 234 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
235 const MemoryAccess memacc = GetParam(); 235 const MemoryAccess memacc = GetParam();
236 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type); 236 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
237 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2)); 237 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2));
(...skipping 11 matching lines...) Expand all
249 TRACED_FOREACH(int32_t, base, kImmediates) { 249 TRACED_FOREACH(int32_t, base, kImmediates) {
250 StreamBuilder m(this, kMachInt32, kMachInt32, memacc.type); 250 StreamBuilder m(this, kMachInt32, kMachInt32, memacc.type);
251 m.Store(memacc.type, m.Int32Constant(base), m.Parameter(0), m.Parameter(1)); 251 m.Store(memacc.type, m.Int32Constant(base), m.Parameter(0), m.Parameter(1));
252 m.Return(m.Int32Constant(0)); 252 m.Return(m.Int32Constant(0));
253 Stream s = m.Build(); 253 Stream s = m.Build();
254 ASSERT_EQ(1U, s.size()); 254 ASSERT_EQ(1U, s.size());
255 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); 255 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode());
256 if (base == 0) { 256 if (base == 0) {
257 ASSERT_EQ(2U, s[0]->InputCount()); 257 ASSERT_EQ(2U, s[0]->InputCount());
258 } else { 258 } else {
259 ASSERT_EQ(3U, s[0]->InputCount()); 259 ASSERT_EQ(3U, s[0]->InputCount());
260 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); 260 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
261 EXPECT_EQ(base, s.ToInt32(s[0]->InputAt(1))); 261 EXPECT_EQ(base, s.ToInt32(s[0]->InputAt(1)));
262 } 262 }
263 EXPECT_EQ(0U, s[0]->OutputCount()); 263 EXPECT_EQ(0U, s[0]->OutputCount());
264 } 264 }
265 } 265 }
266 266
267 267
268 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { 268 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) {
269 const MemoryAccess memacc = GetParam(); 269 const MemoryAccess memacc = GetParam();
270 TRACED_FOREACH(int32_t, index, kImmediates) { 270 TRACED_FOREACH(int32_t, index, kImmediates) {
271 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); 271 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 EXPECT_EQ(param->id(), s.ToVreg(s[0]->InputAt(0))); 510 EXPECT_EQ(param->id(), s.ToVreg(s[0]->InputAt(0)));
511 } 511 }
512 512
513 513
514 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMultTest, 514 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMultTest,
515 ::testing::ValuesIn(kMultParams)); 515 ::testing::ValuesIn(kMultParams));
516 516
517 } // namespace compiler 517 } // namespace compiler
518 } // namespace internal 518 } // namespace internal
519 } // namespace v8 519 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/graph-unittest.cc ('k') | test/unittests/compiler/instruction-selector-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698