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

Side by Side Diff: test/compiler-unittests/arm64/instruction-selector-arm64-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
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 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 292
293 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { 293 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
294 StreamBuilder m(this, kMachInt32, kMachInt64); 294 StreamBuilder m(this, kMachInt32, kMachInt64);
295 m.Return(m.TruncateInt64ToInt32(m.Parameter(0))); 295 m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
296 Stream s = m.Build(); 296 Stream s = m.Build();
297 ASSERT_EQ(1U, s.size()); 297 ASSERT_EQ(1U, s.size());
298 EXPECT_EQ(kArm64Mov32, s[0]->arch_opcode()); 298 EXPECT_EQ(kArm64Mov32, s[0]->arch_opcode());
299 } 299 }
300 300
301
302 // -----------------------------------------------------------------------------
303 // Memory access instructions.
304
305
306 namespace {
307
308 struct MemoryAccess {
309 MachineType type;
310 ArchOpcode ldr_opcode;
311 ArchOpcode str_opcode;
312 };
313
314
315 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
316 OStringStream ost;
317 ost << memacc.type;
318 return os << ost.c_str();
319 }
320
321 } // namespace
322
323
324 static const MemoryAccess kMemoryAccesses[] = {
325 {kMachInt8, kArm64Ldrsb, kArm64Strb},
326 {kMachUint8, kArm64Ldrb, kArm64Strb},
327 {kMachInt16, kArm64Ldrsh, kArm64Strh},
328 {kMachUint16, kArm64Ldrh, kArm64Strh},
329 {kMachInt32, kArm64LdrW, kArm64StrW},
330 {kMachUint32, kArm64LdrW, kArm64StrW},
331 {kMachInt64, kArm64Ldr, kArm64Str},
332 {kMachUint64, kArm64Ldr, kArm64Str},
333 {kMachFloat64, kArm64LdrD, kArm64StrD}};
334
335
336 typedef InstructionSelectorTestWithParam<MemoryAccess>
337 InstructionSelectorMemoryAccessTest;
338
339
340 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
341 const MemoryAccess memacc = GetParam();
342 StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
343 m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
344 Stream s = m.Build();
345 ASSERT_EQ(1U, s.size());
346 EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
347 EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
348 EXPECT_EQ(2U, s[0]->InputCount());
349 EXPECT_EQ(1U, s[0]->OutputCount());
350 }
351
352
353 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
354 const MemoryAccess memacc = GetParam();
355 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
356 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2));
357 m.Return(m.Int32Constant(0));
358 Stream s = m.Build();
359 ASSERT_EQ(1U, s.size());
360 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
361 EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
362 EXPECT_EQ(3U, s[0]->InputCount());
363 EXPECT_EQ(0U, s[0]->OutputCount());
364 }
365
366
367 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
368 InstructionSelectorMemoryAccessTest,
369 ::testing::ValuesIn(kMemoryAccesses));
370
301 } // namespace compiler 371 } // namespace compiler
302 } // namespace internal 372 } // namespace internal
303 } // namespace v8 373 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698