5#ifndef V8_CODEGEN_MIPS64_CONSTANTS_MIPS64_H_
6#define V8_CODEGEN_MIPS64_CONSTANTS_MIPS64_H_
15#define UNIMPLEMENTED_MIPS() \
16 v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \
17 __FILE__, __LINE__, __func__)
19#define UNIMPLEMENTED_MIPS()
22#define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n")
26#ifdef _MIPS_ARCH_MIPS64R2
28#elif _MIPS_ARCH_MIPS64R6
36#if defined(V8_TARGET_LITTLE_ENDIAN)
38#elif defined(V8_TARGET_BIG_ENDIAN)
41#error Unknown endianness
45#if defined(__mips_hard_float) && __mips_hard_float != 0
49#elif defined(__mips_soft_float) && __mips_soft_float != 0
58#if defined(V8_TARGET_LITTLE_ENDIAN)
59const uint32_t kMipsLwrOffset = 0;
60const uint32_t kMipsLwlOffset = 3;
61const uint32_t kMipsSwrOffset = 0;
62const uint32_t kMipsSwlOffset = 3;
63const uint32_t kMipsLdrOffset = 0;
64const uint32_t kMipsLdlOffset = 7;
65const uint32_t kMipsSdrOffset = 0;
66const uint32_t kMipsSdlOffset = 7;
67#elif defined(V8_TARGET_BIG_ENDIAN)
68const uint32_t kMipsLwrOffset = 3;
69const uint32_t kMipsLwlOffset = 0;
70const uint32_t kMipsSwrOffset = 3;
71const uint32_t kMipsSwlOffset = 0;
72const uint32_t kMipsLdrOffset = 7;
73const uint32_t kMipsLdlOffset = 0;
74const uint32_t kMipsSdrOffset = 7;
75const uint32_t kMipsSdlOffset = 0;
77#error Unknown endianness
80#if defined(V8_TARGET_LITTLE_ENDIAN)
81const uint32_t kLeastSignificantByteInInt32Offset = 0;
82const uint32_t kLessSignificantWordInDoublewordOffset = 0;
83#elif defined(V8_TARGET_BIG_ENDIAN)
84const uint32_t kLeastSignificantByteInInt32Offset = 3;
85const uint32_t kLessSignificantWordInDoublewordOffset = 4;
87#error Unknown endianness
90#ifndef __STDC_FORMAT_MACROS
91#define __STDC_FORMAT_MACROS
144 static_cast<uint64_t
>(
static_cast<uint64_t
>(1) << 63) - 1;
146 static_cast<int64_t
>(
static_cast<uint64_t
>(1) << 63);
217 static const int64_t
kMaxValue = 0x7fffffffffffffffl;
218 static const int64_t
kMinValue = 0x8000000000000000l;
222 static const RegisterAlias
aliases_[];
241 static const RegisterAlias
aliases_[];
282using Instr = int32_t;
515 JR = ((1U << 3) + 0),
517 MOVZ = ((1U << 3) + 2),
518 MOVN = ((1U << 3) + 3),
519 BREAK = ((1U << 3) + 5),
542 ADD = ((4U << 3) + 0),
544 SUB = ((4U << 3) + 2),
546 AND = ((4U << 3) + 4),
547 OR = ((4U << 3) + 5),
548 XOR = ((4U << 3) + 6),
549 NOR = ((4U << 3) + 7),
551 SLT = ((5U << 3) + 2),
552 SLTU = ((5U << 3) + 3),
562 TEQ = ((6U << 3) + 4),
595 CLZ = ((4U << 3) + 0),
648 BC1 = ((1U << 3) + 0) << 21,
649 S = ((2U << 3) + 0) << 21,
650 D = ((2U << 3) + 1) << 21,
651 W = ((2U << 3) + 4) << 21,
652 L = ((2U << 3) + 5) << 21,
653 PS = ((2U << 3) + 6) << 21,
761 SEL = ((2U << 3) + 0),
806 LD_B = ((8U << 2) + 0),
807 LD_H = ((8U << 2) + 1),
808 LD_W = ((8U << 2) + 2),
809 LD_D = ((8U << 2) + 3),
810 ST_B = ((9U << 2) + 0),
811 ST_H = ((9U << 2) + 1),
812 ST_W = ((9U << 2) + 2),
813 ST_D = ((9U << 2) + 3),
905 CEQ = ((0
U << 23) + 15),
974 FADD = ((0
U << 22) + 27),
975 FSUB = ((1U << 22) + 27),
976 FMUL = ((2U << 22) + 27),
977 FDIV = ((3U << 22) + 27),
983 FMIN = ((12U << 22) + 27),
985 FMAX = ((14U << 22) + 27),
1017 SLLI = ((0
U << 23) + 9),
1018 SRAI = ((1U << 23) + 9),
1019 SRLI = ((2U << 23) + 9),
1279 return 1ULL << (
static_cast<uint32_t
>(opcode) >>
kOpcodeShift);
1285class InstructionBase {
1298 return *
reinterpret_cast<const Instr*
>(
this);
1336#define FunctionFieldToBitNumber(function) (1ULL << function)
1371 return static_cast<Opcode>(
1455class InstructionGetters :
public T {
1601 return this->Bits(bits - 1, 0);
1657 int32_t df_m = this->Bits(22, 16);
1658 if (((df_m >> 6) & 1U) == 0) {
1660 }
else if (((df_m >> 5) & 3U) == 2) {
1662 }
else if (((df_m >> 4) & 7U) == 6) {
1664 }
else if (((df_m >> 3) & 15U) == 14) {
1673 return this->Bits(16 + this->
MsaBitDf() + 3, 16);
1679 int32_t df_n = this->Bits(21, 16);
1680 if (((df_n >> 4) & 3U) == 0) {
1682 }
else if (((df_n >> 3) & 7U) == 4) {
1684 }
else if (((df_n >> 2) & 15U) == 12) {
1686 }
else if (((df_n >> 1) & 31U) == 28) {
1696 return this->Bits(16 + 4 - this->
MsaElmDf(), 16);
1744class Instruction :
public InstructionGetters<InstructionBase> {
1904#undef OpcodeToBitNumber
1905#undef FunctionFieldToBitNumber
1912 switch (OpcodeFieldRaw()) {
1916 if (RsFieldRawNoAssert() ==
JIALC)
1921 switch (RtFieldRaw()) {
1929 switch (FunctionFieldRaw()) {
1942 if (OpcodeFieldRaw() !=
SPECIAL) {
1945 switch (FunctionFieldRaw()) {
static const char * Name(int reg)
static int Number(const char *name)
static const RegisterAlias aliases_[]
static const char * names_[kNumFPURegisters]
static const uint64_t kFunctionFieldRegisterTypeMask
Type InstructionType() const
int RsFieldRawNoAssert() const
int Bits(int hi, int lo) const
MSAMinorOpcode MSAMinorOpcodeField() const
static constexpr uint64_t kOpcodeImmediateTypeMask
V8_EXPORT_PRIVATE void SetInstructionBits(Instr new_instr, WritableJitAllocation *jit_allocation=nullptr)
Opcode OpcodeFieldRaw() const
Instr InstructionBits() const
Type InstructionType() const
Opcode OpcodeValue() const
int FunctionFieldRaw() const
int SecondaryValue() const
bool IsForbiddenAfterBranch() const
int32_t Imm18Value() const
int32_t Imm16Value() const
int32_t Imm9Value() const
int32_t MsaImm10Value() const
Opcode OpcodeFieldRaw() const
int RsFieldRawNoAssert() const
int32_t MsaBitMValue() const
int32_t MsaImm8Value() const
int FunctionValue() const
int32_t MsaImmMI10Value() const
int32_t Imm21Value() const
int32_t MsaElmNValue() const
bool IsMSABranchInstr() const
int32_t MsaImm5Value() const
int32_t ImmValue(int bits) const
bool IsLinkingInstruction() const
int FunctionFieldRaw() const
static bool IsForbiddenAfterBranchInstr(Instr instr)
int32_t Imm26Value() const
bool IsForbiddenInBranchDelay() const
int32_t Imm19Value() const
static Instruction * At(uint8_t *pc)
DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction)
static const RegisterAlias aliases_[]
static int Number(const char *name)
static const char * Name(int reg)
static const char * names_[kNumMSARegisters]
static const char * Name(int reg)
static int Number(const char *name)
static const int64_t kMaxValue
static const RegisterAlias aliases_[]
static const char * names_[kNumRegisters]
static const int64_t kMinValue
#define FunctionFieldToBitNumber(function)
const bool IsMipsSoftFloatABI
static const ArchVariants kArchVariant
const Instr kSwRegFpNegOffsetPattern
Hint NegateHint(Hint ignored)
constexpr MiscInstructionsBits74 CLZ
constexpr VFPRoundingMode kRoundToNearest
const Instr kPopInstruction
MSABranchCondition NegateMSABranchCondition(MSABranchCondition cond)
const uint32_t kFCSRNaN2008FlagBit
constexpr VFPRoundingMode kRoundToMinusInf
const int32_t kPrefHintLoadStreamed
const int kNumMSARegisters
const int kInvalidMSAControlRegister
const uint32_t kFCSRInexactCauseMask
const int kInvalidFPUControlRegister
constexpr MoveWideImmediateOp MOVZ
constexpr MoveWideImmediateOp MOVN
const uint32_t kFCSRDivideByZeroCauseBit
const uint32_t kFCSRDivideByZeroCauseMask
const uint32_t kFCSRUnimplementedOpCauseBit
constexpr VFPRoundingMode RP
constexpr int kPCRegister
const uint32_t kFCSRUnimplementedOpCauseMask
@ kUnsignedGreaterThanEqual
CheckForInexactConversion
@ kCheckForInexactConversion
@ kDontCheckForInexactConversion
const int32_t kPrefHintStore
constexpr BarrierOption LD
const uint32_t kFCSRNaN2008FlagMask
const int32_t kPrefHintStoreRetained
static constexpr uint64_t OpcodeToBitNumber(Opcode opcode)
const uint32_t kFCSRInvalidOpCauseMask
const Instr rtCallRedirInstr
const int32_t kPrefHintLoad
constexpr uint32_t kMaxStopCode
const uint32_t kMaxWatchpointCode
const int32_t kPrefHintLoadRetained
constexpr FPDataProcessing2SourceOp FSUB
const int kInvalidStackOffset
const int32_t kJalRawMark
static const int kNegOffset
const int kMsaImmMI10Bits
const int64_t kUpper16MaskOf64
const uint32_t kFCSRUnderflowFlagMask
const Instr kLwSwInstrArgumentMask
const int32_t kPrefHintWritebackInvalidate
const uint32_t kFCSRExceptionFlagMask
const int kNumFPURegisters
const int kFunctionFieldMask
const Instr kLwSwOffsetMask
const int kInvalidFPURegister
constexpr FPDataProcessing2SourceOp FMAX
constexpr VFPRoundingMode RM
const Instr kSwRegFpOffsetPattern
constexpr uint8_t kInstrSizeLog2
const int kMsaLongerELMMask
const int kNumSimuRegisters
constexpr VFPRoundingMode kRoundToPlusInf
constexpr Opcode SPECIAL2
const int kInvalidRegister
const uint32_t kFCSRInvalidOpFlagMask
constexpr FPDataProcessing2SourceOp FDIV
const int64_t kFPU64InvalidResultNegative
const uint32_t kFCSRInexactCauseBit
const int32_t kFPUInvalidResultNegative
Condition NegateCondition(Condition cond)
const Instr kLwRegFpNegOffsetPattern
const uint32_t kFCSROverflowFlagMask
const uint32_t kFCSROverflowCauseMask
constexpr VFPRoundingMode RZ
constexpr size_t kMaxPCRelativeCodeRangeInMB
const int32_t kPrefHintPrepareForStore
const int kInvalidMSARegister
const int kCArgsSlotsSize
constexpr FPDataProcessing2SourceOp FADD
const uint32_t kFCSRUnderflowCauseBit
const int32_t kJumpRawMask
const uint64_t kFPU64InvalidResult
const uint32_t kFPURoundingModeMask
const uint32_t kFCSRUnderflowCauseMask
const uint32_t kFCSRInexactFlagMask
const int kBranchReturnOffset
constexpr VFPRoundingMode kRoundToZero
constexpr FPDataProcessing2SourceOp FMIN
const int64_t kHigher16MaskOf64
constexpr VFPRoundingMode RN
const uint32_t kFCSRInvalidOpFlagBit
const uint32_t kFPUInvalidResult
constexpr uint8_t kInstrSize
const uint32_t kFCSRDivideByZeroFlagMask
const uint32_t kFCSROverflowFlagBit
const uint32_t kFCSRDivideByZeroFlagBit
constexpr Opcode SPECIAL3
constexpr int kRootRegisterBias
const Instr kPushRegPattern
const int kMsaImmMI10Shift
const Instr kLwRegFpOffsetPattern
const int kMSACSRRegister
const int64_t kTop16MaskOf64
constexpr FPDataProcessing2SourceOp FMUL
const Instr kPushInstruction
const uint32_t kFCSROverflowCauseBit
const Instr kPopRegPattern
const uint32_t kFCSRInvalidOpCauseBit
Condition NegateFpuCondition(Condition cc)
const uint32_t kFCSRUnderflowFlagBit
const uint32_t kFCSRFlagMask
constexpr FPDataProcessing1SourceOp FSQRT
const Instr kLwSwInstrTypeMask
const uint32_t kFCSRInexactFlagBit
constexpr int kNumRegisters
const int32_t kPrefHintStoreStreamed
const uint32_t kFCSRCauseMask
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_EXPORT_PRIVATE