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

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

Issue 715433004: [turbofan] Use cbz/cbnz when possible on arm64. (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/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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 Stream s = m.Build(); 945 Stream s = m.Build();
946 ASSERT_EQ(1U, s.size()); 946 ASSERT_EQ(1U, s.size());
947 EXPECT_EQ(kArm64Tbz, s[0]->arch_opcode()); 947 EXPECT_EQ(kArm64Tbz, s[0]->arch_opcode());
948 EXPECT_EQ(4U, s[0]->InputCount()); 948 EXPECT_EQ(4U, s[0]->InputCount());
949 EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); 949 EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
950 EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1))); 950 EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1)));
951 } 951 }
952 } 952 }
953 953
954 954
955 TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) {
956 {
957 StreamBuilder m(this, kMachInt32, kMachInt32);
958 MLabel a, b;
959 Node* p0 = m.Parameter(0);
960 m.Branch(p0, &a, &b);
961 m.Bind(&a);
962 m.Return(m.Int32Constant(1));
963 m.Bind(&b);
964 m.Return(m.Int32Constant(0));
965 Stream s = m.Build();
966 ASSERT_EQ(1U, s.size());
967 EXPECT_EQ(kArm64Cbnz32, s[0]->arch_opcode());
968 EXPECT_EQ(3U, s[0]->InputCount());
969 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
970 }
971
972 {
973 StreamBuilder m(this, kMachInt32, kMachInt32);
974 MLabel a, b;
975 Node* p0 = m.Parameter(0);
976 m.Branch(m.Word32BinaryNot(p0), &a, &b);
977 m.Bind(&a);
978 m.Return(m.Int32Constant(1));
979 m.Bind(&b);
980 m.Return(m.Int32Constant(0));
981 Stream s = m.Build();
982 ASSERT_EQ(1U, s.size());
983 EXPECT_EQ(kArm64Cbz32, s[0]->arch_opcode());
984 EXPECT_EQ(3U, s[0]->InputCount());
985 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
986 }
987 }
988
989
955 // ----------------------------------------------------------------------------- 990 // -----------------------------------------------------------------------------
956 // Add and subtract instructions with overflow. 991 // Add and subtract instructions with overflow.
957 992
958 993
959 typedef InstructionSelectorTestWithParam<MachInst2> 994 typedef InstructionSelectorTestWithParam<MachInst2>
960 InstructionSelectorOvfAddSubTest; 995 InstructionSelectorOvfAddSubTest;
961 996
962 997
963 TEST_P(InstructionSelectorOvfAddSubTest, OvfParameter) { 998 TEST_P(InstructionSelectorOvfAddSubTest, OvfParameter) {
964 const MachInst2 dpi = GetParam(); 999 const MachInst2 dpi = GetParam();
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 ASSERT_EQ(2U, s[1]->InputCount()); 2125 ASSERT_EQ(2U, s[1]->InputCount());
2091 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); 2126 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
2092 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1))); 2127 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1)));
2093 ASSERT_EQ(1U, s[1]->OutputCount()); 2128 ASSERT_EQ(1U, s[1]->OutputCount());
2094 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); 2129 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
2095 } 2130 }
2096 2131
2097 } // namespace compiler 2132 } // namespace compiler
2098 } // namespace internal 2133 } // namespace internal
2099 } // namespace v8 2134 } // 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