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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1388323003: Add "sub immediate" instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove tabs. Created 5 years, 2 months 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 | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('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 10 matching lines...) Expand all
21 //===----------------------------------------------------------------------===// 21 //===----------------------------------------------------------------------===//
22 22
23 #include "IceAssemblerARM32.h" 23 #include "IceAssemblerARM32.h"
24 24
25 namespace { 25 namespace {
26 26
27 using namespace Ice; 27 using namespace Ice;
28 28
29 // The following define individual bits. 29 // The following define individual bits.
30 static constexpr uint32_t B0 = 1; 30 static constexpr uint32_t B0 = 1;
31 static constexpr uint32_t B1 = 1 << 1;
31 static constexpr uint32_t B2 = 1 << 2; 32 static constexpr uint32_t B2 = 1 << 2;
32 static constexpr uint32_t B3 = 1 << 3; 33 static constexpr uint32_t B3 = 1 << 3;
33 static constexpr uint32_t B4 = 1 << 4; 34 static constexpr uint32_t B4 = 1 << 4;
34 static constexpr uint32_t B5 = 1 << 5; 35 static constexpr uint32_t B5 = 1 << 5;
35 static constexpr uint32_t B6 = 1 << 6; 36 static constexpr uint32_t B6 = 1 << 6;
36 static constexpr uint32_t B21 = 1 << 21; 37 static constexpr uint32_t B21 = 1 << 21;
37 static constexpr uint32_t B24 = 1 << 24; 38 static constexpr uint32_t B24 = 1 << 24;
38 39
39 // Constants used for the decoding or encoding of the individual fields of 40 // Constants used for the decoding or encoding of the individual fields of
40 // instructions. Based on ARM section A5.1. 41 // instructions. Based on ARM section A5.1.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 uint32_t Rn = 0; 214 uint32_t Rn = 0;
214 uint32_t Mov = B3 | B2 | B0; // 1101. 215 uint32_t Mov = B3 | B2 | B0; // 1101.
215 uint32_t InstType = 1; 216 uint32_t InstType = 1;
216 emitType01(Cond, InstType, Mov, SetFlags, Rn, Rd, Src); 217 emitType01(Cond, InstType, Mov, SetFlags, Rn, Rd, Src);
217 return; 218 return;
218 } 219 }
219 } while (0); 220 } while (0);
220 UnimplementedError(Ctx->getFlags()); 221 UnimplementedError(Ctx->getFlags());
221 } 222 }
222 223
224 void ARM32::AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn,
225 const Operand *OpSrc1, bool SetFlags,
226 CondARM32::Cond Cond) {
227 // Note: Loop is used so that we can short circuit using break;
228 do {
229 uint32_t Rd;
230 if (decode(OpRd, Rd) != DecodedAsRegister)
231 break;
232 uint32_t Rn;
233 if (decode(OpRn, Rn) != DecodedAsRegister)
234 break;
235 uint32_t Src1Value;
236 // TODO(kschimpf) Other possible decodings of add.
237 if (decode(OpSrc1, Src1Value) == DecodedAsRotatedImm8) {
238 // Sub (Immediate): See ARM section A8.8.222, rule A1.
239 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
240 // s=SetFlags and iiiiiiiiiiii=Src1Value
241 if (!isConditionDefined(Cond) || (Rd == RegARM32::Reg_pc && SetFlags) ||
242 (Rn == RegARM32::Reg_lr) || (Rn == RegARM32::Reg_pc && SetFlags))
243 // Conditions of rule violated.
244 break;
245 uint32_t Add = B1; // 0010
246 uint32_t InstType = 1;
247 emitType01(Cond, InstType, Add, SetFlags, Rn, Rd, Src1Value);
248 return;
249 }
250 } while (0);
251 UnimplementedError(Ctx->getFlags());
252 }
253
223 } // end of namespace Ice 254 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698