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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1521133002: Add CLZ instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix comment in clz.ll 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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 constexpr const char *BxName = "bx"; 1080 constexpr const char *BxName = "bx";
1081 verifyCondDefined(Cond, BxName); 1081 verifyCondDefined(Cond, BxName);
1082 verifyRegDefined(Rm, "Rm", BxName); 1082 verifyRegDefined(Rm, "Rm", BxName);
1083 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 1083 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
1084 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | 1084 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B24 |
1085 B21 | (0xfff << 8) | B4 | 1085 B21 | (0xfff << 8) | B4 |
1086 (encodeGPRRegister(Rm) << kRmShift); 1086 (encodeGPRRegister(Rm) << kRmShift);
1087 emitInst(Encoding); 1087 emitInst(Encoding);
1088 } 1088 }
1089 1089
1090 void AssemblerARM32::clz(const Operand *OpRd, const Operand *OpSrc,
1091 CondARM32::Cond Cond) {
1092 // CLZ - ARM section A8.8.33, encoding A1:
1093 // clz<c> <Rd> <Rm>
1094 //
1095 // cccc000101101111dddd11110001mmmm where cccc=Cond, dddd=Rd, and mmmm=Rm.
1096 constexpr const char *ClzName = "clz";
1097 constexpr const char *RdName = "Rd";
1098 constexpr const char *RmName = "Rm";
1099 IValueT Rd = encodeRegister(OpRd, RdName, ClzName);
1100 verifyRegDefined(Rd, RdName, ClzName);
1101 verifyRegNotPc(Rd, RdName, ClzName);
1102 IValueT Rm = encodeRegister(OpSrc, RmName, ClzName);
1103 verifyRegDefined(Rm, RmName, ClzName);
1104 verifyRegNotPc(Rm, RmName, ClzName);
1105 verifyCondDefined(Cond, ClzName);
1106 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
1107 constexpr IValueT PredefinedBits =
1108 B24 | B22 | B21 | (0xF << 16) | (0xf << 8) | B4;
1109 const IValueT Encoding = PredefinedBits | (Cond << kConditionShift) |
1110 (Rd << kRdShift) | (Rm << kRmShift);
1111 emitInst(Encoding);
1112 }
1113
1090 void AssemblerARM32::cmn(const Operand *OpRn, const Operand *OpSrc1, 1114 void AssemblerARM32::cmn(const Operand *OpRn, const Operand *OpSrc1,
1091 CondARM32::Cond Cond) { 1115 CondARM32::Cond Cond) {
1092 // CMN (immediate) - ARM section A8.8.34, encoding A1: 1116 // CMN (immediate) - ARM section A8.8.34, encoding A1:
1093 // cmn<c> <Rn>, #<RotatedImm8> 1117 // cmn<c> <Rn>, #<RotatedImm8>
1094 // 1118 //
1095 // cccc00110111nnnn0000iiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 1119 // cccc00110111nnnn0000iiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
1096 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. 1120 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8.
1097 // 1121 //
1098 // CMN (register) - ARM section A8.8.35, encodeing A1: 1122 // CMN (register) - ARM section A8.8.35, encodeing A1:
1099 // cmn<c> <Rn>, <Rm>{, <shift>} 1123 // cmn<c> <Rn>, <Rm>{, <shift>}
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 1802
1779 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, 1803 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0,
1780 CondARM32::Cond Cond) { 1804 CondARM32::Cond Cond) {
1781 constexpr const char *UxtName = "uxt"; 1805 constexpr const char *UxtName = "uxt";
1782 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; 1806 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21;
1783 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); 1807 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName);
1784 } 1808 }
1785 1809
1786 } // end of namespace ARM32 1810 } // end of namespace ARM32
1787 } // end of namespace Ice 1811 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | tests_lit/assembler/arm32/clz.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698