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

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

Issue 704703002: [x64] 64-bit shift left by 32 or more covers sign/zero extend. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/compiler/x64/instruction-selector-x64.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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ASSERT_EQ(2U, s[0]->InputCount()); 316 ASSERT_EQ(2U, s[0]->InputCount());
317 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 317 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
318 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax)); 318 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax));
319 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); 319 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
320 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); 320 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1)));
321 ASSERT_LE(1U, s[0]->OutputCount()); 321 ASSERT_LE(1U, s[0]->OutputCount());
322 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 322 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
323 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx)); 323 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx));
324 } 324 }
325 325
326
327 // -----------------------------------------------------------------------------
328 // Word64Shl.
329
330
331 TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) {
332 TRACED_FORRANGE(int64_t, x, 32, 63) {
333 StreamBuilder m(this, kMachInt64, kMachInt32);
334 Node* const p0 = m.Parameter(0);
335 Node* const n = m.Word64Shl(m.ChangeInt32ToInt64(p0), m.Int64Constant(x));
336 m.Return(n);
337 Stream s = m.Build();
338 ASSERT_EQ(1U, s.size());
339 EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
340 ASSERT_EQ(2U, s[0]->InputCount());
341 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
342 EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
343 ASSERT_EQ(1U, s[0]->OutputCount());
344 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
345 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
346 }
347 }
348
349
350 TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) {
351 TRACED_FORRANGE(int64_t, x, 32, 63) {
352 StreamBuilder m(this, kMachInt64, kMachUint32);
353 Node* const p0 = m.Parameter(0);
354 Node* const n = m.Word64Shl(m.ChangeUint32ToUint64(p0), m.Int64Constant(x));
355 m.Return(n);
356 Stream s = m.Build();
357 ASSERT_EQ(1U, s.size());
358 EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
359 ASSERT_EQ(2U, s[0]->InputCount());
360 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
361 EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
362 ASSERT_EQ(1U, s[0]->OutputCount());
363 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
364 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
365 }
366 }
367
326 } // namespace compiler 368 } // namespace compiler
327 } // namespace internal 369 } // namespace internal
328 } // namespace v8 370 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698