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

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

Issue 2252333002: [turbofan/x64] Load word64 followed by a shift right 32 -> load (and sign-extend if necessary) high… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 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
« 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 m.Return(n); 1296 m.Return(n);
1297 Stream s = m.Build(); 1297 Stream s = m.Build();
1298 ASSERT_EQ(1U, s.size()); 1298 ASSERT_EQ(1U, s.size());
1299 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode()); 1299 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode());
1300 ASSERT_EQ(1U, s[0]->InputCount()); 1300 ASSERT_EQ(1U, s[0]->InputCount());
1301 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 1301 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1302 ASSERT_EQ(1U, s[0]->OutputCount()); 1302 ASSERT_EQ(1U, s[0]->OutputCount());
1303 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 1303 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1304 } 1304 }
1305 1305
1306 TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) {
1307 {
1308 StreamBuilder m(this, MachineType::Uint64(), MachineType::Uint32());
1309 Node* const p0 = m.Parameter(0);
1310 Node* const load = m.Load(MachineType::Uint64(), p0);
1311 Node* const shift = m.Word64Shr(load, m.Int32Constant(32));
1312 m.Return(shift);
1313 Stream s = m.Build();
1314 ASSERT_EQ(1U, s.size());
1315 EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
1316 ASSERT_EQ(2U, s[0]->InputCount());
1317 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1318 EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
1319 ASSERT_EQ(1U, s[0]->OutputCount());
1320 EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
1321 }
1322 {
1323 StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
1324 Node* const p0 = m.Parameter(0);
1325 Node* const load = m.Load(MachineType::Int64(), p0);
1326 Node* const shift = m.Word64Sar(load, m.Int32Constant(32));
1327 m.Return(shift);
1328 Stream s = m.Build();
1329 ASSERT_EQ(1U, s.size());
1330 EXPECT_EQ(kX64Movsxlq, s[0]->arch_opcode());
1331 ASSERT_EQ(2U, s[0]->InputCount());
1332 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1333 EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
1334 ASSERT_EQ(1U, s[0]->OutputCount());
1335 EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
1336 }
1337 {
1338 StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
1339 Node* const p0 = m.Parameter(0);
1340 Node* const load = m.Load(MachineType::Int64(), p0);
1341 Node* const shift = m.Word64Sar(load, m.Int32Constant(32));
1342 Node* const truncate = m.TruncateInt64ToInt32(shift);
1343 m.Return(truncate);
1344 Stream s = m.Build();
1345 ASSERT_EQ(1U, s.size());
1346 EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
1347 ASSERT_EQ(2U, s[0]->InputCount());
1348 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
1349 EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
1350 ASSERT_EQ(1U, s[0]->OutputCount());
1351 EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
1352 }
1353 }
1354
1306 } // namespace compiler 1355 } // namespace compiler
1307 } // namespace internal 1356 } // namespace internal
1308 } // namespace v8 1357 } // 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