OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 | 7 #include "src/globals.h" |
8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
9 #ifdef DEBUG | 9 #ifdef DEBUG |
10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
11 v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \ | 11 v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \ |
12 __FILE__, __LINE__, __func__) | 12 __FILE__, __LINE__, __func__) |
13 #else | 13 #else |
14 #define UNIMPLEMENTED_MIPS() | 14 #define UNIMPLEMENTED_MIPS() |
15 #endif | 15 #endif |
16 | 16 |
17 #define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n") | 17 #define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n") |
18 | 18 |
19 enum ArchVariants { | 19 enum ArchVariants { |
20 kMips32r2, | 20 kMips32r1 = v8::internal::MIPSr1, |
21 kMips32r1, | 21 kMips32r2 = v8::internal::MIPSr2, |
| 22 kMips32r6 = v8::internal::MIPSr6, |
22 kLoongson | 23 kLoongson |
23 }; | 24 }; |
24 | 25 |
25 #ifdef _MIPS_ARCH_MIPS32R2 | 26 #ifdef _MIPS_ARCH_MIPS32R2 |
26 static const ArchVariants kArchVariant = kMips32r2; | 27 static const ArchVariants kArchVariant = kMips32r2; |
| 28 #elif _MIPS_ARCH_MIPS32R6 |
| 29 static const ArchVariants kArchVariant = kMips32r6; |
27 #elif _MIPS_ARCH_LOONGSON | 30 #elif _MIPS_ARCH_LOONGSON |
28 // The loongson flag refers to the LOONGSON architectures based on MIPS-III, | 31 // The loongson flag refers to the LOONGSON architectures based on MIPS-III, |
29 // which predates (and is a subset of) the mips32r2 and r1 architectures. | 32 // which predates (and is a subset of) the mips32r2 and r1 architectures. |
30 static const ArchVariants kArchVariant = kLoongson; | 33 static const ArchVariants kArchVariant = kLoongson; |
| 34 #elif _MIPS_ARCH_MIPS32RX |
| 35 // This flags referred to compatibility mode that creates universal code that |
| 36 // can run on any MIPS32 architecture revision. The dynamically generated code |
| 37 // by v8 is specialized for the MIPS host detected in runtime probing. |
| 38 static const ArchVariants kArchVariant = kMips32r1; |
31 #else | 39 #else |
32 static const ArchVariants kArchVariant = kMips32r1; | 40 static const ArchVariants kArchVariant = kMips32r1; |
33 #endif | 41 #endif |
34 | 42 |
35 enum Endianness { | 43 enum Endianness { |
36 kLittle, | 44 kLittle, |
37 kBig | 45 kBig |
38 }; | 46 }; |
39 | 47 |
40 #if defined(V8_TARGET_LITTLE_ENDIAN) | 48 #if defined(V8_TARGET_LITTLE_ENDIAN) |
41 static const Endianness kArchEndian = kLittle; | 49 static const Endianness kArchEndian = kLittle; |
42 #elif defined(V8_TARGET_BIG_ENDIAN) | 50 #elif defined(V8_TARGET_BIG_ENDIAN) |
43 static const Endianness kArchEndian = kBig; | 51 static const Endianness kArchEndian = kBig; |
44 #else | 52 #else |
45 #error Unknown endianness | 53 #error Unknown endianness |
46 #endif | 54 #endif |
47 | 55 |
| 56 enum FpuMode { |
| 57 kFP32, |
| 58 kFP64, |
| 59 kFPXX |
| 60 }; |
| 61 |
| 62 #if defined(FPU_MODE_FP32) |
| 63 static const FpuMode kFpuMode = kFP32; |
| 64 #elif defined(FPU_MODE_FP64) |
| 65 static const FpuMode kFpuMode = kFP64; |
| 66 #elif defined(FPU_MODE_FPXX) |
| 67 static const FpuMode kFpuMode = kFPXX; |
| 68 #else |
| 69 static const FpuMode kFpuMode = kFP32; |
| 70 #endif |
| 71 |
48 #if(defined(__mips_hard_float) && __mips_hard_float != 0) | 72 #if(defined(__mips_hard_float) && __mips_hard_float != 0) |
49 // Use floating-point coprocessor instructions. This flag is raised when | 73 // Use floating-point coprocessor instructions. This flag is raised when |
50 // -mhard-float is passed to the compiler. | 74 // -mhard-float is passed to the compiler. |
51 const bool IsMipsSoftFloatABI = false; | 75 const bool IsMipsSoftFloatABI = false; |
52 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) | 76 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) |
53 // This flag is raised when -msoft-float is passed to the compiler. | 77 // This flag is raised when -msoft-float is passed to the compiler. |
54 // Although FPU is a base requirement for v8, soft-float ABI is used | 78 // Although FPU is a base requirement for v8, soft-float ABI is used |
55 // on soft-float systems with FPU kernel emulation. | 79 // on soft-float systems with FPU kernel emulation. |
56 const bool IsMipsSoftFloatABI = true; | 80 const bool IsMipsSoftFloatABI = true; |
57 #else | 81 #else |
58 const bool IsMipsSoftFloatABI = true; | 82 const bool IsMipsSoftFloatABI = true; |
59 #endif | 83 #endif |
60 | 84 |
61 #if defined(V8_TARGET_LITTLE_ENDIAN) | 85 #if defined(V8_TARGET_LITTLE_ENDIAN) |
62 const uint32_t kHoleNanUpper32Offset = 4; | 86 const uint32_t kHoleNanUpper32Offset = 4; |
63 const uint32_t kHoleNanLower32Offset = 0; | 87 const uint32_t kHoleNanLower32Offset = 0; |
64 #elif defined(V8_TARGET_BIG_ENDIAN) | 88 #elif defined(V8_TARGET_BIG_ENDIAN) |
65 const uint32_t kHoleNanUpper32Offset = 0; | 89 const uint32_t kHoleNanUpper32Offset = 0; |
66 const uint32_t kHoleNanLower32Offset = 4; | 90 const uint32_t kHoleNanLower32Offset = 4; |
67 #else | 91 #else |
68 #error Unknown endianness | 92 #error Unknown endianness |
69 #endif | 93 #endif |
70 | 94 |
| 95 #ifndef FPU_MODE_FPXX |
| 96 #define IsFp64Mode() \ |
| 97 (kFpuMode == kFP64) |
| 98 #else |
| 99 #define IsFp64Mode() \ |
| 100 (CpuFeatures::IsSupported(FP64FPU)) |
| 101 #endif |
| 102 |
| 103 #ifndef _MIPS_ARCH_MIPS32RX |
| 104 #define IsMipsArchVariant(check) \ |
| 105 (kArchVariant == check) |
| 106 #else |
| 107 #define IsMipsArchVariant(check) \ |
| 108 (CpuFeatures::IsSupported(check)) |
| 109 #endif |
| 110 |
| 111 |
| 112 #define __STDC_FORMAT_MACROS |
| 113 #include <inttypes.h> |
| 114 |
71 // Defines constants and accessor classes to assemble, disassemble and | 115 // Defines constants and accessor classes to assemble, disassemble and |
72 // simulate MIPS32 instructions. | 116 // simulate MIPS32 instructions. |
73 // | 117 // |
74 // See: MIPS32 Architecture For Programmers | 118 // See: MIPS32 Architecture For Programmers |
75 // Volume II: The MIPS32 Instruction Set | 119 // Volume II: The MIPS32 Instruction Set |
76 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf. | 120 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf. |
77 | 121 |
78 namespace v8 { | 122 namespace v8 { |
79 namespace internal { | 123 namespace internal { |
80 | 124 |
(...skipping 11 matching lines...) Expand all Loading... |
92 const int kPCRegister = 34; | 136 const int kPCRegister = 34; |
93 | 137 |
94 // Number coprocessor registers. | 138 // Number coprocessor registers. |
95 const int kNumFPURegisters = 32; | 139 const int kNumFPURegisters = 32; |
96 const int kInvalidFPURegister = -1; | 140 const int kInvalidFPURegister = -1; |
97 | 141 |
98 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. | 142 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. |
99 const int kFCSRRegister = 31; | 143 const int kFCSRRegister = 31; |
100 const int kInvalidFPUControlRegister = -1; | 144 const int kInvalidFPUControlRegister = -1; |
101 const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1 << 31) - 1; | 145 const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1 << 31) - 1; |
| 146 const uint64_t kFPU64InvalidResult = |
| 147 static_cast<uint64_t>(static_cast<uint64_t>(1) << 63) - 1; |
102 | 148 |
103 // FCSR constants. | 149 // FCSR constants. |
104 const uint32_t kFCSRInexactFlagBit = 2; | 150 const uint32_t kFCSRInexactFlagBit = 2; |
105 const uint32_t kFCSRUnderflowFlagBit = 3; | 151 const uint32_t kFCSRUnderflowFlagBit = 3; |
106 const uint32_t kFCSROverflowFlagBit = 4; | 152 const uint32_t kFCSROverflowFlagBit = 4; |
107 const uint32_t kFCSRDivideByZeroFlagBit = 5; | 153 const uint32_t kFCSRDivideByZeroFlagBit = 5; |
108 const uint32_t kFCSRInvalidOpFlagBit = 6; | 154 const uint32_t kFCSRInvalidOpFlagBit = 6; |
109 | 155 |
110 const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; | 156 const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; |
111 const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; | 157 const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const int kRdShift = 11; | 255 const int kRdShift = 11; |
210 const int kRdBits = 5; | 256 const int kRdBits = 5; |
211 const int kSaShift = 6; | 257 const int kSaShift = 6; |
212 const int kSaBits = 5; | 258 const int kSaBits = 5; |
213 const int kFunctionShift = 0; | 259 const int kFunctionShift = 0; |
214 const int kFunctionBits = 6; | 260 const int kFunctionBits = 6; |
215 const int kLuiShift = 16; | 261 const int kLuiShift = 16; |
216 | 262 |
217 const int kImm16Shift = 0; | 263 const int kImm16Shift = 0; |
218 const int kImm16Bits = 16; | 264 const int kImm16Bits = 16; |
| 265 const int kImm21Shift = 0; |
| 266 const int kImm21Bits = 21; |
219 const int kImm26Shift = 0; | 267 const int kImm26Shift = 0; |
220 const int kImm26Bits = 26; | 268 const int kImm26Bits = 26; |
221 const int kImm28Shift = 0; | 269 const int kImm28Shift = 0; |
222 const int kImm28Bits = 28; | 270 const int kImm28Bits = 28; |
| 271 const int kImm32Shift = 0; |
| 272 const int kImm32Bits = 32; |
223 | 273 |
224 // In branches and jumps immediate fields point to words, not bytes, | 274 // In branches and jumps immediate fields point to words, not bytes, |
225 // and are therefore shifted by 2. | 275 // and are therefore shifted by 2. |
226 const int kImmFieldShift = 2; | 276 const int kImmFieldShift = 2; |
227 | 277 |
228 const int kFrBits = 5; | 278 const int kFrBits = 5; |
229 const int kFrShift = 21; | 279 const int kFrShift = 21; |
230 const int kFsShift = 11; | 280 const int kFsShift = 11; |
231 const int kFsBits = 5; | 281 const int kFsBits = 5; |
232 const int kFtShift = 16; | 282 const int kFtShift = 16; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 BLEZ = ((0 << 3) + 6) << kOpcodeShift, | 321 BLEZ = ((0 << 3) + 6) << kOpcodeShift, |
272 BGTZ = ((0 << 3) + 7) << kOpcodeShift, | 322 BGTZ = ((0 << 3) + 7) << kOpcodeShift, |
273 | 323 |
274 ADDI = ((1 << 3) + 0) << kOpcodeShift, | 324 ADDI = ((1 << 3) + 0) << kOpcodeShift, |
275 ADDIU = ((1 << 3) + 1) << kOpcodeShift, | 325 ADDIU = ((1 << 3) + 1) << kOpcodeShift, |
276 SLTI = ((1 << 3) + 2) << kOpcodeShift, | 326 SLTI = ((1 << 3) + 2) << kOpcodeShift, |
277 SLTIU = ((1 << 3) + 3) << kOpcodeShift, | 327 SLTIU = ((1 << 3) + 3) << kOpcodeShift, |
278 ANDI = ((1 << 3) + 4) << kOpcodeShift, | 328 ANDI = ((1 << 3) + 4) << kOpcodeShift, |
279 ORI = ((1 << 3) + 5) << kOpcodeShift, | 329 ORI = ((1 << 3) + 5) << kOpcodeShift, |
280 XORI = ((1 << 3) + 6) << kOpcodeShift, | 330 XORI = ((1 << 3) + 6) << kOpcodeShift, |
281 LUI = ((1 << 3) + 7) << kOpcodeShift, | 331 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. |
282 | 332 |
| 333 BEQC = ((2 << 3) + 0) << kOpcodeShift, |
283 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. | 334 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. |
284 BEQL = ((2 << 3) + 4) << kOpcodeShift, | 335 BEQL = ((2 << 3) + 4) << kOpcodeShift, |
285 BNEL = ((2 << 3) + 5) << kOpcodeShift, | 336 BNEL = ((2 << 3) + 5) << kOpcodeShift, |
286 BLEZL = ((2 << 3) + 6) << kOpcodeShift, | 337 BLEZL = ((2 << 3) + 6) << kOpcodeShift, |
287 BGTZL = ((2 << 3) + 7) << kOpcodeShift, | 338 BGTZL = ((2 << 3) + 7) << kOpcodeShift, |
288 | 339 |
| 340 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. |
289 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, | 341 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, |
290 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, | 342 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, |
291 | 343 |
292 LB = ((4 << 3) + 0) << kOpcodeShift, | 344 LB = ((4 << 3) + 0) << kOpcodeShift, |
293 LH = ((4 << 3) + 1) << kOpcodeShift, | 345 LH = ((4 << 3) + 1) << kOpcodeShift, |
294 LWL = ((4 << 3) + 2) << kOpcodeShift, | 346 LWL = ((4 << 3) + 2) << kOpcodeShift, |
295 LW = ((4 << 3) + 3) << kOpcodeShift, | 347 LW = ((4 << 3) + 3) << kOpcodeShift, |
296 LBU = ((4 << 3) + 4) << kOpcodeShift, | 348 LBU = ((4 << 3) + 4) << kOpcodeShift, |
297 LHU = ((4 << 3) + 5) << kOpcodeShift, | 349 LHU = ((4 << 3) + 5) << kOpcodeShift, |
298 LWR = ((4 << 3) + 6) << kOpcodeShift, | 350 LWR = ((4 << 3) + 6) << kOpcodeShift, |
299 SB = ((5 << 3) + 0) << kOpcodeShift, | 351 SB = ((5 << 3) + 0) << kOpcodeShift, |
300 SH = ((5 << 3) + 1) << kOpcodeShift, | 352 SH = ((5 << 3) + 1) << kOpcodeShift, |
301 SWL = ((5 << 3) + 2) << kOpcodeShift, | 353 SWL = ((5 << 3) + 2) << kOpcodeShift, |
302 SW = ((5 << 3) + 3) << kOpcodeShift, | 354 SW = ((5 << 3) + 3) << kOpcodeShift, |
303 SWR = ((5 << 3) + 6) << kOpcodeShift, | 355 SWR = ((5 << 3) + 6) << kOpcodeShift, |
304 | 356 |
305 LWC1 = ((6 << 3) + 1) << kOpcodeShift, | 357 LWC1 = ((6 << 3) + 1) << kOpcodeShift, |
306 LDC1 = ((6 << 3) + 5) << kOpcodeShift, | 358 LDC1 = ((6 << 3) + 5) << kOpcodeShift, |
| 359 BEQZC = ((6 << 3) + 6) << kOpcodeShift, |
307 | 360 |
308 PREF = ((6 << 3) + 3) << kOpcodeShift, | 361 PREF = ((6 << 3) + 3) << kOpcodeShift, |
309 | 362 |
310 SWC1 = ((7 << 3) + 1) << kOpcodeShift, | 363 SWC1 = ((7 << 3) + 1) << kOpcodeShift, |
311 SDC1 = ((7 << 3) + 5) << kOpcodeShift, | 364 SDC1 = ((7 << 3) + 5) << kOpcodeShift, |
| 365 BNEZC = ((7 << 3) + 6) << kOpcodeShift, |
312 | 366 |
313 COP1X = ((1 << 4) + 3) << kOpcodeShift | 367 COP1X = ((1 << 4) + 3) << kOpcodeShift |
314 }; | 368 }; |
315 | 369 |
316 enum SecondaryField { | 370 enum SecondaryField { |
317 // SPECIAL Encoding of Function Field. | 371 // SPECIAL Encoding of Function Field. |
318 SLL = ((0 << 3) + 0), | 372 SLL = ((0 << 3) + 0), |
319 MOVCI = ((0 << 3) + 1), | 373 MOVCI = ((0 << 3) + 1), |
320 SRL = ((0 << 3) + 2), | 374 SRL = ((0 << 3) + 2), |
321 SRA = ((0 << 3) + 3), | 375 SRA = ((0 << 3) + 3), |
322 SLLV = ((0 << 3) + 4), | 376 SLLV = ((0 << 3) + 4), |
323 SRLV = ((0 << 3) + 6), | 377 SRLV = ((0 << 3) + 6), |
324 SRAV = ((0 << 3) + 7), | 378 SRAV = ((0 << 3) + 7), |
325 | 379 |
326 JR = ((1 << 3) + 0), | 380 JR = ((1 << 3) + 0), |
327 JALR = ((1 << 3) + 1), | 381 JALR = ((1 << 3) + 1), |
328 MOVZ = ((1 << 3) + 2), | 382 MOVZ = ((1 << 3) + 2), |
329 MOVN = ((1 << 3) + 3), | 383 MOVN = ((1 << 3) + 3), |
330 BREAK = ((1 << 3) + 5), | 384 BREAK = ((1 << 3) + 5), |
331 | 385 |
332 MFHI = ((2 << 3) + 0), | 386 MFHI = ((2 << 3) + 0), |
| 387 CLZ_R6 = ((2 << 3) + 0), |
| 388 CLO_R6 = ((2 << 3) + 1), |
333 MFLO = ((2 << 3) + 2), | 389 MFLO = ((2 << 3) + 2), |
334 | 390 |
335 MULT = ((3 << 3) + 0), | 391 MULT = ((3 << 3) + 0), |
336 MULTU = ((3 << 3) + 1), | 392 MULTU = ((3 << 3) + 1), |
337 DIV = ((3 << 3) + 2), | 393 DIV = ((3 << 3) + 2), |
338 DIVU = ((3 << 3) + 3), | 394 DIVU = ((3 << 3) + 3), |
339 | 395 |
340 ADD = ((4 << 3) + 0), | 396 ADD = ((4 << 3) + 0), |
341 ADDU = ((4 << 3) + 1), | 397 ADDU = ((4 << 3) + 1), |
342 SUB = ((4 << 3) + 2), | 398 SUB = ((4 << 3) + 2), |
343 SUBU = ((4 << 3) + 3), | 399 SUBU = ((4 << 3) + 3), |
344 AND = ((4 << 3) + 4), | 400 AND = ((4 << 3) + 4), |
345 OR = ((4 << 3) + 5), | 401 OR = ((4 << 3) + 5), |
346 XOR = ((4 << 3) + 6), | 402 XOR = ((4 << 3) + 6), |
347 NOR = ((4 << 3) + 7), | 403 NOR = ((4 << 3) + 7), |
348 | 404 |
349 SLT = ((5 << 3) + 2), | 405 SLT = ((5 << 3) + 2), |
350 SLTU = ((5 << 3) + 3), | 406 SLTU = ((5 << 3) + 3), |
351 | 407 |
352 TGE = ((6 << 3) + 0), | 408 TGE = ((6 << 3) + 0), |
353 TGEU = ((6 << 3) + 1), | 409 TGEU = ((6 << 3) + 1), |
354 TLT = ((6 << 3) + 2), | 410 TLT = ((6 << 3) + 2), |
355 TLTU = ((6 << 3) + 3), | 411 TLTU = ((6 << 3) + 3), |
356 TEQ = ((6 << 3) + 4), | 412 TEQ = ((6 << 3) + 4), |
| 413 SELEQZ_S = ((6 << 3) + 5), |
357 TNE = ((6 << 3) + 6), | 414 TNE = ((6 << 3) + 6), |
| 415 SELNEZ_S = ((6 << 3) + 7), |
| 416 |
| 417 // Multiply integers in r6. |
| 418 MUL_MUH = ((3 << 3) + 0), // MUL, MUH. |
| 419 MUL_MUH_U = ((3 << 3) + 1), // MUL_U, MUH_U. |
| 420 |
| 421 MUL_OP = ((0 << 3) + 2), |
| 422 MUH_OP = ((0 << 3) + 3), |
| 423 DIV_OP = ((0 << 3) + 2), |
| 424 MOD_OP = ((0 << 3) + 3), |
| 425 |
| 426 DIV_MOD = ((3 << 3) + 2), |
| 427 DIV_MOD_U = ((3 << 3) + 3), |
358 | 428 |
359 // SPECIAL2 Encoding of Function Field. | 429 // SPECIAL2 Encoding of Function Field. |
360 MUL = ((0 << 3) + 2), | 430 MUL = ((0 << 3) + 2), |
361 CLZ = ((4 << 3) + 0), | 431 CLZ = ((4 << 3) + 0), |
362 CLO = ((4 << 3) + 1), | 432 CLO = ((4 << 3) + 1), |
363 | 433 |
364 // SPECIAL3 Encoding of Function Field. | 434 // SPECIAL3 Encoding of Function Field. |
365 EXT = ((0 << 3) + 0), | 435 EXT = ((0 << 3) + 0), |
366 INS = ((0 << 3) + 4), | 436 INS = ((0 << 3) + 4), |
367 | 437 |
368 // REGIMM encoding of rt Field. | 438 // REGIMM encoding of rt Field. |
369 BLTZ = ((0 << 3) + 0) << 16, | 439 BLTZ = ((0 << 3) + 0) << 16, |
370 BGEZ = ((0 << 3) + 1) << 16, | 440 BGEZ = ((0 << 3) + 1) << 16, |
371 BLTZAL = ((2 << 3) + 0) << 16, | 441 BLTZAL = ((2 << 3) + 0) << 16, |
372 BGEZAL = ((2 << 3) + 1) << 16, | 442 BGEZAL = ((2 << 3) + 1) << 16, |
| 443 BGEZALL = ((2 << 3) + 3) << 16, |
373 | 444 |
374 // COP1 Encoding of rs Field. | 445 // COP1 Encoding of rs Field. |
375 MFC1 = ((0 << 3) + 0) << 21, | 446 MFC1 = ((0 << 3) + 0) << 21, |
376 CFC1 = ((0 << 3) + 2) << 21, | 447 CFC1 = ((0 << 3) + 2) << 21, |
377 MFHC1 = ((0 << 3) + 3) << 21, | 448 MFHC1 = ((0 << 3) + 3) << 21, |
378 MTC1 = ((0 << 3) + 4) << 21, | 449 MTC1 = ((0 << 3) + 4) << 21, |
379 CTC1 = ((0 << 3) + 6) << 21, | 450 CTC1 = ((0 << 3) + 6) << 21, |
380 MTHC1 = ((0 << 3) + 7) << 21, | 451 MTHC1 = ((0 << 3) + 7) << 21, |
381 BC1 = ((1 << 3) + 0) << 21, | 452 BC1 = ((1 << 3) + 0) << 21, |
382 S = ((2 << 3) + 0) << 21, | 453 S = ((2 << 3) + 0) << 21, |
(...skipping 24 matching lines...) Expand all Loading... |
407 MOV_D = ((0 << 3) + 6), | 478 MOV_D = ((0 << 3) + 6), |
408 NEG_D = ((0 << 3) + 7), | 479 NEG_D = ((0 << 3) + 7), |
409 ROUND_L_D = ((1 << 3) + 0), | 480 ROUND_L_D = ((1 << 3) + 0), |
410 TRUNC_L_D = ((1 << 3) + 1), | 481 TRUNC_L_D = ((1 << 3) + 1), |
411 CEIL_L_D = ((1 << 3) + 2), | 482 CEIL_L_D = ((1 << 3) + 2), |
412 FLOOR_L_D = ((1 << 3) + 3), | 483 FLOOR_L_D = ((1 << 3) + 3), |
413 ROUND_W_D = ((1 << 3) + 4), | 484 ROUND_W_D = ((1 << 3) + 4), |
414 TRUNC_W_D = ((1 << 3) + 5), | 485 TRUNC_W_D = ((1 << 3) + 5), |
415 CEIL_W_D = ((1 << 3) + 6), | 486 CEIL_W_D = ((1 << 3) + 6), |
416 FLOOR_W_D = ((1 << 3) + 7), | 487 FLOOR_W_D = ((1 << 3) + 7), |
| 488 MIN = ((3 << 3) + 4), |
| 489 MINA = ((3 << 3) + 5), |
| 490 MAX = ((3 << 3) + 6), |
| 491 MAXA = ((3 << 3) + 7), |
417 CVT_S_D = ((4 << 3) + 0), | 492 CVT_S_D = ((4 << 3) + 0), |
418 CVT_W_D = ((4 << 3) + 4), | 493 CVT_W_D = ((4 << 3) + 4), |
419 CVT_L_D = ((4 << 3) + 5), | 494 CVT_L_D = ((4 << 3) + 5), |
420 C_F_D = ((6 << 3) + 0), | 495 C_F_D = ((6 << 3) + 0), |
421 C_UN_D = ((6 << 3) + 1), | 496 C_UN_D = ((6 << 3) + 1), |
422 C_EQ_D = ((6 << 3) + 2), | 497 C_EQ_D = ((6 << 3) + 2), |
423 C_UEQ_D = ((6 << 3) + 3), | 498 C_UEQ_D = ((6 << 3) + 3), |
424 C_OLT_D = ((6 << 3) + 4), | 499 C_OLT_D = ((6 << 3) + 4), |
425 C_ULT_D = ((6 << 3) + 5), | 500 C_ULT_D = ((6 << 3) + 5), |
426 C_OLE_D = ((6 << 3) + 6), | 501 C_OLE_D = ((6 << 3) + 6), |
427 C_ULE_D = ((6 << 3) + 7), | 502 C_ULE_D = ((6 << 3) + 7), |
428 // COP1 Encoding of Function Field When rs=W or L. | 503 // COP1 Encoding of Function Field When rs=W or L. |
429 CVT_S_W = ((4 << 3) + 0), | 504 CVT_S_W = ((4 << 3) + 0), |
430 CVT_D_W = ((4 << 3) + 1), | 505 CVT_D_W = ((4 << 3) + 1), |
431 CVT_S_L = ((4 << 3) + 0), | 506 CVT_S_L = ((4 << 3) + 0), |
432 CVT_D_L = ((4 << 3) + 1), | 507 CVT_D_L = ((4 << 3) + 1), |
| 508 BC1EQZ = ((2 << 2) + 1) << 21, |
| 509 BC1NEZ = ((3 << 2) + 1) << 21, |
| 510 // COP1 CMP positive predicates Bit 5..4 = 00. |
| 511 CMP_AF = ((0 << 3) + 0), |
| 512 CMP_UN = ((0 << 3) + 1), |
| 513 CMP_EQ = ((0 << 3) + 2), |
| 514 CMP_UEQ = ((0 << 3) + 3), |
| 515 CMP_LT = ((0 << 3) + 4), |
| 516 CMP_ULT = ((0 << 3) + 5), |
| 517 CMP_LE = ((0 << 3) + 6), |
| 518 CMP_ULE = ((0 << 3) + 7), |
| 519 CMP_SAF = ((1 << 3) + 0), |
| 520 CMP_SUN = ((1 << 3) + 1), |
| 521 CMP_SEQ = ((1 << 3) + 2), |
| 522 CMP_SUEQ = ((1 << 3) + 3), |
| 523 CMP_SSLT = ((1 << 3) + 4), |
| 524 CMP_SSULT = ((1 << 3) + 5), |
| 525 CMP_SLE = ((1 << 3) + 6), |
| 526 CMP_SULE = ((1 << 3) + 7), |
| 527 // COP1 CMP negative predicates Bit 5..4 = 01. |
| 528 CMP_AT = ((2 << 3) + 0), // Reserved, not implemented. |
| 529 CMP_OR = ((2 << 3) + 1), |
| 530 CMP_UNE = ((2 << 3) + 2), |
| 531 CMP_NE = ((2 << 3) + 3), |
| 532 CMP_UGE = ((2 << 3) + 4), // Reserved, not implemented. |
| 533 CMP_OGE = ((2 << 3) + 5), // Reserved, not implemented. |
| 534 CMP_UGT = ((2 << 3) + 6), // Reserved, not implemented. |
| 535 CMP_OGT = ((2 << 3) + 7), // Reserved, not implemented. |
| 536 CMP_SAT = ((3 << 3) + 0), // Reserved, not implemented. |
| 537 CMP_SOR = ((3 << 3) + 1), |
| 538 CMP_SUNE = ((3 << 3) + 2), |
| 539 CMP_SNE = ((3 << 3) + 3), |
| 540 CMP_SUGE = ((3 << 3) + 4), // Reserved, not implemented. |
| 541 CMP_SOGE = ((3 << 3) + 5), // Reserved, not implemented. |
| 542 CMP_SUGT = ((3 << 3) + 6), // Reserved, not implemented. |
| 543 CMP_SOGT = ((3 << 3) + 7), // Reserved, not implemented. |
| 544 |
| 545 SEL = ((2 << 3) + 0), |
| 546 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. |
| 547 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. |
433 // COP1 Encoding of Function Field When rs=PS. | 548 // COP1 Encoding of Function Field When rs=PS. |
434 // COP1X Encoding of Function Field. | 549 // COP1X Encoding of Function Field. |
435 MADD_D = ((4 << 3) + 1), | 550 MADD_D = ((4 << 3) + 1), |
436 | 551 |
437 NULLSF = 0 | 552 NULLSF = 0 |
438 }; | 553 }; |
439 | 554 |
440 | 555 |
441 // ----- Emulated conditions. | 556 // ----- Emulated conditions. |
442 // On MIPS we use this enum to abstract from conditionnal branch instructions. | 557 // On MIPS we use this enum to abstract from conditionnal branch instructions. |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 default: | 883 default: |
769 return NULLSF; | 884 return NULLSF; |
770 } | 885 } |
771 } | 886 } |
772 | 887 |
773 inline int32_t Imm16Value() const { | 888 inline int32_t Imm16Value() const { |
774 DCHECK(InstructionType() == kImmediateType); | 889 DCHECK(InstructionType() == kImmediateType); |
775 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); | 890 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); |
776 } | 891 } |
777 | 892 |
| 893 inline int32_t Imm21Value() const { |
| 894 DCHECK(InstructionType() == kImmediateType); |
| 895 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); |
| 896 } |
| 897 |
778 inline int32_t Imm26Value() const { | 898 inline int32_t Imm26Value() const { |
779 DCHECK(InstructionType() == kJumpType); | 899 DCHECK(InstructionType() == kJumpType); |
780 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); | 900 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); |
781 } | 901 } |
782 | 902 |
783 // Say if the instruction should not be used in a branch delay slot. | 903 // Say if the instruction should not be used in a branch delay slot. |
784 bool IsForbiddenInBranchDelay() const; | 904 bool IsForbiddenInBranchDelay() const; |
785 // Say if the instruction 'links'. e.g. jal, bal. | 905 // Say if the instruction 'links'. e.g. jal, bal. |
786 bool IsLinkingInstruction() const; | 906 bool IsLinkingInstruction() const; |
787 // Say if the instruction is a break or a trap. | 907 // Say if the instruction is a break or a trap. |
(...skipping 22 matching lines...) Expand all Loading... |
810 // JS argument slots size. | 930 // JS argument slots size. |
811 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 931 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
812 // Assembly builtins argument slots size. | 932 // Assembly builtins argument slots size. |
813 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 933 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
814 | 934 |
815 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 935 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
816 | 936 |
817 } } // namespace v8::internal | 937 } } // namespace v8::internal |
818 | 938 |
819 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 939 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |