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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1424213003: Add Sbc(register) and Sbc(immediate) to integrated ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // assembler. 522 // assembler.
523 constexpr bool SetFlags = false; 523 constexpr bool SetFlags = false;
524 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) 524 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
525 // Conditions of rule violated. 525 // Conditions of rule violated.
526 return setNeedsTextFixup(); 526 return setNeedsTextFixup();
527 constexpr IValueT Rn = 0; 527 constexpr IValueT Rn = 0;
528 constexpr IValueT Mov = B3 | B2 | B0; // 1101. 528 constexpr IValueT Mov = B3 | B2 | B0; // 1101.
529 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); 529 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src);
530 } 530 }
531 531
532 void AssemblerARM32::sbc(const Operand *OpRd, const Operand *OpRn,
533 const Operand *OpSrc1, bool SetFlags,
534 CondARM32::Cond Cond) {
535 IValueT Rd;
536 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
537 return setNeedsTextFixup();
538 IValueT Rn;
539 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
540 return setNeedsTextFixup();
541 constexpr IValueT Sbc = B2 | B1; // 0110
542 IValueT Src1Value;
543 // TODO(kschimpf) Other possible decodings of sbc.
544 switch (decodeOperand(OpSrc1, Src1Value)) {
545 default:
546 return setNeedsTextFixup();
547 case DecodedAsRegister: {
548 // SBC (register) - ARM section 18.8.162, encoding A1:
549 // sbc{s}<c> <Rd>, <Rn>, <Rm>{, <shift>}
550 //
551 // cccc0000110snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn,
552 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags.
553 constexpr IValueT Imm5 = 0;
554 Src1Value = encodeShiftRotateImm5(Src1Value, OperandARM32::kNoShift, Imm5);
555 if (((Rd == RegARM32::Encoded_Reg_pc) && SetFlags))
556 // Conditions of rule violated.
557 return setNeedsTextFixup();
558 emitType01(Cond, kInstTypeDataRegister, Sbc, SetFlags, Rn, Rd, Src1Value);
559 return;
560 }
561 case DecodedAsRotatedImm8: {
562 // SBC (Immediate) - ARM section A8.8.161, encoding A1:
563 // sbc{s}<c> <Rd>, <Rn>, #<RotatedImm8>
564 //
565 // cccc0010110snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
566 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8.
567 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
568 // Conditions of rule violated.
569 return setNeedsTextFixup();
570 emitType01(Cond, kInstTypeDataImmediate, Sbc, SetFlags, Rn, Rd, Src1Value);
571 return;
572 }
573 };
574 }
575
532 void AssemblerARM32::str(const Operand *OpRt, const Operand *OpAddress, 576 void AssemblerARM32::str(const Operand *OpRt, const Operand *OpAddress,
533 CondARM32::Cond Cond) { 577 CondARM32::Cond Cond) {
534 IValueT Rt; 578 IValueT Rt;
535 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) 579 if (decodeOperand(OpRt, Rt) != DecodedAsRegister)
536 return setNeedsTextFixup(); 580 return setNeedsTextFixup();
537 IValueT Address; 581 IValueT Address;
538 if (decodeAddress(OpAddress, Address) != DecodedAsImmRegOffset) 582 if (decodeAddress(OpAddress, Address) != DecodedAsImmRegOffset)
539 return setNeedsTextFixup(); 583 return setNeedsTextFixup();
540 // STR (immediate) - ARM section A8.8.204, encoding A1: 584 // STR (immediate) - ARM section A8.8.204, encoding A1:
541 // str<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 585 // str<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 // Conditions of rule violated. 651 // Conditions of rule violated.
608 return setNeedsTextFixup(); 652 return setNeedsTextFixup();
609 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value); 653 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value);
610 return; 654 return;
611 } 655 }
612 } 656 }
613 } 657 }
614 658
615 } // end of namespace ARM32 659 } // end of namespace ARM32
616 } // end of namespace Ice 660 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698