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

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

Issue 505713002: [turbofan] Add backend support for signed loads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix x64. Created 6 years, 3 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/compiler-unittests/ia32/instruction-selector-ia32-unittest.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/compiler-unittests/instruction-selector-unittest.h" 5 #include "test/compiler-unittests/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
(...skipping 20 matching lines...) Expand all
31 31
32 32
33 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { 33 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
34 StreamBuilder m(this, kMachInt32, kMachInt64); 34 StreamBuilder m(this, kMachInt32, kMachInt64);
35 m.Return(m.TruncateInt64ToInt32(m.Parameter(0))); 35 m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
36 Stream s = m.Build(); 36 Stream s = m.Build();
37 ASSERT_EQ(1U, s.size()); 37 ASSERT_EQ(1U, s.size());
38 EXPECT_EQ(kX64Movl, s[0]->arch_opcode()); 38 EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
39 } 39 }
40 40
41
42 // -----------------------------------------------------------------------------
43 // Loads and stores
44
45 namespace {
46
47 struct MemoryAccess {
48 MachineType type;
49 ArchOpcode load_opcode;
50 ArchOpcode store_opcode;
51 };
52
53
54 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
55 OStringStream ost;
56 ost << memacc.type;
57 return os << ost.c_str();
58 }
59
60
61 static const MemoryAccess kMemoryAccesses[] = {
62 {kMachInt8, kX64Movsxbl, kX64Movb},
63 {kMachUint8, kX64Movzxbl, kX64Movb},
64 {kMachInt16, kX64Movsxwl, kX64Movw},
65 {kMachUint16, kX64Movzxwl, kX64Movw},
66 {kMachInt32, kX64Movl, kX64Movl},
67 {kMachUint32, kX64Movl, kX64Movl},
68 {kMachInt64, kX64Movq, kX64Movq},
69 {kMachUint64, kX64Movq, kX64Movq},
70 {kMachFloat64, kX64Movsd, kX64Movsd}};
71
72 } // namespace
73
74
75 typedef InstructionSelectorTestWithParam<MemoryAccess>
76 InstructionSelectorMemoryAccessTest;
77
78
79 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
80 const MemoryAccess memacc = GetParam();
81 StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
82 m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
83 Stream s = m.Build();
84 ASSERT_EQ(1U, s.size());
85 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode());
86 EXPECT_EQ(2U, s[0]->InputCount());
87 EXPECT_EQ(1U, s[0]->OutputCount());
88 }
89
90
91 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
92 const MemoryAccess memacc = GetParam();
93 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
94 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2));
95 m.Return(m.Int32Constant(0));
96 Stream s = m.Build();
97 ASSERT_EQ(1U, s.size());
98 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode());
99 EXPECT_EQ(3U, s[0]->InputCount());
100 EXPECT_EQ(0U, s[0]->OutputCount());
101 }
102
103
104 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
105 InstructionSelectorMemoryAccessTest,
106 ::testing::ValuesIn(kMemoryAccesses));
107
41 } // namespace compiler 108 } // namespace compiler
42 } // namespace internal 109 } // namespace internal
43 } // namespace v8 110 } // namespace v8
OLDNEW
« no previous file with comments | « test/compiler-unittests/ia32/instruction-selector-ia32-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698