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

Side by Side Diff: src/a64/constants-a64.h

Issue 144963003: A64: add missing files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/codegen-a64.cc ('k') | src/a64/cpu-a64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_A64_CONSTANTS_A64_H_
29 #define V8_A64_CONSTANTS_A64_H_
30
31
32 // Assert that this is an LP64 system.
33 STATIC_ASSERT(sizeof(int) == sizeof(int32_t)); // NOLINT(runtime/sizeof)
34 STATIC_ASSERT(sizeof(long) == sizeof(int64_t)); // NOLINT(runtime/int)
35 STATIC_ASSERT(sizeof(void *) == sizeof(int64_t)); // NOLINT(runtime/sizeof)
36 STATIC_ASSERT(sizeof(1) == sizeof(int32_t)); // NOLINT(runtime/sizeof)
37 STATIC_ASSERT(sizeof(1L) == sizeof(int64_t)); // NOLINT(runtime/sizeof)
38
39
40 // Get the standard printf format macros for C99 stdint types.
41 #define __STDC_FORMAT_MACROS
42 #include <inttypes.h>
43
44
45 namespace v8 {
46 namespace internal {
47
48
49 const unsigned kInstructionSize = 4;
50 const unsigned kInstructionSizeLog2 = 2;
51 const unsigned kLiteralEntrySize = 4;
52 const unsigned kLiteralEntrySizeLog2 = 2;
53 const unsigned kMaxLoadLiteralRange = 1 * MB;
54
55 const unsigned kNumberOfRegisters = 32;
56 const unsigned kNumberOfFPRegisters = 32;
57 // Callee saved registers are x19-x30(lr).
58 const int kNumberOfCalleeSavedRegisters = 11;
59 const int kFirstCalleeSavedRegisterIndex = 19;
60 // Callee saved FP registers are d8-d15.
61 const int kNumberOfCalleeSavedFPRegisters = 8;
62 const int kFirstCalleeSavedFPRegisterIndex = 8;
63 // Callee saved registers with no specific purpose in JS are x19-x25.
64 const unsigned kJSCalleeSavedRegList = 0x03f80000;
65 // TODO(all): k<Y>RegSize should probably be k<Y>RegSizeInBits.
66 const unsigned kWRegSize = 32;
67 const unsigned kWRegSizeLog2 = 5;
68 const unsigned kWRegSizeInBytes = kWRegSize / 8;
69 const unsigned kWRegSizeInBytesLog2 = kWRegSizeLog2 - 3;
70 const unsigned kXRegSize = 64;
71 const unsigned kXRegSizeLog2 = 6;
72 const unsigned kXRegSizeInBytes = kXRegSize / 8;
73 const unsigned kXRegSizeInBytesLog2 = kXRegSizeLog2 - 3;
74 const unsigned kSRegSize = 32;
75 const unsigned kSRegSizeLog2 = 5;
76 const unsigned kSRegSizeInBytes = kSRegSize / 8;
77 const unsigned kSRegSizeInBytesLog2 = kSRegSizeLog2 - 3;
78 const unsigned kDRegSize = 64;
79 const unsigned kDRegSizeLog2 = 6;
80 const unsigned kDRegSizeInBytes = kDRegSize / 8;
81 const unsigned kDRegSizeInBytesLog2 = kDRegSizeLog2 - 3;
82 const int64_t kWRegMask = 0x00000000ffffffffL;
83 const int64_t kXRegMask = 0xffffffffffffffffL;
84 const int64_t kSRegMask = 0x00000000ffffffffL;
85 const int64_t kDRegMask = 0xffffffffffffffffL;
86 // TODO(all) check if the expression below works on all compilers or if it
87 // triggers an overflow error.
88 const int64_t kDSignMask = 0x1L << 63;
89 const int64_t kDSignBit = 63;
90 const int64_t kXSignMask = 0x1L << 63;
91 const int64_t kXSignBit = 63;
92 const int64_t kWSignMask = 0x1L << 31;
93 const int64_t kWSignBit = 31;
94 const int64_t kByteMask = 0xffL;
95 const int64_t kHalfWordMask = 0xffffL;
96 const int64_t kWordMask = 0xffffffffL;
97 const uint64_t kXMaxUInt = 0xffffffffffffffffUL;
98 const uint64_t kWMaxUInt = 0xffffffffUL;
99 const int64_t kXMaxInt = 0x7fffffffffffffffL;
100 const int64_t kXMinInt = 0x8000000000000000L;
101 const int32_t kWMaxInt = 0x7fffffff;
102 const int32_t kWMinInt = 0x80000000;
103 const unsigned kFramePointerRegCode = 29;
104 const unsigned kLinkRegCode = 30;
105 const unsigned kZeroRegCode = 31;
106 const unsigned kJSSPCode = 28;
107 const unsigned kSPRegInternalCode = 63;
108 const unsigned kRegCodeMask = 0x1f;
109 // Standard machine types defined by AAPCS64.
110 const unsigned kByteSize = 8;
111 const unsigned kByteSizeInBytes = kByteSize / 8;
112 const unsigned kHalfWordSize = 16;
113 const unsigned kHalfWordSizeLog2 = 4;
114 const unsigned kHalfWordSizeInBytes = kHalfWordSizeInBytes / 8;
115 const unsigned kHalfWordSizeInBytesLog2 = kHalfWordSizeLog2 - 3;
116 const unsigned kWordSize = 32;
117 const unsigned kWordSizeLog2 = 5;
118 const unsigned kWordSizeInBytes = kWordSizeInBytes / 8;
119 const unsigned kWordSizeInBytesLog2 = kWordSizeLog2 - 3;
120 const unsigned kDoubleWordSize = 64;
121 const unsigned kDoubleWordSizeInBytes = kDoubleWordSizeInBytes / 8;
122 const unsigned kQuadWordSize = 128;
123 const unsigned kQuadWordSizeInBytes = kQuadWordSizeInBytes / 8;
124 // AArch64 floating-point specifics. These match IEEE-754.
125 const unsigned kDoubleMantissaBits = 52;
126 const unsigned kDoubleExponentBits = 11;
127 const unsigned kFloatMantissaBits = 23;
128 const unsigned kFloatExponentBits = 8;
129
130 #define REGISTER_CODE_LIST(R) \
131 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \
132 R(8) R(9) R(10) R(11) R(12) R(13) R(14) R(15) \
133 R(16) R(17) R(18) R(19) R(20) R(21) R(22) R(23) \
134 R(24) R(25) R(26) R(27) R(28) R(29) R(30) R(31)
135
136 #define INSTRUCTION_FIELDS_LIST(V_) \
137 /* Register fields */ \
138 V_(Rd, 4, 0, Bits) /* Destination register. */ \
139 V_(Rn, 9, 5, Bits) /* First source register. */ \
140 V_(Rm, 20, 16, Bits) /* Second source register. */ \
141 V_(Ra, 14, 10, Bits) /* Third source register. */ \
142 V_(Rt, 4, 0, Bits) /* Load dest / store source. */ \
143 V_(Rt2, 14, 10, Bits) /* Load second dest / */ \
144 /* store second source. */ \
145 V_(PrefetchMode, 4, 0, Bits) \
146 \
147 /* Common bits */ \
148 V_(SixtyFourBits, 31, 31, Bits) \
149 V_(FlagsUpdate, 29, 29, Bits) \
150 \
151 /* PC relative addressing */ \
152 V_(ImmPCRelHi, 23, 5, SignedBits) \
153 V_(ImmPCRelLo, 30, 29, Bits) \
154 \
155 /* Add/subtract/logical shift register */ \
156 V_(ShiftDP, 23, 22, Bits) \
157 V_(ImmDPShift, 15, 10, Bits) \
158 \
159 /* Add/subtract immediate */ \
160 V_(ImmAddSub, 21, 10, Bits) \
161 V_(ShiftAddSub, 23, 22, Bits) \
162 \
163 /* Add/substract extend */ \
164 V_(ImmExtendShift, 12, 10, Bits) \
165 V_(ExtendMode, 15, 13, Bits) \
166 \
167 /* Move wide */ \
168 V_(ImmMoveWide, 20, 5, Bits) \
169 V_(ShiftMoveWide, 22, 21, Bits) \
170 \
171 /* Logical immediate, bitfield and extract */ \
172 V_(BitN, 22, 22, Bits) \
173 V_(ImmRotate, 21, 16, Bits) \
174 V_(ImmSetBits, 15, 10, Bits) \
175 V_(ImmR, 21, 16, Bits) \
176 V_(ImmS, 15, 10, Bits) \
177 \
178 /* Test and branch immediate */ \
179 V_(ImmTestBranch, 18, 5, SignedBits) \
180 V_(ImmTestBranchBit40, 23, 19, Bits) \
181 V_(ImmTestBranchBit5, 31, 31, Bits) \
182 \
183 /* Conditionals */ \
184 V_(Condition, 15, 12, Bits) \
185 V_(ConditionBranch, 3, 0, Bits) \
186 V_(Nzcv, 3, 0, Bits) \
187 V_(ImmCondCmp, 20, 16, Bits) \
188 V_(ImmCondBranch, 23, 5, SignedBits) \
189 \
190 /* Floating point */ \
191 V_(FPType, 23, 22, Bits) \
192 V_(ImmFP, 20, 13, Bits) \
193 V_(FPScale, 15, 10, Bits) \
194 \
195 /* Load Store */ \
196 V_(ImmLS, 20, 12, SignedBits) \
197 V_(ImmLSUnsigned, 21, 10, Bits) \
198 V_(ImmLSPair, 21, 15, SignedBits) \
199 V_(SizeLS, 31, 30, Bits) \
200 V_(ImmShiftLS, 12, 12, Bits) \
201 \
202 /* Other immediates */ \
203 V_(ImmUncondBranch, 25, 0, SignedBits) \
204 V_(ImmCmpBranch, 23, 5, SignedBits) \
205 V_(ImmLLiteral, 23, 5, SignedBits) \
206 V_(ImmException, 20, 5, Bits) \
207 V_(ImmHint, 11, 5, Bits) \
208 V_(ImmBarrierDomain, 11, 10, Bits) \
209 V_(ImmBarrierType, 9, 8, Bits) \
210 \
211 /* System (MRS, MSR) */ \
212 V_(ImmSystemRegister, 19, 5, Bits) \
213 V_(SysO0, 19, 19, Bits) \
214 V_(SysOp1, 18, 16, Bits) \
215 V_(SysOp2, 7, 5, Bits) \
216 V_(CRn, 15, 12, Bits) \
217 V_(CRm, 11, 8, Bits) \
218
219
220 #define SYSTEM_REGISTER_FIELDS_LIST(V_, M_) \
221 /* NZCV */ \
222 V_(Flags, 31, 28, Bits) \
223 V_(N, 31, 31, Bits) \
224 V_(Z, 30, 30, Bits) \
225 V_(C, 29, 29, Bits) \
226 V_(V, 28, 28, Bits) \
227 M_(NZCV, Flags_mask) \
228 \
229 /* FPCR */ \
230 V_(AHP, 26, 26, Bits) \
231 V_(DN, 25, 25, Bits) \
232 V_(FZ, 24, 24, Bits) \
233 V_(RMode, 23, 22, Bits) \
234 M_(FPCR, AHP_mask | DN_mask | FZ_mask | RMode_mask)
235
236
237 // Fields offsets.
238 #define DECLARE_FIELDS_OFFSETS(Name, HighBit, LowBit, X) \
239 const int Name##_offset = LowBit; \
240 const int Name##_width = HighBit - LowBit + 1; \
241 const uint32_t Name##_mask = ((1 << Name##_width) - 1) << LowBit;
242 #define NOTHING(A, B)
243 INSTRUCTION_FIELDS_LIST(DECLARE_FIELDS_OFFSETS)
244 SYSTEM_REGISTER_FIELDS_LIST(DECLARE_FIELDS_OFFSETS, NOTHING)
245 #undef NOTHING
246 #undef DECLARE_FIELDS_BITS
247
248 // ImmPCRel is a compound field (not present in INSTRUCTION_FIELDS_LIST), formed
249 // from ImmPCRelLo and ImmPCRelHi.
250 const int ImmPCRel_mask = ImmPCRelLo_mask | ImmPCRelHi_mask;
251
252 // Condition codes.
253 enum Condition {
254 eq = 0,
255 ne = 1,
256 hs = 2,
257 lo = 3,
258 mi = 4,
259 pl = 5,
260 vs = 6,
261 vc = 7,
262 hi = 8,
263 ls = 9,
264 ge = 10,
265 lt = 11,
266 gt = 12,
267 le = 13,
268 al = 14,
269 nv = 15 // Behaves as always/al.
270 };
271
272 inline Condition InvertCondition(Condition cond) {
273 // Conditions al and nv behave identically, as "always true". They can't be
274 // inverted, because there is no never condition.
275 ASSERT((cond != al) && (cond != nv));
276 return static_cast<Condition>(cond ^ 1);
277 }
278
279 // Corresponds to transposing the operands of a comparison.
280 inline Condition ReverseConditionForCmp(Condition cond) {
281 switch (cond) {
282 case lo:
283 return hi;
284 case hi:
285 return lo;
286 case hs:
287 return ls;
288 case ls:
289 return hs;
290 case lt:
291 return gt;
292 case gt:
293 return lt;
294 case ge:
295 return le;
296 case le:
297 return ge;
298 case eq:
299 return eq;
300 default:
301 // In practice this function is only used with a condition coming from
302 // TokenToCondition in lithium-codegen-a64.cc. Any other condition is
303 // invalid as it doesn't necessary make sense to reverse it (consider
304 // 'mi' for instance).
305 UNREACHABLE();
306 return nv;
307 };
308 }
309
310 enum FlagsUpdate {
311 SetFlags = 1,
312 LeaveFlags = 0
313 };
314
315 enum StatusFlags {
316 NoFlag = 0,
317
318 // Derive the flag combinations from the system register bit descriptions.
319 NFlag = N_mask,
320 ZFlag = Z_mask,
321 CFlag = C_mask,
322 VFlag = V_mask,
323 NZFlag = NFlag | ZFlag,
324 NCFlag = NFlag | CFlag,
325 NVFlag = NFlag | VFlag,
326 ZCFlag = ZFlag | CFlag,
327 ZVFlag = ZFlag | VFlag,
328 CVFlag = CFlag | VFlag,
329 NZCFlag = NFlag | ZFlag | CFlag,
330 NZVFlag = NFlag | ZFlag | VFlag,
331 NCVFlag = NFlag | CFlag | VFlag,
332 ZCVFlag = ZFlag | CFlag | VFlag,
333 NZCVFlag = NFlag | ZFlag | CFlag | VFlag,
334
335 // Floating-point comparison results.
336 FPEqualFlag = ZCFlag,
337 FPLessThanFlag = NFlag,
338 FPGreaterThanFlag = CFlag,
339 FPUnorderedFlag = CVFlag
340 };
341
342 enum Shift {
343 NO_SHIFT = -1,
344 LSL = 0x0,
345 LSR = 0x1,
346 ASR = 0x2,
347 ROR = 0x3
348 };
349
350 enum Extend {
351 NO_EXTEND = -1,
352 UXTB = 0,
353 UXTH = 1,
354 UXTW = 2,
355 UXTX = 3,
356 SXTB = 4,
357 SXTH = 5,
358 SXTW = 6,
359 SXTX = 7
360 };
361
362 enum SystemHint {
363 NOP = 0,
364 YIELD = 1,
365 WFE = 2,
366 WFI = 3,
367 SEV = 4,
368 SEVL = 5
369 };
370
371 enum BarrierDomain {
372 OuterShareable = 0,
373 NonShareable = 1,
374 InnerShareable = 2,
375 FullSystem = 3
376 };
377
378 enum BarrierType {
379 BarrierOther = 0,
380 BarrierReads = 1,
381 BarrierWrites = 2,
382 BarrierAll = 3
383 };
384
385 // System/special register names.
386 // This information is not encoded as one field but as the concatenation of
387 // multiple fields (Op0<0>, Op1, Crn, Crm, Op2).
388 enum SystemRegister {
389 NZCV = ((0x1 << SysO0_offset) |
390 (0x3 << SysOp1_offset) |
391 (0x4 << CRn_offset) |
392 (0x2 << CRm_offset) |
393 (0x0 << SysOp2_offset)) >> ImmSystemRegister_offset,
394 FPCR = ((0x1 << SysO0_offset) |
395 (0x3 << SysOp1_offset) |
396 (0x4 << CRn_offset) |
397 (0x4 << CRm_offset) |
398 (0x0 << SysOp2_offset)) >> ImmSystemRegister_offset
399 };
400
401 // Instruction enumerations.
402 //
403 // These are the masks that define a class of instructions, and the list of
404 // instructions within each class. Each enumeration has a Fixed, FMask and
405 // Mask value.
406 //
407 // Fixed: The fixed bits in this instruction class.
408 // FMask: The mask used to extract the fixed bits in the class.
409 // Mask: The mask used to identify the instructions within a class.
410 //
411 // The enumerations can be used like this:
412 //
413 // ASSERT(instr->Mask(PCRelAddressingFMask) == PCRelAddressingFixed);
414 // switch(instr->Mask(PCRelAddressingMask)) {
415 // case ADR: Format("adr 'Xd, 'AddrPCRelByte"); break;
416 // case ADRP: Format("adrp 'Xd, 'AddrPCRelPage"); break;
417 // default: printf("Unknown instruction\n");
418 // }
419
420
421 // Generic fields.
422 enum GenericInstrField {
423 SixtyFourBits = 0x80000000,
424 ThirtyTwoBits = 0x00000000,
425 FP32 = 0x00000000,
426 FP64 = 0x00400000
427 };
428
429 // PC relative addressing.
430 enum PCRelAddressingOp {
431 PCRelAddressingFixed = 0x10000000,
432 PCRelAddressingFMask = 0x1F000000,
433 PCRelAddressingMask = 0x9F000000,
434 ADR = PCRelAddressingFixed | 0x00000000,
435 ADRP = PCRelAddressingFixed | 0x80000000
436 };
437
438 // Add/sub (immediate, shifted and extended.)
439 const int kSFOffset = 31;
440 enum AddSubOp {
441 AddSubOpMask = 0x60000000,
442 AddSubSetFlagsBit = 0x20000000,
443 ADD = 0x00000000,
444 ADDS = ADD | AddSubSetFlagsBit,
445 SUB = 0x40000000,
446 SUBS = SUB | AddSubSetFlagsBit
447 };
448
449 #define ADD_SUB_OP_LIST(V) \
450 V(ADD), \
451 V(ADDS), \
452 V(SUB), \
453 V(SUBS)
454
455 enum AddSubImmediateOp {
456 AddSubImmediateFixed = 0x11000000,
457 AddSubImmediateFMask = 0x1F000000,
458 AddSubImmediateMask = 0xFF000000,
459 #define ADD_SUB_IMMEDIATE(A) \
460 A##_w_imm = AddSubImmediateFixed | A, \
461 A##_x_imm = AddSubImmediateFixed | A | SixtyFourBits
462 ADD_SUB_OP_LIST(ADD_SUB_IMMEDIATE)
463 #undef ADD_SUB_IMMEDIATE
464 };
465
466 enum AddSubShiftedOp {
467 AddSubShiftedFixed = 0x0B000000,
468 AddSubShiftedFMask = 0x1F200000,
469 AddSubShiftedMask = 0xFF200000,
470 #define ADD_SUB_SHIFTED(A) \
471 A##_w_shift = AddSubShiftedFixed | A, \
472 A##_x_shift = AddSubShiftedFixed | A | SixtyFourBits
473 ADD_SUB_OP_LIST(ADD_SUB_SHIFTED)
474 #undef ADD_SUB_SHIFTED
475 };
476
477 enum AddSubExtendedOp {
478 AddSubExtendedFixed = 0x0B200000,
479 AddSubExtendedFMask = 0x1F200000,
480 AddSubExtendedMask = 0xFFE00000,
481 #define ADD_SUB_EXTENDED(A) \
482 A##_w_ext = AddSubExtendedFixed | A, \
483 A##_x_ext = AddSubExtendedFixed | A | SixtyFourBits
484 ADD_SUB_OP_LIST(ADD_SUB_EXTENDED)
485 #undef ADD_SUB_EXTENDED
486 };
487
488 // Add/sub with carry.
489 enum AddSubWithCarryOp {
490 AddSubWithCarryFixed = 0x1A000000,
491 AddSubWithCarryFMask = 0x1FE00000,
492 AddSubWithCarryMask = 0xFFE0FC00,
493 ADC_w = AddSubWithCarryFixed | ADD,
494 ADC_x = AddSubWithCarryFixed | ADD | SixtyFourBits,
495 ADC = ADC_w,
496 ADCS_w = AddSubWithCarryFixed | ADDS,
497 ADCS_x = AddSubWithCarryFixed | ADDS | SixtyFourBits,
498 SBC_w = AddSubWithCarryFixed | SUB,
499 SBC_x = AddSubWithCarryFixed | SUB | SixtyFourBits,
500 SBC = SBC_w,
501 SBCS_w = AddSubWithCarryFixed | SUBS,
502 SBCS_x = AddSubWithCarryFixed | SUBS | SixtyFourBits
503 };
504
505
506 // Logical (immediate and shifted register).
507 enum LogicalOp {
508 LogicalOpMask = 0x60200000,
509 NOT = 0x00200000,
510 AND = 0x00000000,
511 BIC = AND | NOT,
512 ORR = 0x20000000,
513 ORN = ORR | NOT,
514 EOR = 0x40000000,
515 EON = EOR | NOT,
516 ANDS = 0x60000000,
517 BICS = ANDS | NOT
518 };
519
520 // Logical immediate.
521 enum LogicalImmediateOp {
522 LogicalImmediateFixed = 0x12000000,
523 LogicalImmediateFMask = 0x1F800000,
524 LogicalImmediateMask = 0xFF800000,
525 AND_w_imm = LogicalImmediateFixed | AND,
526 AND_x_imm = LogicalImmediateFixed | AND | SixtyFourBits,
527 ORR_w_imm = LogicalImmediateFixed | ORR,
528 ORR_x_imm = LogicalImmediateFixed | ORR | SixtyFourBits,
529 EOR_w_imm = LogicalImmediateFixed | EOR,
530 EOR_x_imm = LogicalImmediateFixed | EOR | SixtyFourBits,
531 ANDS_w_imm = LogicalImmediateFixed | ANDS,
532 ANDS_x_imm = LogicalImmediateFixed | ANDS | SixtyFourBits
533 };
534
535 // Logical shifted register.
536 enum LogicalShiftedOp {
537 LogicalShiftedFixed = 0x0A000000,
538 LogicalShiftedFMask = 0x1F000000,
539 LogicalShiftedMask = 0xFF200000,
540 AND_w = LogicalShiftedFixed | AND,
541 AND_x = LogicalShiftedFixed | AND | SixtyFourBits,
542 AND_shift = AND_w,
543 BIC_w = LogicalShiftedFixed | BIC,
544 BIC_x = LogicalShiftedFixed | BIC | SixtyFourBits,
545 BIC_shift = BIC_w,
546 ORR_w = LogicalShiftedFixed | ORR,
547 ORR_x = LogicalShiftedFixed | ORR | SixtyFourBits,
548 ORR_shift = ORR_w,
549 ORN_w = LogicalShiftedFixed | ORN,
550 ORN_x = LogicalShiftedFixed | ORN | SixtyFourBits,
551 ORN_shift = ORN_w,
552 EOR_w = LogicalShiftedFixed | EOR,
553 EOR_x = LogicalShiftedFixed | EOR | SixtyFourBits,
554 EOR_shift = EOR_w,
555 EON_w = LogicalShiftedFixed | EON,
556 EON_x = LogicalShiftedFixed | EON | SixtyFourBits,
557 EON_shift = EON_w,
558 ANDS_w = LogicalShiftedFixed | ANDS,
559 ANDS_x = LogicalShiftedFixed | ANDS | SixtyFourBits,
560 ANDS_shift = ANDS_w,
561 BICS_w = LogicalShiftedFixed | BICS,
562 BICS_x = LogicalShiftedFixed | BICS | SixtyFourBits,
563 BICS_shift = BICS_w
564 };
565
566 // Move wide immediate.
567 enum MoveWideImmediateOp {
568 MoveWideImmediateFixed = 0x12800000,
569 MoveWideImmediateFMask = 0x1F800000,
570 MoveWideImmediateMask = 0xFF800000,
571 MOVN = 0x00000000,
572 MOVZ = 0x40000000,
573 MOVK = 0x60000000,
574 MOVN_w = MoveWideImmediateFixed | MOVN,
575 MOVN_x = MoveWideImmediateFixed | MOVN | SixtyFourBits,
576 MOVZ_w = MoveWideImmediateFixed | MOVZ,
577 MOVZ_x = MoveWideImmediateFixed | MOVZ | SixtyFourBits,
578 MOVK_w = MoveWideImmediateFixed | MOVK,
579 MOVK_x = MoveWideImmediateFixed | MOVK | SixtyFourBits
580 };
581
582 // Bitfield.
583 const int kBitfieldNOffset = 22;
584 enum BitfieldOp {
585 BitfieldFixed = 0x13000000,
586 BitfieldFMask = 0x1F800000,
587 BitfieldMask = 0xFF800000,
588 SBFM_w = BitfieldFixed | 0x00000000,
589 SBFM_x = BitfieldFixed | 0x80000000,
590 SBFM = SBFM_w,
591 BFM_w = BitfieldFixed | 0x20000000,
592 BFM_x = BitfieldFixed | 0xA0000000,
593 BFM = BFM_w,
594 UBFM_w = BitfieldFixed | 0x40000000,
595 UBFM_x = BitfieldFixed | 0xC0000000,
596 UBFM = UBFM_w
597 // Bitfield N field.
598 };
599
600 // Extract.
601 enum ExtractOp {
602 ExtractFixed = 0x13800000,
603 ExtractFMask = 0x1F800000,
604 ExtractMask = 0xFFA00000,
605 EXTR_w = ExtractFixed | 0x00000000,
606 EXTR_x = ExtractFixed | 0x80000000,
607 EXTR = EXTR_w
608 };
609
610 // Unconditional branch.
611 enum UnconditionalBranchOp {
612 UnconditionalBranchFixed = 0x14000000,
613 UnconditionalBranchFMask = 0x7C000000,
614 UnconditionalBranchMask = 0xFC000000,
615 B = UnconditionalBranchFixed | 0x00000000,
616 BL = UnconditionalBranchFixed | 0x80000000
617 };
618
619 // Unconditional branch to register.
620 enum UnconditionalBranchToRegisterOp {
621 UnconditionalBranchToRegisterFixed = 0xD6000000,
622 UnconditionalBranchToRegisterFMask = 0xFE000000,
623 UnconditionalBranchToRegisterMask = 0xFFFFFC1F,
624 BR = UnconditionalBranchToRegisterFixed | 0x001F0000,
625 BLR = UnconditionalBranchToRegisterFixed | 0x003F0000,
626 RET = UnconditionalBranchToRegisterFixed | 0x005F0000
627 };
628
629 // Compare and branch.
630 enum CompareBranchOp {
631 CompareBranchFixed = 0x34000000,
632 CompareBranchFMask = 0x7E000000,
633 CompareBranchMask = 0xFF000000,
634 CBZ_w = CompareBranchFixed | 0x00000000,
635 CBZ_x = CompareBranchFixed | 0x80000000,
636 CBZ = CBZ_w,
637 CBNZ_w = CompareBranchFixed | 0x01000000,
638 CBNZ_x = CompareBranchFixed | 0x81000000,
639 CBNZ = CBNZ_w
640 };
641
642 // Test and branch.
643 enum TestBranchOp {
644 TestBranchFixed = 0x36000000,
645 TestBranchFMask = 0x7E000000,
646 TestBranchMask = 0x7F000000,
647 TBZ = TestBranchFixed | 0x00000000,
648 TBNZ = TestBranchFixed | 0x01000000
649 };
650
651 // Conditional branch.
652 enum ConditionalBranchOp {
653 ConditionalBranchFixed = 0x54000000,
654 ConditionalBranchFMask = 0xFE000000,
655 ConditionalBranchMask = 0xFF000010,
656 B_cond = ConditionalBranchFixed | 0x00000000
657 };
658
659 // System.
660 // System instruction encoding is complicated because some instructions use op
661 // and CR fields to encode parameters. To handle this cleanly, the system
662 // instructions are split into more than one enum.
663
664 enum SystemOp {
665 SystemFixed = 0xD5000000,
666 SystemFMask = 0xFFC00000
667 };
668
669 enum SystemSysRegOp {
670 SystemSysRegFixed = 0xD5100000,
671 SystemSysRegFMask = 0xFFD00000,
672 SystemSysRegMask = 0xFFF00000,
673 MRS = SystemSysRegFixed | 0x00200000,
674 MSR = SystemSysRegFixed | 0x00000000
675 };
676
677 enum SystemHintOp {
678 SystemHintFixed = 0xD503201F,
679 SystemHintFMask = 0xFFFFF01F,
680 SystemHintMask = 0xFFFFF01F,
681 HINT = SystemHintFixed | 0x00000000
682 };
683
684 // Exception.
685 enum ExceptionOp {
686 ExceptionFixed = 0xD4000000,
687 ExceptionFMask = 0xFF000000,
688 ExceptionMask = 0xFFE0001F,
689 HLT = ExceptionFixed | 0x00400000,
690 BRK = ExceptionFixed | 0x00200000,
691 SVC = ExceptionFixed | 0x00000001,
692 HVC = ExceptionFixed | 0x00000002,
693 SMC = ExceptionFixed | 0x00000003,
694 DCPS1 = ExceptionFixed | 0x00A00001,
695 DCPS2 = ExceptionFixed | 0x00A00002,
696 DCPS3 = ExceptionFixed | 0x00A00003
697 };
698 // Code used to spot hlt instructions that should not be hit.
699 const int kHltBadCode = 0xbad;
700
701 enum MemBarrierOp {
702 MemBarrierFixed = 0xD503309F,
703 MemBarrierFMask = 0xFFFFF09F,
704 MemBarrierMask = 0xFFFFF0FF,
705 DSB = MemBarrierFixed | 0x00000000,
706 DMB = MemBarrierFixed | 0x00000020,
707 ISB = MemBarrierFixed | 0x00000040
708 };
709
710 // Any load or store.
711 enum LoadStoreAnyOp {
712 LoadStoreAnyFMask = 0x0a000000,
713 LoadStoreAnyFixed = 0x08000000
714 };
715
716 #define LOAD_STORE_PAIR_OP_LIST(V) \
717 V(STP, w, 0x00000000), \
718 V(LDP, w, 0x00400000), \
719 V(LDPSW, x, 0x40400000), \
720 V(STP, x, 0x80000000), \
721 V(LDP, x, 0x80400000), \
722 V(STP, s, 0x04000000), \
723 V(LDP, s, 0x04400000), \
724 V(STP, d, 0x44000000), \
725 V(LDP, d, 0x44400000)
726
727 // Load/store pair (post, pre and offset.)
728 enum LoadStorePairOp {
729 LoadStorePairMask = 0xC4400000,
730 LoadStorePairLBit = 1 << 22,
731 #define LOAD_STORE_PAIR(A, B, C) \
732 A##_##B = C
733 LOAD_STORE_PAIR_OP_LIST(LOAD_STORE_PAIR)
734 #undef LOAD_STORE_PAIR
735 };
736
737 enum LoadStorePairPostIndexOp {
738 LoadStorePairPostIndexFixed = 0x28800000,
739 LoadStorePairPostIndexFMask = 0x3B800000,
740 LoadStorePairPostIndexMask = 0xFFC00000,
741 #define LOAD_STORE_PAIR_POST_INDEX(A, B, C) \
742 A##_##B##_post = LoadStorePairPostIndexFixed | A##_##B
743 LOAD_STORE_PAIR_OP_LIST(LOAD_STORE_PAIR_POST_INDEX)
744 #undef LOAD_STORE_PAIR_POST_INDEX
745 };
746
747 enum LoadStorePairPreIndexOp {
748 LoadStorePairPreIndexFixed = 0x29800000,
749 LoadStorePairPreIndexFMask = 0x3B800000,
750 LoadStorePairPreIndexMask = 0xFFC00000,
751 #define LOAD_STORE_PAIR_PRE_INDEX(A, B, C) \
752 A##_##B##_pre = LoadStorePairPreIndexFixed | A##_##B
753 LOAD_STORE_PAIR_OP_LIST(LOAD_STORE_PAIR_PRE_INDEX)
754 #undef LOAD_STORE_PAIR_PRE_INDEX
755 };
756
757 enum LoadStorePairOffsetOp {
758 LoadStorePairOffsetFixed = 0x29000000,
759 LoadStorePairOffsetFMask = 0x3B800000,
760 LoadStorePairOffsetMask = 0xFFC00000,
761 #define LOAD_STORE_PAIR_OFFSET(A, B, C) \
762 A##_##B##_off = LoadStorePairOffsetFixed | A##_##B
763 LOAD_STORE_PAIR_OP_LIST(LOAD_STORE_PAIR_OFFSET)
764 #undef LOAD_STORE_PAIR_OFFSET
765 };
766
767 enum LoadStorePairNonTemporalOp {
768 LoadStorePairNonTemporalFixed = 0x28000000,
769 LoadStorePairNonTemporalFMask = 0x3B800000,
770 LoadStorePairNonTemporalMask = 0xFFC00000,
771 STNP_w = LoadStorePairNonTemporalFixed | STP_w,
772 LDNP_w = LoadStorePairNonTemporalFixed | LDP_w,
773 STNP_x = LoadStorePairNonTemporalFixed | STP_x,
774 LDNP_x = LoadStorePairNonTemporalFixed | LDP_x,
775 STNP_s = LoadStorePairNonTemporalFixed | STP_s,
776 LDNP_s = LoadStorePairNonTemporalFixed | LDP_s,
777 STNP_d = LoadStorePairNonTemporalFixed | STP_d,
778 LDNP_d = LoadStorePairNonTemporalFixed | LDP_d
779 };
780
781 // Load literal.
782 enum LoadLiteralOp {
783 LoadLiteralFixed = 0x18000000,
784 LoadLiteralFMask = 0x3B000000,
785 LoadLiteralMask = 0xFF000000,
786 LDR_w_lit = LoadLiteralFixed | 0x00000000,
787 LDR_x_lit = LoadLiteralFixed | 0x40000000,
788 LDRSW_x_lit = LoadLiteralFixed | 0x80000000,
789 PRFM_lit = LoadLiteralFixed | 0xC0000000,
790 LDR_s_lit = LoadLiteralFixed | 0x04000000,
791 LDR_d_lit = LoadLiteralFixed | 0x44000000
792 };
793
794 #define LOAD_STORE_OP_LIST(V) \
795 V(ST, RB, w, 0x00000000), \
796 V(ST, RH, w, 0x40000000), \
797 V(ST, R, w, 0x80000000), \
798 V(ST, R, x, 0xC0000000), \
799 V(LD, RB, w, 0x00400000), \
800 V(LD, RH, w, 0x40400000), \
801 V(LD, R, w, 0x80400000), \
802 V(LD, R, x, 0xC0400000), \
803 V(LD, RSB, x, 0x00800000), \
804 V(LD, RSH, x, 0x40800000), \
805 V(LD, RSW, x, 0x80800000), \
806 V(LD, RSB, w, 0x00C00000), \
807 V(LD, RSH, w, 0x40C00000), \
808 V(ST, R, s, 0x84000000), \
809 V(ST, R, d, 0xC4000000), \
810 V(LD, R, s, 0x84400000), \
811 V(LD, R, d, 0xC4400000)
812
813
814 // Load/store unscaled offset.
815 enum LoadStoreUnscaledOffsetOp {
816 LoadStoreUnscaledOffsetFixed = 0x38000000,
817 LoadStoreUnscaledOffsetFMask = 0x3B200C00,
818 LoadStoreUnscaledOffsetMask = 0xFFE00C00,
819 #define LOAD_STORE_UNSCALED(A, B, C, D) \
820 A##U##B##_##C = LoadStoreUnscaledOffsetFixed | D
821 LOAD_STORE_OP_LIST(LOAD_STORE_UNSCALED)
822 #undef LOAD_STORE_UNSCALED
823 };
824
825 // Load/store (post, pre, offset and unsigned.)
826 enum LoadStoreOp {
827 LoadStoreOpMask = 0xC4C00000,
828 #define LOAD_STORE(A, B, C, D) \
829 A##B##_##C = D
830 LOAD_STORE_OP_LIST(LOAD_STORE),
831 #undef LOAD_STORE
832 PRFM = 0xC0800000
833 };
834
835 // Load/store post index.
836 enum LoadStorePostIndex {
837 LoadStorePostIndexFixed = 0x38000400,
838 LoadStorePostIndexFMask = 0x3B200C00,
839 LoadStorePostIndexMask = 0xFFE00C00,
840 #define LOAD_STORE_POST_INDEX(A, B, C, D) \
841 A##B##_##C##_post = LoadStorePostIndexFixed | D
842 LOAD_STORE_OP_LIST(LOAD_STORE_POST_INDEX)
843 #undef LOAD_STORE_POST_INDEX
844 };
845
846 // Load/store pre index.
847 enum LoadStorePreIndex {
848 LoadStorePreIndexFixed = 0x38000C00,
849 LoadStorePreIndexFMask = 0x3B200C00,
850 LoadStorePreIndexMask = 0xFFE00C00,
851 #define LOAD_STORE_PRE_INDEX(A, B, C, D) \
852 A##B##_##C##_pre = LoadStorePreIndexFixed | D
853 LOAD_STORE_OP_LIST(LOAD_STORE_PRE_INDEX)
854 #undef LOAD_STORE_PRE_INDEX
855 };
856
857 // Load/store unsigned offset.
858 enum LoadStoreUnsignedOffset {
859 LoadStoreUnsignedOffsetFixed = 0x39000000,
860 LoadStoreUnsignedOffsetFMask = 0x3B000000,
861 LoadStoreUnsignedOffsetMask = 0xFFC00000,
862 PRFM_unsigned = LoadStoreUnsignedOffsetFixed | PRFM,
863 #define LOAD_STORE_UNSIGNED_OFFSET(A, B, C, D) \
864 A##B##_##C##_unsigned = LoadStoreUnsignedOffsetFixed | D
865 LOAD_STORE_OP_LIST(LOAD_STORE_UNSIGNED_OFFSET)
866 #undef LOAD_STORE_UNSIGNED_OFFSET
867 };
868
869 // Load/store register offset.
870 enum LoadStoreRegisterOffset {
871 LoadStoreRegisterOffsetFixed = 0x38200800,
872 LoadStoreRegisterOffsetFMask = 0x3B200C00,
873 LoadStoreRegisterOffsetMask = 0xFFE00C00,
874 PRFM_reg = LoadStoreRegisterOffsetFixed | PRFM,
875 #define LOAD_STORE_REGISTER_OFFSET(A, B, C, D) \
876 A##B##_##C##_reg = LoadStoreRegisterOffsetFixed | D
877 LOAD_STORE_OP_LIST(LOAD_STORE_REGISTER_OFFSET)
878 #undef LOAD_STORE_REGISTER_OFFSET
879 };
880
881 // Conditional compare.
882 enum ConditionalCompareOp {
883 ConditionalCompareMask = 0x60000000,
884 CCMN = 0x20000000,
885 CCMP = 0x60000000
886 };
887
888 // Conditional compare register.
889 enum ConditionalCompareRegisterOp {
890 ConditionalCompareRegisterFixed = 0x1A400000,
891 ConditionalCompareRegisterFMask = 0x1FE00800,
892 ConditionalCompareRegisterMask = 0xFFE00C10,
893 CCMN_w = ConditionalCompareRegisterFixed | CCMN,
894 CCMN_x = ConditionalCompareRegisterFixed | SixtyFourBits | CCMN,
895 CCMP_w = ConditionalCompareRegisterFixed | CCMP,
896 CCMP_x = ConditionalCompareRegisterFixed | SixtyFourBits | CCMP
897 };
898
899 // Conditional compare immediate.
900 enum ConditionalCompareImmediateOp {
901 ConditionalCompareImmediateFixed = 0x1A400800,
902 ConditionalCompareImmediateFMask = 0x1FE00800,
903 ConditionalCompareImmediateMask = 0xFFE00C10,
904 CCMN_w_imm = ConditionalCompareImmediateFixed | CCMN,
905 CCMN_x_imm = ConditionalCompareImmediateFixed | SixtyFourBits | CCMN,
906 CCMP_w_imm = ConditionalCompareImmediateFixed | CCMP,
907 CCMP_x_imm = ConditionalCompareImmediateFixed | SixtyFourBits | CCMP
908 };
909
910 // Conditional select.
911 enum ConditionalSelectOp {
912 ConditionalSelectFixed = 0x1A800000,
913 ConditionalSelectFMask = 0x1FE00000,
914 ConditionalSelectMask = 0xFFE00C00,
915 CSEL_w = ConditionalSelectFixed | 0x00000000,
916 CSEL_x = ConditionalSelectFixed | 0x80000000,
917 CSEL = CSEL_w,
918 CSINC_w = ConditionalSelectFixed | 0x00000400,
919 CSINC_x = ConditionalSelectFixed | 0x80000400,
920 CSINC = CSINC_w,
921 CSINV_w = ConditionalSelectFixed | 0x40000000,
922 CSINV_x = ConditionalSelectFixed | 0xC0000000,
923 CSINV = CSINV_w,
924 CSNEG_w = ConditionalSelectFixed | 0x40000400,
925 CSNEG_x = ConditionalSelectFixed | 0xC0000400,
926 CSNEG = CSNEG_w
927 };
928
929 // Data processing 1 source.
930 enum DataProcessing1SourceOp {
931 DataProcessing1SourceFixed = 0x5AC00000,
932 DataProcessing1SourceFMask = 0x5FE00000,
933 DataProcessing1SourceMask = 0xFFFFFC00,
934 RBIT = DataProcessing1SourceFixed | 0x00000000,
935 RBIT_w = RBIT,
936 RBIT_x = RBIT | SixtyFourBits,
937 REV16 = DataProcessing1SourceFixed | 0x00000400,
938 REV16_w = REV16,
939 REV16_x = REV16 | SixtyFourBits,
940 REV = DataProcessing1SourceFixed | 0x00000800,
941 REV_w = REV,
942 REV32_x = REV | SixtyFourBits,
943 REV_x = DataProcessing1SourceFixed | SixtyFourBits | 0x00000C00,
944 CLZ = DataProcessing1SourceFixed | 0x00001000,
945 CLZ_w = CLZ,
946 CLZ_x = CLZ | SixtyFourBits,
947 CLS = DataProcessing1SourceFixed | 0x00001400,
948 CLS_w = CLS,
949 CLS_x = CLS | SixtyFourBits
950 };
951
952 // Data processing 2 source.
953 enum DataProcessing2SourceOp {
954 DataProcessing2SourceFixed = 0x1AC00000,
955 DataProcessing2SourceFMask = 0x5FE00000,
956 DataProcessing2SourceMask = 0xFFE0FC00,
957 UDIV_w = DataProcessing2SourceFixed | 0x00000800,
958 UDIV_x = DataProcessing2SourceFixed | 0x80000800,
959 UDIV = UDIV_w,
960 SDIV_w = DataProcessing2SourceFixed | 0x00000C00,
961 SDIV_x = DataProcessing2SourceFixed | 0x80000C00,
962 SDIV = SDIV_w,
963 LSLV_w = DataProcessing2SourceFixed | 0x00002000,
964 LSLV_x = DataProcessing2SourceFixed | 0x80002000,
965 LSLV = LSLV_w,
966 LSRV_w = DataProcessing2SourceFixed | 0x00002400,
967 LSRV_x = DataProcessing2SourceFixed | 0x80002400,
968 LSRV = LSRV_w,
969 ASRV_w = DataProcessing2SourceFixed | 0x00002800,
970 ASRV_x = DataProcessing2SourceFixed | 0x80002800,
971 ASRV = ASRV_w,
972 RORV_w = DataProcessing2SourceFixed | 0x00002C00,
973 RORV_x = DataProcessing2SourceFixed | 0x80002C00,
974 RORV = RORV_w,
975 CRC32B = DataProcessing2SourceFixed | 0x00004000,
976 CRC32H = DataProcessing2SourceFixed | 0x00004400,
977 CRC32W = DataProcessing2SourceFixed | 0x00004800,
978 CRC32X = DataProcessing2SourceFixed | SixtyFourBits | 0x00004C00,
979 CRC32CB = DataProcessing2SourceFixed | 0x00005000,
980 CRC32CH = DataProcessing2SourceFixed | 0x00005400,
981 CRC32CW = DataProcessing2SourceFixed | 0x00005800,
982 CRC32CX = DataProcessing2SourceFixed | SixtyFourBits | 0x00005C00
983 };
984
985 // Data processing 3 source.
986 enum DataProcessing3SourceOp {
987 DataProcessing3SourceFixed = 0x1B000000,
988 DataProcessing3SourceFMask = 0x1F000000,
989 DataProcessing3SourceMask = 0xFFE08000,
990 MADD_w = DataProcessing3SourceFixed | 0x00000000,
991 MADD_x = DataProcessing3SourceFixed | 0x80000000,
992 MADD = MADD_w,
993 MSUB_w = DataProcessing3SourceFixed | 0x00008000,
994 MSUB_x = DataProcessing3SourceFixed | 0x80008000,
995 MSUB = MSUB_w,
996 SMADDL_x = DataProcessing3SourceFixed | 0x80200000,
997 SMSUBL_x = DataProcessing3SourceFixed | 0x80208000,
998 SMULH_x = DataProcessing3SourceFixed | 0x80400000,
999 UMADDL_x = DataProcessing3SourceFixed | 0x80A00000,
1000 UMSUBL_x = DataProcessing3SourceFixed | 0x80A08000,
1001 UMULH_x = DataProcessing3SourceFixed | 0x80C00000
1002 };
1003
1004 // Floating point compare.
1005 enum FPCompareOp {
1006 FPCompareFixed = 0x1E202000,
1007 FPCompareFMask = 0x5F203C00,
1008 FPCompareMask = 0xFFE0FC1F,
1009 FCMP_s = FPCompareFixed | 0x00000000,
1010 FCMP_d = FPCompareFixed | FP64 | 0x00000000,
1011 FCMP = FCMP_s,
1012 FCMP_s_zero = FPCompareFixed | 0x00000008,
1013 FCMP_d_zero = FPCompareFixed | FP64 | 0x00000008,
1014 FCMP_zero = FCMP_s_zero,
1015 FCMPE_s = FPCompareFixed | 0x00000010,
1016 FCMPE_d = FPCompareFixed | FP64 | 0x00000010,
1017 FCMPE_s_zero = FPCompareFixed | 0x00000018,
1018 FCMPE_d_zero = FPCompareFixed | FP64 | 0x00000018
1019 };
1020
1021 // Floating point conditional compare.
1022 enum FPConditionalCompareOp {
1023 FPConditionalCompareFixed = 0x1E200400,
1024 FPConditionalCompareFMask = 0x5F200C00,
1025 FPConditionalCompareMask = 0xFFE00C10,
1026 FCCMP_s = FPConditionalCompareFixed | 0x00000000,
1027 FCCMP_d = FPConditionalCompareFixed | FP64 | 0x00000000,
1028 FCCMP = FCCMP_s,
1029 FCCMPE_s = FPConditionalCompareFixed | 0x00000010,
1030 FCCMPE_d = FPConditionalCompareFixed | FP64 | 0x00000010,
1031 FCCMPE = FCCMPE_s
1032 };
1033
1034 // Floating point conditional select.
1035 enum FPConditionalSelectOp {
1036 FPConditionalSelectFixed = 0x1E200C00,
1037 FPConditionalSelectFMask = 0x5F200C00,
1038 FPConditionalSelectMask = 0xFFE00C00,
1039 FCSEL_s = FPConditionalSelectFixed | 0x00000000,
1040 FCSEL_d = FPConditionalSelectFixed | FP64 | 0x00000000,
1041 FCSEL = FCSEL_s
1042 };
1043
1044 // Floating point immediate.
1045 enum FPImmediateOp {
1046 FPImmediateFixed = 0x1E201000,
1047 FPImmediateFMask = 0x5F201C00,
1048 FPImmediateMask = 0xFFE01C00,
1049 FMOV_s_imm = FPImmediateFixed | 0x00000000,
1050 FMOV_d_imm = FPImmediateFixed | FP64 | 0x00000000
1051 };
1052
1053 // Floating point data processing 1 source.
1054 enum FPDataProcessing1SourceOp {
1055 FPDataProcessing1SourceFixed = 0x1E204000,
1056 FPDataProcessing1SourceFMask = 0x5F207C00,
1057 FPDataProcessing1SourceMask = 0xFFFFFC00,
1058 FMOV_s = FPDataProcessing1SourceFixed | 0x00000000,
1059 FMOV_d = FPDataProcessing1SourceFixed | FP64 | 0x00000000,
1060 FMOV = FMOV_s,
1061 FABS_s = FPDataProcessing1SourceFixed | 0x00008000,
1062 FABS_d = FPDataProcessing1SourceFixed | FP64 | 0x00008000,
1063 FABS = FABS_s,
1064 FNEG_s = FPDataProcessing1SourceFixed | 0x00010000,
1065 FNEG_d = FPDataProcessing1SourceFixed | FP64 | 0x00010000,
1066 FNEG = FNEG_s,
1067 FSQRT_s = FPDataProcessing1SourceFixed | 0x00018000,
1068 FSQRT_d = FPDataProcessing1SourceFixed | FP64 | 0x00018000,
1069 FSQRT = FSQRT_s,
1070 FCVT_ds = FPDataProcessing1SourceFixed | 0x00028000,
1071 FCVT_sd = FPDataProcessing1SourceFixed | FP64 | 0x00020000,
1072 FRINTN_s = FPDataProcessing1SourceFixed | 0x00040000,
1073 FRINTN_d = FPDataProcessing1SourceFixed | FP64 | 0x00040000,
1074 FRINTN = FRINTN_s,
1075 FRINTP_s = FPDataProcessing1SourceFixed | 0x00048000,
1076 FRINTP_d = FPDataProcessing1SourceFixed | FP64 | 0x00048000,
1077 FRINTP = FRINTP_s,
1078 FRINTM_s = FPDataProcessing1SourceFixed | 0x00050000,
1079 FRINTM_d = FPDataProcessing1SourceFixed | FP64 | 0x00050000,
1080 FRINTM = FRINTM_s,
1081 FRINTZ_s = FPDataProcessing1SourceFixed | 0x00058000,
1082 FRINTZ_d = FPDataProcessing1SourceFixed | FP64 | 0x00058000,
1083 FRINTZ = FRINTZ_s,
1084 FRINTA_s = FPDataProcessing1SourceFixed | 0x00060000,
1085 FRINTA_d = FPDataProcessing1SourceFixed | FP64 | 0x00060000,
1086 FRINTA = FRINTA_s,
1087 FRINTX_s = FPDataProcessing1SourceFixed | 0x00070000,
1088 FRINTX_d = FPDataProcessing1SourceFixed | FP64 | 0x00070000,
1089 FRINTX = FRINTX_s,
1090 FRINTI_s = FPDataProcessing1SourceFixed | 0x00078000,
1091 FRINTI_d = FPDataProcessing1SourceFixed | FP64 | 0x00078000,
1092 FRINTI = FRINTI_s
1093 };
1094
1095 // Floating point data processing 2 source.
1096 enum FPDataProcessing2SourceOp {
1097 FPDataProcessing2SourceFixed = 0x1E200800,
1098 FPDataProcessing2SourceFMask = 0x5F200C00,
1099 FPDataProcessing2SourceMask = 0xFFE0FC00,
1100 FMUL = FPDataProcessing2SourceFixed | 0x00000000,
1101 FMUL_s = FMUL,
1102 FMUL_d = FMUL | FP64,
1103 FDIV = FPDataProcessing2SourceFixed | 0x00001000,
1104 FDIV_s = FDIV,
1105 FDIV_d = FDIV | FP64,
1106 FADD = FPDataProcessing2SourceFixed | 0x00002000,
1107 FADD_s = FADD,
1108 FADD_d = FADD | FP64,
1109 FSUB = FPDataProcessing2SourceFixed | 0x00003000,
1110 FSUB_s = FSUB,
1111 FSUB_d = FSUB | FP64,
1112 FMAX = FPDataProcessing2SourceFixed | 0x00004000,
1113 FMAX_s = FMAX,
1114 FMAX_d = FMAX | FP64,
1115 FMIN = FPDataProcessing2SourceFixed | 0x00005000,
1116 FMIN_s = FMIN,
1117 FMIN_d = FMIN | FP64,
1118 FMAXNM = FPDataProcessing2SourceFixed | 0x00006000,
1119 FMAXNM_s = FMAXNM,
1120 FMAXNM_d = FMAXNM | FP64,
1121 FMINNM = FPDataProcessing2SourceFixed | 0x00007000,
1122 FMINNM_s = FMINNM,
1123 FMINNM_d = FMINNM | FP64,
1124 FNMUL = FPDataProcessing2SourceFixed | 0x00008000,
1125 FNMUL_s = FNMUL,
1126 FNMUL_d = FNMUL | FP64
1127 };
1128
1129 // Floating point data processing 3 source.
1130 enum FPDataProcessing3SourceOp {
1131 FPDataProcessing3SourceFixed = 0x1F000000,
1132 FPDataProcessing3SourceFMask = 0x5F000000,
1133 FPDataProcessing3SourceMask = 0xFFE08000,
1134 FMADD_s = FPDataProcessing3SourceFixed | 0x00000000,
1135 FMSUB_s = FPDataProcessing3SourceFixed | 0x00008000,
1136 FNMADD_s = FPDataProcessing3SourceFixed | 0x00200000,
1137 FNMSUB_s = FPDataProcessing3SourceFixed | 0x00208000,
1138 FMADD_d = FPDataProcessing3SourceFixed | 0x00400000,
1139 FMSUB_d = FPDataProcessing3SourceFixed | 0x00408000,
1140 FNMADD_d = FPDataProcessing3SourceFixed | 0x00600000,
1141 FNMSUB_d = FPDataProcessing3SourceFixed | 0x00608000
1142 };
1143
1144 // Conversion between floating point and integer.
1145 enum FPIntegerConvertOp {
1146 FPIntegerConvertFixed = 0x1E200000,
1147 FPIntegerConvertFMask = 0x5F20FC00,
1148 FPIntegerConvertMask = 0xFFFFFC00,
1149 FCVTNS = FPIntegerConvertFixed | 0x00000000,
1150 FCVTNS_ws = FCVTNS,
1151 FCVTNS_xs = FCVTNS | SixtyFourBits,
1152 FCVTNS_wd = FCVTNS | FP64,
1153 FCVTNS_xd = FCVTNS | SixtyFourBits | FP64,
1154 FCVTNU = FPIntegerConvertFixed | 0x00010000,
1155 FCVTNU_ws = FCVTNU,
1156 FCVTNU_xs = FCVTNU | SixtyFourBits,
1157 FCVTNU_wd = FCVTNU | FP64,
1158 FCVTNU_xd = FCVTNU | SixtyFourBits | FP64,
1159 FCVTPS = FPIntegerConvertFixed | 0x00080000,
1160 FCVTPS_ws = FCVTPS,
1161 FCVTPS_xs = FCVTPS | SixtyFourBits,
1162 FCVTPS_wd = FCVTPS | FP64,
1163 FCVTPS_xd = FCVTPS | SixtyFourBits | FP64,
1164 FCVTPU = FPIntegerConvertFixed | 0x00090000,
1165 FCVTPU_ws = FCVTPU,
1166 FCVTPU_xs = FCVTPU | SixtyFourBits,
1167 FCVTPU_wd = FCVTPU | FP64,
1168 FCVTPU_xd = FCVTPU | SixtyFourBits | FP64,
1169 FCVTMS = FPIntegerConvertFixed | 0x00100000,
1170 FCVTMS_ws = FCVTMS,
1171 FCVTMS_xs = FCVTMS | SixtyFourBits,
1172 FCVTMS_wd = FCVTMS | FP64,
1173 FCVTMS_xd = FCVTMS | SixtyFourBits | FP64,
1174 FCVTMU = FPIntegerConvertFixed | 0x00110000,
1175 FCVTMU_ws = FCVTMU,
1176 FCVTMU_xs = FCVTMU | SixtyFourBits,
1177 FCVTMU_wd = FCVTMU | FP64,
1178 FCVTMU_xd = FCVTMU | SixtyFourBits | FP64,
1179 FCVTZS = FPIntegerConvertFixed | 0x00180000,
1180 FCVTZS_ws = FCVTZS,
1181 FCVTZS_xs = FCVTZS | SixtyFourBits,
1182 FCVTZS_wd = FCVTZS | FP64,
1183 FCVTZS_xd = FCVTZS | SixtyFourBits | FP64,
1184 FCVTZU = FPIntegerConvertFixed | 0x00190000,
1185 FCVTZU_ws = FCVTZU,
1186 FCVTZU_xs = FCVTZU | SixtyFourBits,
1187 FCVTZU_wd = FCVTZU | FP64,
1188 FCVTZU_xd = FCVTZU | SixtyFourBits | FP64,
1189 SCVTF = FPIntegerConvertFixed | 0x00020000,
1190 SCVTF_sw = SCVTF,
1191 SCVTF_sx = SCVTF | SixtyFourBits,
1192 SCVTF_dw = SCVTF | FP64,
1193 SCVTF_dx = SCVTF | SixtyFourBits | FP64,
1194 UCVTF = FPIntegerConvertFixed | 0x00030000,
1195 UCVTF_sw = UCVTF,
1196 UCVTF_sx = UCVTF | SixtyFourBits,
1197 UCVTF_dw = UCVTF | FP64,
1198 UCVTF_dx = UCVTF | SixtyFourBits | FP64,
1199 FCVTAS = FPIntegerConvertFixed | 0x00040000,
1200 FCVTAS_ws = FCVTAS,
1201 FCVTAS_xs = FCVTAS | SixtyFourBits,
1202 FCVTAS_wd = FCVTAS | FP64,
1203 FCVTAS_xd = FCVTAS | SixtyFourBits | FP64,
1204 FCVTAU = FPIntegerConvertFixed | 0x00050000,
1205 FCVTAU_ws = FCVTAU,
1206 FCVTAU_xs = FCVTAU | SixtyFourBits,
1207 FCVTAU_wd = FCVTAU | FP64,
1208 FCVTAU_xd = FCVTAU | SixtyFourBits | FP64,
1209 FMOV_ws = FPIntegerConvertFixed | 0x00060000,
1210 FMOV_sw = FPIntegerConvertFixed | 0x00070000,
1211 FMOV_xd = FMOV_ws | SixtyFourBits | FP64,
1212 FMOV_dx = FMOV_sw | SixtyFourBits | FP64
1213 };
1214
1215 // Conversion between fixed point and floating point.
1216 enum FPFixedPointConvertOp {
1217 FPFixedPointConvertFixed = 0x1E000000,
1218 FPFixedPointConvertFMask = 0x5F200000,
1219 FPFixedPointConvertMask = 0xFFFF0000,
1220 FCVTZS_fixed = FPFixedPointConvertFixed | 0x00180000,
1221 FCVTZS_ws_fixed = FCVTZS_fixed,
1222 FCVTZS_xs_fixed = FCVTZS_fixed | SixtyFourBits,
1223 FCVTZS_wd_fixed = FCVTZS_fixed | FP64,
1224 FCVTZS_xd_fixed = FCVTZS_fixed | SixtyFourBits | FP64,
1225 FCVTZU_fixed = FPFixedPointConvertFixed | 0x00190000,
1226 FCVTZU_ws_fixed = FCVTZU_fixed,
1227 FCVTZU_xs_fixed = FCVTZU_fixed | SixtyFourBits,
1228 FCVTZU_wd_fixed = FCVTZU_fixed | FP64,
1229 FCVTZU_xd_fixed = FCVTZU_fixed | SixtyFourBits | FP64,
1230 SCVTF_fixed = FPFixedPointConvertFixed | 0x00020000,
1231 SCVTF_sw_fixed = SCVTF_fixed,
1232 SCVTF_sx_fixed = SCVTF_fixed | SixtyFourBits,
1233 SCVTF_dw_fixed = SCVTF_fixed | FP64,
1234 SCVTF_dx_fixed = SCVTF_fixed | SixtyFourBits | FP64,
1235 UCVTF_fixed = FPFixedPointConvertFixed | 0x00030000,
1236 UCVTF_sw_fixed = UCVTF_fixed,
1237 UCVTF_sx_fixed = UCVTF_fixed | SixtyFourBits,
1238 UCVTF_dw_fixed = UCVTF_fixed | FP64,
1239 UCVTF_dx_fixed = UCVTF_fixed | SixtyFourBits | FP64
1240 };
1241
1242 // Unimplemented and unallocated instructions. These are defined to make fixed
1243 // bit assertion easier.
1244 enum UnimplementedOp {
1245 UnimplementedFixed = 0x00000000,
1246 UnimplementedFMask = 0x00000000
1247 };
1248
1249 enum UnallocatedOp {
1250 UnallocatedFixed = 0x00000000,
1251 UnallocatedFMask = 0x00000000
1252 };
1253
1254 } } // namespace v8::internal
1255
1256 #endif // V8_A64_CONSTANTS_A64_H_
OLDNEW
« no previous file with comments | « src/a64/codegen-a64.cc ('k') | src/a64/cpu-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698