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

Side by Side Diff: runtime/vm/assembler_arm.cc

Issue 12459005: Adds muls, sdiv, udiv instructions to ARM simulator, assembler, disassembler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | runtime/vm/assembler_arm_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/simulator.h" 9 #include "vm/simulator.h"
10 #include "vm/runtime_entry.h" 10 #include "vm/runtime_entry.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 452 }
453 453
454 454
455 void Assembler::mul(Register rd, Register rn, 455 void Assembler::mul(Register rd, Register rn,
456 Register rm, Condition cond) { 456 Register rm, Condition cond) {
457 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. 457 // Assembler registers rd, rn, rm are encoded as rn, rm, rs.
458 EmitMulOp(cond, 0, R0, rd, rn, rm); 458 EmitMulOp(cond, 0, R0, rd, rn, rm);
459 } 459 }
460 460
461 461
462 // Like mul, but sets condition flags.
463 void Assembler::muls(Register rd, Register rn,
464 Register rm, Condition cond) {
465 EmitMulOp(cond, B20, R0, rd, rn, rm);
466 }
467
468
462 void Assembler::mla(Register rd, Register rn, 469 void Assembler::mla(Register rd, Register rn,
463 Register rm, Register ra, Condition cond) { 470 Register rm, Register ra, Condition cond) {
464 // Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd. 471 // Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
465 EmitMulOp(cond, B21, ra, rd, rn, rm); 472 EmitMulOp(cond, B21, ra, rd, rn, rm);
466 } 473 }
467 474
468 475
469 void Assembler::mls(Register rd, Register rn, 476 void Assembler::mls(Register rd, Register rn,
470 Register rm, Register ra, Condition cond) { 477 Register rm, Register ra, Condition cond) {
471 // Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd. 478 // Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
472 EmitMulOp(cond, B22 | B21, ra, rd, rn, rm); 479 EmitMulOp(cond, B22 | B21, ra, rd, rn, rm);
473 } 480 }
474 481
475 482
476 void Assembler::umull(Register rd_lo, Register rd_hi, 483 void Assembler::umull(Register rd_lo, Register rd_hi,
477 Register rn, Register rm, Condition cond) { 484 Register rn, Register rm, Condition cond) {
478 // Assembler registers rd_lo, rd_hi, rn, rm are encoded as rd, rn, rm, rs. 485 // Assembler registers rd_lo, rd_hi, rn, rm are encoded as rd, rn, rm, rs.
479 EmitMulOp(cond, B23, rd_lo, rd_hi, rn, rm); 486 EmitMulOp(cond, B23, rd_lo, rd_hi, rn, rm);
480 } 487 }
481 488
482 489
490 void Assembler::EmitDivOp(Condition cond, int32_t opcode,
491 Register rd, Register rn, Register rm) {
492 ASSERT(CPUFeatures::integer_division_supported());
493 ASSERT(rd != kNoRegister);
494 ASSERT(rn != kNoRegister);
495 ASSERT(rm != kNoRegister);
496 ASSERT(cond != kNoCondition);
497 int32_t encoding = opcode |
498 (static_cast<int32_t>(cond) << kConditionShift) |
499 (static_cast<int32_t>(rn) << kRnShift) |
500 (static_cast<int32_t>(rd) << kRdShift) |
501 B26 | B25 | B24 | B20 | B4 |
502 (static_cast<int32_t>(rm) << kRmShift);
503 Emit(encoding);
504 }
505
506
507 void Assembler::sdiv(Register rd, Register rn, Register rm, Condition cond) {
508 EmitDivOp(cond, 0, rd, rn, rm);
509 }
510
511
512 void Assembler::udiv(Register rd, Register rn, Register rm, Condition cond) {
513 EmitDivOp(cond, B21 , rd, rn, rm);
514 }
515
516
483 void Assembler::ldr(Register rd, Address ad, Condition cond) { 517 void Assembler::ldr(Register rd, Address ad, Condition cond) {
484 EmitMemOp(cond, true, false, rd, ad); 518 EmitMemOp(cond, true, false, rd, ad);
485 } 519 }
486 520
487 521
488 void Assembler::str(Register rd, Address ad, Condition cond) { 522 void Assembler::str(Register rd, Address ad, Condition cond) {
489 EmitMemOp(cond, false, false, rd, ad); 523 EmitMemOp(cond, false, false, rd, ad);
490 } 524 }
491 525
492 526
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 // Do not reuse an existing entry, since each reference may be patched 1936 // Do not reuse an existing entry, since each reference may be patched
1903 // independently. 1937 // independently.
1904 object_pool_.Add(smi); 1938 object_pool_.Add(smi);
1905 return object_pool_.Length() - 1; 1939 return object_pool_.Length() - 1;
1906 } 1940 }
1907 1941
1908 } // namespace dart 1942 } // namespace dart
1909 1943
1910 #endif // defined TARGET_ARCH_ARM 1944 #endif // defined TARGET_ARCH_ARM
1911 1945
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | runtime/vm/assembler_arm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698