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

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

Issue 2243843002: [ARM64] Optimize load followed by shift. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/arm64/instruction-selector-arm64.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 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 4268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4279 m.Return(n); 4279 m.Return(n);
4280 Stream s = m.Build(); 4280 Stream s = m.Build();
4281 ASSERT_EQ(1U, s.size()); 4281 ASSERT_EQ(1U, s.size());
4282 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); 4282 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
4283 ASSERT_EQ(1U, s[0]->InputCount()); 4283 ASSERT_EQ(1U, s[0]->InputCount());
4284 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 4284 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4285 ASSERT_EQ(1U, s[0]->OutputCount()); 4285 ASSERT_EQ(1U, s[0]->OutputCount());
4286 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 4286 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4287 } 4287 }
4288 4288
4289 TEST_F(InstructionSelectorTest, LoadAndShiftRight) {
4290 {
4291 int32_t immediates[] = {-256, -255, -3, -2, -1, 0, 1,
4292 2, 3, 255, 256, 260, 4096, 4100,
4293 8192, 8196, 3276, 3280, 16376, 16380};
4294 TRACED_FOREACH(int32_t, index, immediates) {
4295 StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer());
4296 Node* const load = m.Load(MachineType::Uint64(), m.Parameter(0),
4297 m.Int32Constant(index - 4));
4298 Node* const sar = m.Word64Sar(load, m.Int32Constant(32));
4299 // Make sure we don't fold the shift into the following add:
4300 m.Return(m.Int64Add(sar, m.Parameter(0)));
4301 Stream s = m.Build();
4302 ASSERT_EQ(2U, s.size());
4303 EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
4304 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
4305 EXPECT_EQ(2U, s[0]->InputCount());
4306 EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
4307 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
4308 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1)));
4309 ASSERT_EQ(1U, s[0]->OutputCount());
4310 }
4311 }
4312 }
4313
4289 } // namespace compiler 4314 } // namespace compiler
4290 } // namespace internal 4315 } // namespace internal
4291 } // namespace v8 4316 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698