Commit cd5c0095 authored by dusan.simicic's avatar dusan.simicic Committed by Commit bot

MIPS[64]: Support for MSA instructions

This patch adds support for MIPS SIMD (MSA) instructions in Assembler
and Decoder (disassembler) classes. MSA instructions are implemented for
both mips32 and mips64 architectures.

BUG=

Review-Url: https://codereview.chromium.org/2740123004
Cr-Commit-Position: refs/heads/master@{#44148}
parent fc44d57b
...@@ -596,7 +596,10 @@ CPU::CPU() ...@@ -596,7 +596,10 @@ CPU::CPU()
CPUInfo cpu_info; CPUInfo cpu_info;
char* cpu_model = cpu_info.ExtractField("cpu model"); char* cpu_model = cpu_info.ExtractField("cpu model");
has_fpu_ = HasListItem(cpu_model, "FPU"); has_fpu_ = HasListItem(cpu_model, "FPU");
char* ASEs = cpu_info.ExtractField("ASEs implemented");
has_msa_ = HasListItem(ASEs, "msa");
delete[] cpu_model; delete[] cpu_model;
delete[] ASEs;
#ifdef V8_HOST_ARCH_MIPS #ifdef V8_HOST_ARCH_MIPS
is_fp64_mode_ = __detect_fp64_mode(); is_fp64_mode_ = __detect_fp64_mode();
architecture_ = __detect_mips_arch_revision(); architecture_ = __detect_mips_arch_revision();
......
...@@ -113,6 +113,7 @@ class V8_BASE_EXPORT CPU final { ...@@ -113,6 +113,7 @@ class V8_BASE_EXPORT CPU final {
// mips features // mips features
bool is_fp64_mode() const { return is_fp64_mode_; } bool is_fp64_mode() const { return is_fp64_mode_; }
bool has_msa() const { return has_msa_; }
private: private:
char vendor_[13]; char vendor_[13];
...@@ -154,6 +155,7 @@ class V8_BASE_EXPORT CPU final { ...@@ -154,6 +155,7 @@ class V8_BASE_EXPORT CPU final {
bool has_vfp3_d32_; bool has_vfp3_d32_;
bool is_fp64_mode_; bool is_fp64_mode_;
bool has_non_stop_time_stamp_counter_; bool has_non_stop_time_stamp_counter_;
bool has_msa_;
}; };
} // namespace base } // namespace base
......
...@@ -778,6 +778,7 @@ enum CpuFeature { ...@@ -778,6 +778,7 @@ enum CpuFeature {
MIPSr1, MIPSr1,
MIPSr2, MIPSr2,
MIPSr6, MIPSr6,
MIPS_SIMD, // MSA instructions
// ARM64 // ARM64
ALWAYS_ALIGN_CSP, ALWAYS_ALIGN_CSP,
// PPC // PPC
......
This diff is collapsed.
This diff is collapsed.
...@@ -122,6 +122,44 @@ int FPURegisters::Number(const char* name) { ...@@ -122,6 +122,44 @@ int FPURegisters::Number(const char* name) {
return kInvalidFPURegister; return kInvalidFPURegister;
} }
const char* MSARegisters::names_[kNumMSARegisters] = {
"w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10",
"w11", "w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21",
"w22", "w23", "w24", "w25", "w26", "w27", "w28", "w29", "w30", "w31"};
const MSARegisters::RegisterAlias MSARegisters::aliases_[] = {
{kInvalidRegister, NULL}};
const char* MSARegisters::Name(int creg) {
const char* result;
if ((0 <= creg) && (creg < kNumMSARegisters)) {
result = names_[creg];
} else {
result = "nocreg";
}
return result;
}
int MSARegisters::Number(const char* name) {
// Look through the canonical names.
for (int i = 0; i < kNumMSARegisters; i++) {
if (strcmp(names_[i], name) == 0) {
return i;
}
}
// Look through the alias names.
int i = 0;
while (aliases_[i].creg != kInvalidRegister) {
if (strcmp(aliases_[i].name, name) == 0) {
return aliases_[i].creg;
}
i++;
}
// No Cregister with the reguested name found.
return kInvalidMSARegister;
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -121,6 +121,46 @@ int FPURegisters::Number(const char* name) { ...@@ -121,6 +121,46 @@ int FPURegisters::Number(const char* name) {
// No Cregister with the reguested name found. // No Cregister with the reguested name found.
return kInvalidFPURegister; return kInvalidFPURegister;
} }
const char* MSARegisters::names_[kNumMSARegisters] = {
"w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10",
"w11", "w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21",
"w22", "w23", "w24", "w25", "w26", "w27", "w28", "w29", "w30", "w31"};
const MSARegisters::RegisterAlias MSARegisters::aliases_[] = {
{kInvalidRegister, NULL}};
const char* MSARegisters::Name(int creg) {
const char* result;
if ((0 <= creg) && (creg < kNumMSARegisters)) {
result = names_[creg];
} else {
result = "nocreg";
}
return result;
}
int MSARegisters::Number(const char* name) {
// Look through the canonical names.
for (int i = 0; i < kNumMSARegisters; i++) {
if (strcmp(names_[i], name) == 0) {
return i;
}
}
// Look through the alias names.
int i = 0;
while (aliases_[i].creg != kInvalidRegister) {
if (strcmp(aliases_[i].name, name) == 0) {
return aliases_[i].creg;
}
i++;
}
// No Cregister with the reguested name found.
return kInvalidMSARegister;
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment