OLD | NEW |
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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 // cccc0000000sdddd0000mmmm1001nnnn where cccc=Cond, dddd=Rd, nnnn=Rn, | 837 // cccc0000000sdddd0000mmmm1001nnnn where cccc=Cond, dddd=Rd, nnnn=Rn, |
838 // mmmm=Rm, and s=SetFlags. | 838 // mmmm=Rm, and s=SetFlags. |
839 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc || | 839 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc || |
840 Rm == RegARM32::Encoded_Reg_pc) | 840 Rm == RegARM32::Encoded_Reg_pc) |
841 llvm::report_fatal_error("Mul instruction unpredictable on pc"); | 841 llvm::report_fatal_error("Mul instruction unpredictable on pc"); |
842 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. | 842 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. |
843 constexpr IValueT MulOpcode = 0; | 843 constexpr IValueT MulOpcode = 0; |
844 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags); | 844 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags); |
845 } | 845 } |
846 | 846 |
| 847 void AssemblerARM32::udiv(const Operand *OpRd, const Operand *OpRn, |
| 848 const Operand *OpSrc1, CondARM32::Cond Cond) { |
| 849 // UDIV - ARM section A8.8.248, encoding A1. |
| 850 // udiv<c> <Rd>, <Rn>, <Rm> |
| 851 // |
| 852 // cccc01110011dddd1111mmmm0001nnnn where cccc=Cond, dddd=Rd, nnnn=Rn, and |
| 853 // mmmm=Rm. |
| 854 IValueT Rd; |
| 855 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) |
| 856 return setNeedsTextFixup(); |
| 857 IValueT Rn; |
| 858 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) |
| 859 return setNeedsTextFixup(); |
| 860 IValueT Rm; |
| 861 if (decodeOperand(OpSrc1, Rm) != DecodedAsRegister) |
| 862 return setNeedsTextFixup(); |
| 863 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc || |
| 864 Rm == RegARM32::Encoded_Reg_pc) |
| 865 llvm::report_fatal_error("Sdiv instruction unpredictable on pc"); |
| 866 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. |
| 867 constexpr IValueT Opcode = B21; |
| 868 emitDivOp(Cond, Opcode, Rd, Rn, Rm); |
| 869 } |
| 870 |
847 void AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn, | 871 void AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn, |
848 const Operand *OpSrc1, bool SetFlags, | 872 const Operand *OpSrc1, bool SetFlags, |
849 CondARM32::Cond Cond) { | 873 CondARM32::Cond Cond) { |
850 // SUB (register) - ARM section A8.8.223, encoding A1: | 874 // SUB (register) - ARM section A8.8.223, encoding A1: |
851 // sub{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} | 875 // sub{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} |
852 // SUB (SP minus register): See ARM section 8.8.226, encoding A1: | 876 // SUB (SP minus register): See ARM section 8.8.226, encoding A1: |
853 // sub{s}<c> <Rd>, sp, <Rm>{, <Shift>} | 877 // sub{s}<c> <Rd>, sp, <Rm>{, <Shift>} |
854 // | 878 // |
855 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 879 // cccc0000010snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
856 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. | 880 // mmmm=Rm, iiiiii=shift, tt=ShiftKind, and s=SetFlags. |
857 // | 881 // |
858 // Sub (Immediate) - ARM section A8.8.222, encoding A1: | 882 // Sub (Immediate) - ARM section A8.8.222, encoding A1: |
859 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 883 // sub{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
860 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: | 884 // Sub (Sp minus immediate) - ARM section A8.*.225, encoding A1: |
861 // sub{s}<c> sp, <Rn>, #<RotatedImm8> | 885 // sub{s}<c> sp, <Rn>, #<RotatedImm8> |
862 // | 886 // |
863 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 887 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
864 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8 | 888 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8 |
865 constexpr IValueT Sub = B1; // 0010 | 889 constexpr IValueT Sub = B1; // 0010 |
866 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); | 890 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); |
867 } | 891 } |
868 | 892 |
869 } // end of namespace ARM32 | 893 } // end of namespace ARM32 |
870 } // end of namespace Ice | 894 } // end of namespace Ice |
OLD | NEW |