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

Unified Diff: src/mips64/constants-mips64.h

Issue 371923006: Add mips64 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/codegen-mips64.cc ('k') | src/mips64/constants-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/constants-mips64.h
diff --git a/src/mips/constants-mips.h b/src/mips64/constants-mips64.h
similarity index 89%
copy from src/mips/constants-mips.h
copy to src/mips64/constants-mips64.h
index fc64f7dbbf99431e5cdd21866ef41f905680bb0e..942c49750875434bd5e935a32fd161018ed1fd75 100644
--- a/src/mips/constants-mips.h
+++ b/src/mips64/constants-mips64.h
@@ -19,32 +19,45 @@
enum ArchVariants {
kMips32r2,
kMips32r1,
- kLoongson
+ kLoongson,
+ kMips64r2
};
-#ifdef _MIPS_ARCH_MIPS32R2
- static const ArchVariants kArchVariant = kMips32r2;
+
+#ifdef _MIPS_ARCH_MIPS64R2
+ static const ArchVariants kArchVariant = kMips64r2;
#elif _MIPS_ARCH_LOONGSON
// The loongson flag refers to the LOONGSON architectures based on MIPS-III,
// which predates (and is a subset of) the mips32r2 and r1 architectures.
static const ArchVariants kArchVariant = kLoongson;
#else
- static const ArchVariants kArchVariant = kMips32r1;
+ static const ArchVariants kArchVariant = kMips64r1;
#endif
-enum Endianness {
- kLittle,
- kBig
+
+// TODO(plind): consider deriving ABI from compiler flags or build system.
+
+// ABI-dependent definitions are made with #define in simulator-mips64.h,
+// so the ABI choice must be available to the pre-processor. However, in all
+// other cases, we should use the enum AbiVariants with normal if statements.
+
+#define MIPS_ABI_N64 1
+// #define MIPS_ABI_O32 1
+
+// The only supported Abi's are O32, and n64.
+enum AbiVariants {
+ kO32,
+ kN64 // Use upper case N for 'n64' ABI to conform to style standard.
};
-#if defined(V8_TARGET_LITTLE_ENDIAN)
- static const Endianness kArchEndian = kLittle;
-#elif defined(V8_TARGET_BIG_ENDIAN)
- static const Endianness kArchEndian = kBig;
+#ifdef MIPS_ABI_N64
+static const AbiVariants kMipsAbi = kN64;
#else
-#error Unknown endianness
+static const AbiVariants kMipsAbi = kO32;
#endif
+
+// TODO(plind): consider renaming these ...
#if(defined(__mips_hard_float) && __mips_hard_float != 0)
// Use floating-point coprocessor instructions. This flag is raised when
// -mhard-float is passed to the compiler.
@@ -58,15 +71,10 @@ const bool IsMipsSoftFloatABI = true;
const bool IsMipsSoftFloatABI = true;
#endif
-#if defined(V8_TARGET_LITTLE_ENDIAN)
-const uint32_t kHoleNanUpper32Offset = 4;
-const uint32_t kHoleNanLower32Offset = 0;
-#elif defined(V8_TARGET_BIG_ENDIAN)
-const uint32_t kHoleNanUpper32Offset = 0;
-const uint32_t kHoleNanLower32Offset = 4;
-#else
-#error Unknown endianness
-#endif
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
// Defines constants and accessor classes to assemble, disassemble and
// simulate MIPS32 instructions.
@@ -99,6 +107,8 @@ const int kInvalidFPURegister = -1;
const int kFCSRRegister = 31;
const int kInvalidFPUControlRegister = -1;
const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1 << 31) - 1;
+const uint64_t kFPU64InvalidResult =
+ static_cast<uint64_t>(static_cast<uint64_t>(1) << 63) - 1;
// FCSR constants.
const uint32_t kFCSRInexactFlagBit = 2;
@@ -146,8 +156,8 @@ class Registers {
const char* name;
};
- static const int32_t kMaxValue = 0x7fffffff;
- static const int32_t kMinValue = 0x80000000;
+ static const int64_t kMaxValue = 0x7fffffffffffffffl;
+ static const int64_t kMinValue = 0x8000000000000000l;
private:
static const char* names_[kNumSimuRegisters];
@@ -220,6 +230,8 @@ const int kImm26Shift = 0;
const int kImm26Bits = 26;
const int kImm28Shift = 0;
const int kImm28Bits = 28;
+const int kImm32Shift = 0;
+const int kImm32Bits = 32;
// In branches and jumps immediate fields point to words, not bytes,
// and are therefore shifted by 2.
@@ -256,6 +268,9 @@ const int kHiMask = 0xffff << 16;
const int kLoMask = 0xffff;
const int kSignMask = 0x80000000;
const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1;
+const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48;
+const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32;
+const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16;
// ----- MIPS Opcodes and Function Fields.
// We use this presentation to stay close to the table representation in
@@ -286,6 +301,10 @@ enum Opcode {
BLEZL = ((2 << 3) + 6) << kOpcodeShift,
BGTZL = ((2 << 3) + 7) << kOpcodeShift,
+ DADDI = ((3 << 3) + 0) << kOpcodeShift,
+ DADDIU = ((3 << 3) + 1) << kOpcodeShift,
+ LDL = ((3 << 3) + 2) << kOpcodeShift,
+ LDR = ((3 << 3) + 3) << kOpcodeShift,
SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift,
SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift,
@@ -296,19 +315,27 @@ enum Opcode {
LBU = ((4 << 3) + 4) << kOpcodeShift,
LHU = ((4 << 3) + 5) << kOpcodeShift,
LWR = ((4 << 3) + 6) << kOpcodeShift,
+ LWU = ((4 << 3) + 7) << kOpcodeShift,
+
SB = ((5 << 3) + 0) << kOpcodeShift,
SH = ((5 << 3) + 1) << kOpcodeShift,
SWL = ((5 << 3) + 2) << kOpcodeShift,
SW = ((5 << 3) + 3) << kOpcodeShift,
+ SDL = ((5 << 3) + 4) << kOpcodeShift,
+ SDR = ((5 << 3) + 5) << kOpcodeShift,
SWR = ((5 << 3) + 6) << kOpcodeShift,
LWC1 = ((6 << 3) + 1) << kOpcodeShift,
+ LLD = ((6 << 3) + 4) << kOpcodeShift,
LDC1 = ((6 << 3) + 5) << kOpcodeShift,
+ LD = ((6 << 3) + 7) << kOpcodeShift,
PREF = ((6 << 3) + 3) << kOpcodeShift,
SWC1 = ((7 << 3) + 1) << kOpcodeShift,
+ SCD = ((7 << 3) + 4) << kOpcodeShift,
SDC1 = ((7 << 3) + 5) << kOpcodeShift,
+ SD = ((7 << 3) + 7) << kOpcodeShift,
COP1X = ((1 << 4) + 3) << kOpcodeShift
};
@@ -331,11 +358,18 @@ enum SecondaryField {
MFHI = ((2 << 3) + 0),
MFLO = ((2 << 3) + 2),
+ DSLLV = ((2 << 3) + 4),
+ DSRLV = ((2 << 3) + 6),
+ DSRAV = ((2 << 3) + 7),
MULT = ((3 << 3) + 0),
MULTU = ((3 << 3) + 1),
DIV = ((3 << 3) + 2),
DIVU = ((3 << 3) + 3),
+ DMULT = ((3 << 3) + 4),
+ DMULTU = ((3 << 3) + 5),
+ DDIV = ((3 << 3) + 6),
+ DDIVU = ((3 << 3) + 7),
ADD = ((4 << 3) + 0),
ADDU = ((4 << 3) + 1),
@@ -348,6 +382,10 @@ enum SecondaryField {
SLT = ((5 << 3) + 2),
SLTU = ((5 << 3) + 3),
+ DADD = ((5 << 3) + 4),
+ DADDU = ((5 << 3) + 5),
+ DSUB = ((5 << 3) + 6),
+ DSUBU = ((5 << 3) + 7),
TGE = ((6 << 3) + 0),
TGEU = ((6 << 3) + 1),
@@ -356,6 +394,14 @@ enum SecondaryField {
TEQ = ((6 << 3) + 4),
TNE = ((6 << 3) + 6),
+ DSLL = ((7 << 3) + 0),
+ DSRL = ((7 << 3) + 2),
+ DSRA = ((7 << 3) + 3),
+ DSLL32 = ((7 << 3) + 4),
+ DSRL32 = ((7 << 3) + 6),
+ DSRA32 = ((7 << 3) + 7),
+ // drotr in special4?
+
// SPECIAL2 Encoding of Function Field.
MUL = ((0 << 3) + 2),
CLZ = ((4 << 3) + 0),
@@ -363,7 +409,15 @@ enum SecondaryField {
// SPECIAL3 Encoding of Function Field.
EXT = ((0 << 3) + 0),
+ DEXTM = ((0 << 3) + 1),
+ DEXTU = ((0 << 3) + 2),
+ DEXT = ((0 << 3) + 3),
INS = ((0 << 3) + 4),
+ DINSM = ((0 << 3) + 5),
+ DINSU = ((0 << 3) + 6),
+ DINS = ((0 << 3) + 7),
+
+ DSBH = ((4 << 3) + 4),
// REGIMM encoding of rt Field.
BLTZ = ((0 << 3) + 0) << 16,
@@ -373,9 +427,11 @@ enum SecondaryField {
// COP1 Encoding of rs Field.
MFC1 = ((0 << 3) + 0) << 21,
+ DMFC1 = ((0 << 3) + 1) << 21,
CFC1 = ((0 << 3) + 2) << 21,
MFHC1 = ((0 << 3) + 3) << 21,
MTC1 = ((0 << 3) + 4) << 21,
+ DMTC1 = ((0 << 3) + 5) << 21,
CTC1 = ((0 << 3) + 6) << 21,
MTHC1 = ((0 << 3) + 7) << 21,
BC1 = ((1 << 3) + 0) << 21,
@@ -805,12 +861,11 @@ class Instruction {
// MIPS assembly various constants.
// C/C++ argument slots size.
-const int kCArgSlotCount = 4;
-const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize;
-// JS argument slots size.
-const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize;
-// Assembly builtins argument slots size.
-const int kBArgsSlotsSize = 0 * Instruction::kInstrSize;
+const int kCArgSlotCount = (kMipsAbi == kN64) ? 0 : 4;
+
+// TODO(plind): below should be based on kPointerSize
+// TODO(plind): find all usages and remove the needless instructions for n64.
+const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2;
const int kBranchReturnOffset = 2 * Instruction::kInstrSize;
« no previous file with comments | « src/mips64/codegen-mips64.cc ('k') | src/mips64/constants-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698