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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1403403009: Add MOV (register) to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. 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 | « no previous file | tests_lit/assembler/arm32/mul.ll » ('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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address); 618 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address);
619 } 619 }
620 620
621 void AssemblerARM32::mov(const Operand *OpRd, const Operand *OpSrc, 621 void AssemblerARM32::mov(const Operand *OpRd, const Operand *OpSrc,
622 CondARM32::Cond Cond) { 622 CondARM32::Cond Cond) {
623 IValueT Rd; 623 IValueT Rd;
624 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) 624 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
625 return setNeedsTextFixup(); 625 return setNeedsTextFixup();
626 IValueT Src; 626 IValueT Src;
627 // TODO(kschimpf) Handle other forms of mov. 627 // TODO(kschimpf) Handle other forms of mov.
628 if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8)
629 return setNeedsTextFixup();
630 // MOV (immediate) - ARM section A8.8.102, encoding A1:
631 // mov{S}<c> <Rd>, #<RotatedImm8>
632 //
633 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and
634 // iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this assembler.
635 constexpr bool SetFlags = false; 628 constexpr bool SetFlags = false;
636 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
637 // Conditions of rule violated.
638 return setNeedsTextFixup();
639 constexpr IValueT Rn = 0; 629 constexpr IValueT Rn = 0;
640 constexpr IValueT Mov = B3 | B2 | B0; // 1101. 630 constexpr IValueT Mov = B3 | B2 | B0; // 1101.
641 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src); 631 switch (decodeOperand(OpSrc, Src)) {
632 default:
Jim Stichnoth 2015/10/30 21:47:02 Do you mean for the default case to fallthrough?
Karl 2015/10/30 22:15:31 Hmm, must be inhaling too many fumes. Fixing to re
633 case DecodedAsRegister: {
634 // MOV (register) - ARM section A8.8.104, encoding A1:
635 // mov{S}<c> <Rd>, <Rn>
636 //
637 // cccc0001101s0000dddd00000000mmmm where cccc=Cond, s=SetFlags, dddd=Rd,
638 // and nnnn=Rn.
639 return setNeedsTextFixup();
Jim Stichnoth 2015/10/30 21:47:02 The code below this is unreachable...
Karl 2015/10/30 22:15:31 Apparently here is where I misplaced the default c
640 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
641 // Conditions of rule violated.
642 return setNeedsTextFixup();
643 emitType01(Cond, kInstTypeDataRegister, Mov, SetFlags, Rn, Rd, Src);
644 return;
645 }
646 case DecodedAsRotatedImm8: {
647 // MOV (immediate) - ARM section A8.8.102, encoding A1:
648 // mov{S}<c> <Rd>, #<RotatedImm8>
649 //
650 // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd,
651 // and iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this
652 // assembler.
653 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
654 // Conditions of rule violated.
655 return setNeedsTextFixup();
656 emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src);
657 return;
658 }
659 }
642 } 660 }
643 661
644 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc, 662 void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc,
645 CondARM32::Cond Cond) { 663 CondARM32::Cond Cond) {
646 IValueT Rd; 664 IValueT Rd;
647 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) 665 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
648 return setNeedsTextFixup(); 666 return setNeedsTextFixup();
649 auto *Src = llvm::dyn_cast<ConstantRelocatable>(OpSrc); 667 auto *Src = llvm::dyn_cast<ConstantRelocatable>(OpSrc);
650 if (Src == nullptr) 668 if (Src == nullptr)
651 return setNeedsTextFixup(); 669 return setNeedsTextFixup();
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // sub{s}<c> sp, <Rn>, #<RotatedImm8> 879 // sub{s}<c> sp, <Rn>, #<RotatedImm8>
862 // 880 //
863 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 881 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
864 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8 882 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8
865 constexpr IValueT Sub = B1; // 0010 883 constexpr IValueT Sub = B1; // 0010
866 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); 884 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond);
867 } 885 }
868 886
869 } // end of namespace ARM32 887 } // end of namespace ARM32
870 } // end of namespace Ice 888 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/mul.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698