| 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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName); | 1790 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName); |
| 1791 verifyRegNotPc(Rd, "Rd", MulName); | 1791 verifyRegNotPc(Rd, "Rd", MulName); |
| 1792 verifyRegNotPc(Rn, "Rn", MulName); | 1792 verifyRegNotPc(Rn, "Rn", MulName); |
| 1793 verifyRegNotPc(Rm, "Rm", MulName); | 1793 verifyRegNotPc(Rm, "Rm", MulName); |
| 1794 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. | 1794 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. |
| 1795 constexpr IValueT MulOpcode = 0; | 1795 constexpr IValueT MulOpcode = 0; |
| 1796 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags, | 1796 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags, |
| 1797 MulName); | 1797 MulName); |
| 1798 } | 1798 } |
| 1799 | 1799 |
| 1800 void AssemblerARM32::rev(const Operand *OpRd, const Operand *OpSrc, | 1800 void AssemblerARM32::emitRdRm(CondARM32::Cond Cond, IValueT Opcode, |
| 1801 CondARM32::Cond Cond) { | 1801 const Operand *OpRd, const Operand *OpRm, |
| 1802 // REV - ARM section A8.8.145, encoding A1: | 1802 const char *InstName) { |
| 1803 // rev <Rd>, <Rm> | 1803 IValueT Rd = encodeRegister(OpRd, "Rd", InstName); |
| 1804 // | 1804 IValueT Rm = encodeRegister(OpRm, "Rm", InstName); |
| 1805 // cccc011010111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm. | |
| 1806 constexpr const char *RevName = "rev"; | |
| 1807 IValueT Rd = encodeRegister(OpRd, "Rd", RevName); | |
| 1808 IValueT Rm = encodeRegister(OpSrc, "Rm", RevName); | |
| 1809 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 1805 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 1810 constexpr IValueT Opcode = B26 | B25 | B23 | B21 | B20 | B19 | B18 | B17 | | |
| 1811 B16 | B11 | B10 | B9 | B8 | B5 | B4; | |
| 1812 IValueT Encoding = | 1806 IValueT Encoding = |
| 1813 (Cond << kConditionShift) | Opcode | (Rd << kRdShift) | (Rm << kRmShift); | 1807 (Cond << kConditionShift) | Opcode | (Rd << kRdShift) | (Rm << kRmShift); |
| 1814 emitInst(Encoding); | 1808 emitInst(Encoding); |
| 1815 } | 1809 } |
| 1816 | 1810 |
| 1811 void AssemblerARM32::rbit(const Operand *OpRd, const Operand *OpRm, |
| 1812 CondARM32::Cond Cond) { |
| 1813 // RBIT - ARM section A8.8.144, encoding A1: |
| 1814 // rbit<c> <Rd>, <Rm> |
| 1815 // |
| 1816 // cccc011011111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm. |
| 1817 constexpr const char *RbitName = "rev"; |
| 1818 constexpr IValueT RbitOpcode = B26 | B25 | B23 | B22 | B21 | B20 | B19 | B18 | |
| 1819 B17 | B16 | B11 | B10 | B9 | B8 | B5 | B4; |
| 1820 emitRdRm(Cond, RbitOpcode, OpRd, OpRm, RbitName); |
| 1821 } |
| 1822 |
| 1823 void AssemblerARM32::rev(const Operand *OpRd, const Operand *OpRm, |
| 1824 CondARM32::Cond Cond) { |
| 1825 // REV - ARM section A8.8.145, encoding A1: |
| 1826 // rev<c> <Rd>, <Rm> |
| 1827 // |
| 1828 // cccc011010111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm. |
| 1829 constexpr const char *RevName = "rev"; |
| 1830 constexpr IValueT RevOpcode = B26 | B25 | B23 | B21 | B20 | B19 | B18 | B17 | |
| 1831 B16 | B11 | B10 | B9 | B8 | B5 | B4; |
| 1832 emitRdRm(Cond, RevOpcode, OpRd, OpRm, RevName); |
| 1833 } |
| 1834 |
| 1817 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn, | 1835 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn, |
| 1818 const Operand *OpSrc1, bool SetFlags, | 1836 const Operand *OpSrc1, bool SetFlags, |
| 1819 CondARM32::Cond Cond) { | 1837 CondARM32::Cond Cond) { |
| 1820 // RSB (immediate) - ARM section A8.8.152, encoding A1. | 1838 // RSB (immediate) - ARM section A8.8.152, encoding A1. |
| 1821 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8> | 1839 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 1822 // | 1840 // |
| 1823 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 1841 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 1824 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value. | 1842 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value. |
| 1825 // | 1843 // |
| 1826 // RSB (register) - ARM section A8.8.163, encoding A1. | 1844 // RSB (register) - ARM section A8.8.163, encoding A1. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 | 1992 |
| 1975 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, | 1993 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, |
| 1976 CondARM32::Cond Cond) { | 1994 CondARM32::Cond Cond) { |
| 1977 constexpr const char *UxtName = "uxt"; | 1995 constexpr const char *UxtName = "uxt"; |
| 1978 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; | 1996 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; |
| 1979 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); | 1997 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); |
| 1980 } | 1998 } |
| 1981 | 1999 |
| 1982 } // end of namespace ARM32 | 2000 } // end of namespace ARM32 |
| 1983 } // end of namespace Ice | 2001 } // end of namespace Ice |
| OLD | NEW |