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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1530233004: add RBIT instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Update DART source. Created 5 years 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
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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName); 1772 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName);
1773 verifyRegNotPc(Rd, "Rd", MulName); 1773 verifyRegNotPc(Rd, "Rd", MulName);
1774 verifyRegNotPc(Rn, "Rn", MulName); 1774 verifyRegNotPc(Rn, "Rn", MulName);
1775 verifyRegNotPc(Rm, "Rm", MulName); 1775 verifyRegNotPc(Rm, "Rm", MulName);
1776 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. 1776 // Assembler registers rd, rn, rm are encoded as rn, rm, rs.
1777 constexpr IValueT MulOpcode = 0; 1777 constexpr IValueT MulOpcode = 0;
1778 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags, 1778 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags,
1779 MulName); 1779 MulName);
1780 } 1780 }
1781 1781
1782 void AssemblerARM32::rev(const Operand *OpRd, const Operand *OpSrc, 1782 void AssemblerARM32::emitRdRm(CondARM32::Cond Cond, IValueT Opcode,
1783 CondARM32::Cond Cond) { 1783 const Operand *OpRd, const Operand *OpRm,
1784 // REV - ARM section A8.8.145, encoding A1: 1784 const char *InstName) {
1785 // rev <Rd>, <Rm> 1785 IValueT Rd = encodeRegister(OpRd, "Rd", InstName);
1786 // 1786 IValueT Rm = encodeRegister(OpRm, "Rm", InstName);
1787 // cccc011010111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm.
1788 constexpr const char *RevName = "rev";
1789 IValueT Rd = encodeRegister(OpRd, "Rd", RevName);
1790 IValueT Rm = encodeRegister(OpSrc, "Rm", RevName);
1791 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 1787 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
1792 constexpr IValueT Opcode = B26 | B25 | B23 | B21 | B20 | B19 | B18 | B17 |
1793 B16 | B11 | B10 | B9 | B8 | B5 | B4;
1794 IValueT Encoding = 1788 IValueT Encoding =
1795 (Cond << kConditionShift) | Opcode | (Rd << kRdShift) | (Rm << kRmShift); 1789 (Cond << kConditionShift) | Opcode | (Rd << kRdShift) | (Rm << kRmShift);
1796 emitInst(Encoding); 1790 emitInst(Encoding);
1797 } 1791 }
1798 1792
1793 void AssemblerARM32::rbit(const Operand *OpRd, const Operand *OpRm,
1794 CondARM32::Cond Cond) {
1795 // RBIT - ARM section A8.8.144, encoding A1:
1796 // rbit<c> <Rd>, <Rm>
1797 //
1798 // cccc011011111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm.
1799 constexpr const char *RbitName = "rev";
1800 constexpr IValueT RbitOpcode = B26 | B25 | B23 | B22 | B21 | B20 | B19 | B18 |
1801 B17 | B16 | B11 | B10 | B9 | B8 | B5 | B4;
1802 emitRdRm(Cond, RbitOpcode, OpRd, OpRm, RbitName);
1803 }
1804
1805 void AssemblerARM32::rev(const Operand *OpRd, const Operand *OpRm,
1806 CondARM32::Cond Cond) {
1807 // REV - ARM section A8.8.145, encoding A1:
1808 // rev<c> <Rd>, <Rm>
1809 //
1810 // cccc011010111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm.
1811 constexpr const char *RevName = "rev";
1812 constexpr IValueT RevOpcode = B26 | B25 | B23 | B21 | B20 | B19 | B18 | B17 |
1813 B16 | B11 | B10 | B9 | B8 | B5 | B4;
1814 emitRdRm(Cond, RevOpcode, OpRd, OpRm, RevName);
1815 }
1816
1799 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn, 1817 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn,
1800 const Operand *OpSrc1, bool SetFlags, 1818 const Operand *OpSrc1, bool SetFlags,
1801 CondARM32::Cond Cond) { 1819 CondARM32::Cond Cond) {
1802 // RSB (immediate) - ARM section A8.8.152, encoding A1. 1820 // RSB (immediate) - ARM section A8.8.152, encoding A1.
1803 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8> 1821 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8>
1804 // 1822 //
1805 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 1823 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
1806 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value. 1824 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value.
1807 // 1825 //
1808 // RSB (register) - ARM section A8.8.163, encoding A1. 1826 // RSB (register) - ARM section A8.8.163, encoding A1.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 1974
1957 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, 1975 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0,
1958 CondARM32::Cond Cond) { 1976 CondARM32::Cond Cond) {
1959 constexpr const char *UxtName = "uxt"; 1977 constexpr const char *UxtName = "uxt";
1960 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; 1978 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21;
1961 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); 1979 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName);
1962 } 1980 }
1963 1981
1964 } // end of namespace ARM32 1982 } // end of namespace ARM32
1965 } // end of namespace Ice 1983 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | tests_lit/assembler/arm32/rbit.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698