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

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

Issue 469743002: [turbofan] Refactor the InstructionSelector tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM64 Created 6 years, 4 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
« no previous file with comments | « test/cctest/compiler/test-instruction-selector-arm64.cc ('k') | test/compiler-unittests/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "test/cctest/compiler/instruction-selector-tester.h"
6 #include "test/cctest/compiler/value-helper.h"
7
8 using namespace v8::internal;
9 using namespace v8::internal::compiler;
10
11 TEST(InstructionSelectorInt32AddP) {
12 InstructionSelectorTester m;
13 m.Return(m.Int32Add(m.Parameter(0), m.Parameter(1)));
14 m.SelectInstructions();
15 CHECK_EQ(1, m.code.size());
16 CHECK_EQ(kIA32Add, m.code[0]->arch_opcode());
17 }
18
19
20 TEST(InstructionSelectorInt32AddImm) {
21 FOR_INT32_INPUTS(i) {
22 int32_t imm = *i;
23 {
24 InstructionSelectorTester m;
25 m.Return(m.Int32Add(m.Parameter(0), m.Int32Constant(imm)));
26 m.SelectInstructions();
27 CHECK_EQ(1, m.code.size());
28 CHECK_EQ(kIA32Add, m.code[0]->arch_opcode());
29 CHECK_EQ(2, m.code[0]->InputCount());
30 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
31 }
32 {
33 InstructionSelectorTester m;
34 m.Return(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)));
35 m.SelectInstructions();
36 CHECK_EQ(1, m.code.size());
37 CHECK_EQ(kIA32Add, m.code[0]->arch_opcode());
38 CHECK_EQ(2, m.code[0]->InputCount());
39 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
40 }
41 }
42 }
43
44
45 TEST(InstructionSelectorInt32SubP) {
46 InstructionSelectorTester m;
47 m.Return(m.Int32Sub(m.Parameter(0), m.Parameter(1)));
48 m.SelectInstructions();
49 CHECK_EQ(1, m.code.size());
50 CHECK_EQ(kIA32Sub, m.code[0]->arch_opcode());
51 CHECK_EQ(1, m.code[0]->OutputCount());
52 }
53
54
55 TEST(InstructionSelectorInt32SubImm) {
56 FOR_INT32_INPUTS(i) {
57 int32_t imm = *i;
58 InstructionSelectorTester m;
59 m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm)));
60 m.SelectInstructions();
61 CHECK_EQ(1, m.code.size());
62 CHECK_EQ(kIA32Sub, m.code[0]->arch_opcode());
63 CHECK_EQ(2, m.code[0]->InputCount());
64 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
65 }
66 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-instruction-selector-arm64.cc ('k') | test/compiler-unittests/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698