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

Side by Side Diff: src/compiler/arm64/instruction-selector-arm64.cc

Issue 697653002: [turbofan] Select tbz/tbnz 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
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 "src/compiler/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 } 1187 }
1188 } 1188 }
1189 } 1189 }
1190 break; 1190 break;
1191 case IrOpcode::kInt32Add: 1191 case IrOpcode::kInt32Add:
1192 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true, 1192 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true,
1193 kArithmeticImm); 1193 kArithmeticImm);
1194 case IrOpcode::kInt32Sub: 1194 case IrOpcode::kInt32Sub:
1195 return VisitWordCompare(this, value, kArm64Cmp32, &cont, false, 1195 return VisitWordCompare(this, value, kArm64Cmp32, &cont, false,
1196 kArithmeticImm); 1196 kArithmeticImm);
1197 case IrOpcode::kWord32And: 1197 case IrOpcode::kWord32And: {
1198 Int32BinopMatcher m(value);
1199 if (m.right().HasValue() &&
1200 (base::bits::CountPopulation32(m.right().Value()) == 1)) {
1201 // If the mask has only one bit set, we can use tbz/tbnz.
1202 DCHECK((cont.condition() == kEqual) ||
1203 (cont.condition() == kNotEqual));
1204 ArchOpcode opcode =
1205 (cont.condition() == kEqual) ? kArm64Tbz32 : kArm64Tbnz32;
1206 Emit(opcode, NULL, g.UseRegister(m.left().node()),
1207 g.TempImmediate(
1208 base::bits::CountTrailingZeros32(m.right().Value())),
1209 g.Label(cont.true_block()),
1210 g.Label(cont.false_block()))->MarkAsControl();
1211 return;
1212 }
1198 return VisitWordCompare(this, value, kArm64Tst32, &cont, true, 1213 return VisitWordCompare(this, value, kArm64Tst32, &cont, true,
1199 kLogical32Imm); 1214 kLogical32Imm);
1200 case IrOpcode::kWord64And: 1215 }
1216 case IrOpcode::kWord64And: {
1217 Int64BinopMatcher m(value);
1218 if (m.right().HasValue() &&
1219 (base::bits::CountPopulation64(m.right().Value()) == 1)) {
1220 // If the mask has only one bit set, we can use tbz/tbnz.
1221 DCHECK((cont.condition() == kEqual) ||
1222 (cont.condition() == kNotEqual));
1223 ArchOpcode opcode =
1224 (cont.condition() == kEqual) ? kArm64Tbz : kArm64Tbnz;
1225 Emit(opcode, NULL, g.UseRegister(m.left().node()),
1226 g.TempImmediate(
1227 base::bits::CountTrailingZeros64(m.right().Value())),
1228 g.Label(cont.true_block()),
1229 g.Label(cont.false_block()))->MarkAsControl();
1230 return;
1231 }
1201 return VisitWordCompare(this, value, kArm64Tst, &cont, true, 1232 return VisitWordCompare(this, value, kArm64Tst, &cont, true,
1202 kLogical64Imm); 1233 kLogical64Imm);
1234 }
1203 default: 1235 default:
1204 break; 1236 break;
1205 } 1237 }
1206 } 1238 }
1207 1239
1208 // Branch could not be combined with a compare, emit compare against 0. 1240 // Branch could not be combined with a compare, emit compare against 0.
1209 VisitWord32Test(this, value, &cont); 1241 VisitWord32Test(this, value, &cont);
1210 } 1242 }
1211 1243
1212 1244
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 MachineOperatorBuilder::Flags 1376 MachineOperatorBuilder::Flags
1345 InstructionSelector::SupportedMachineOperatorFlags() { 1377 InstructionSelector::SupportedMachineOperatorFlags() {
1346 return MachineOperatorBuilder::kFloat64Floor | 1378 return MachineOperatorBuilder::kFloat64Floor |
1347 MachineOperatorBuilder::kFloat64Ceil | 1379 MachineOperatorBuilder::kFloat64Ceil |
1348 MachineOperatorBuilder::kFloat64RoundTruncate | 1380 MachineOperatorBuilder::kFloat64RoundTruncate |
1349 MachineOperatorBuilder::kFloat64RoundTiesAway; 1381 MachineOperatorBuilder::kFloat64RoundTiesAway;
1350 } 1382 }
1351 } // namespace compiler 1383 } // namespace compiler
1352 } // namespace internal 1384 } // namespace internal
1353 } // namespace v8 1385 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-codes-arm64.h ('k') | test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698