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

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

Issue 487723002: [turbofan] Add proper conversion operators for int32<->int64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
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 <list> 5 #include <list>
6 6
7 #include "test/compiler-unittests/instruction-selector-unittest.h" 7 #include "test/compiler-unittests/instruction-selector-unittest.h"
8 8
9 #include "test/cctest/compiler/instruction-selector-tester.h"
10
11 namespace v8 { 9 namespace v8 {
12 namespace internal { 10 namespace internal {
13 namespace compiler { 11 namespace compiler {
14 12
15 namespace { 13 namespace {
16 14
17 typedef Node* (RawMachineAssembler::*Constructor)(Node*, Node*); 15 typedef Node* (RawMachineAssembler::*Constructor)(Node*, Node*);
18 16
19 struct DPI { 17 struct DPI {
20 Constructor constructor; 18 Constructor constructor;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 TEST_F(InstructionSelectorTest, MulDivWithParameter) { 119 TEST_F(InstructionSelectorTest, MulDivWithParameter) {
122 TRACED_FOREACH(DPI, dpi, kMulDivInstructions) { 120 TRACED_FOREACH(DPI, dpi, kMulDivInstructions) {
123 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 121 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
124 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); 122 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
125 Stream s = m.Build(); 123 Stream s = m.Build();
126 ASSERT_EQ(1U, s.size()); 124 ASSERT_EQ(1U, s.size());
127 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); 125 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
128 } 126 }
129 } 127 }
130 128
129
130 // -----------------------------------------------------------------------------
131 // Conversions.
132
133
134 TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) {
135 StreamBuilder m(this, kMachInt64, kMachInt32);
136 m.Return(m.ChangeInt32ToInt64(m.Parameter(0)));
137 Stream s = m.Build();
138 ASSERT_EQ(1U, s.size());
139 EXPECT_EQ(kArm64Sxtw, s[0]->arch_opcode());
140 }
141
142
143 TEST_F(InstructionSelectorTest, ChangeUint32ToUint64WithParameter) {
144 StreamBuilder m(this, kMachUint64, kMachUint32);
145 m.Return(m.ChangeUint32ToUint64(m.Parameter(0)));
146 Stream s = m.Build();
147 ASSERT_EQ(1U, s.size());
148 EXPECT_EQ(kArm64Mov32, s[0]->arch_opcode());
149 }
150
151
152 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
153 StreamBuilder m(this, kMachInt32, kMachInt64);
154 m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
155 Stream s = m.Build();
156 ASSERT_EQ(1U, s.size());
157 EXPECT_EQ(kArm64Mov32, s[0]->arch_opcode());
158 }
159
131 } // namespace compiler 160 } // namespace compiler
132 } // namespace internal 161 } // namespace internal
133 } // namespace v8 162 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698