Commit 13c3093b authored by LiuYu's avatar LiuYu Committed by Commit Bot

[mips64] Move LoadSplat into macro-assembler

Besides, fix i64x2 widen i32x4 instructions in mips32.

Change-Id: I85e3f8f4ab16c268a5b17189f67c78ef45762e39
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2711737Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu yu <liuyu@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#72907}
parent 5b783479
......@@ -2755,6 +2755,31 @@ void TurboAssembler::ExtMulHigh(MSADataType type, MSARegister dst,
}
#undef EXT_MUL_BINOP
void TurboAssembler::LoadSplat(MSASize sz, MSARegister dst, MemOperand src) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
switch (sz) {
case MSA_B:
Lb(scratch, src);
fill_b(dst, scratch);
break;
case MSA_H:
Lh(scratch, src);
fill_h(dst, scratch);
break;
case MSA_W:
Lw(scratch, src);
fill_w(dst, scratch);
break;
case MSA_D:
Ld(scratch, src);
fill_d(dst, scratch);
break;
default:
UNREACHABLE();
}
}
void TurboAssembler::MSARoundW(MSARegister dst, MSARegister src,
FPURoundingMode mode) {
BlockTrampolinePoolScope block_trampoline_pool(this);
......
......@@ -802,6 +802,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
MSARegister src2);
void ExtMulHigh(MSADataType type, MSARegister dst, MSARegister src1,
MSARegister src2);
void LoadSplat(MSASize sz, MSARegister dst, MemOperand src);
void MSARoundW(MSARegister dst, MSARegister src, FPURoundingMode mode);
void MSARoundD(MSARegister dst, MSARegister src, FPURoundingMode mode);
......
......@@ -1817,28 +1817,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ByteSwapSigned(i.OutputRegister(0), i.InputRegister(0), 4);
break;
}
case kMips64S128Load8Splat: {
case kMips64S128LoadSplat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ Lb(kScratchReg, i.MemoryOperand());
__ fill_b(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMips64S128Load16Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ Lh(kScratchReg, i.MemoryOperand());
__ fill_h(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMips64S128Load32Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ Lw(kScratchReg, i.MemoryOperand());
__ fill_w(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMips64S128Load64Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ Ld(kScratchReg, i.MemoryOperand());
__ fill_d(i.OutputSimd128Register(), kScratchReg);
auto sz = static_cast<MSASize>(MiscField::decode(instr->opcode()));
__ LoadSplat(sz, i.OutputSimd128Register(), i.MemoryOperand());
break;
}
case kMips64S128Load8x8S: {
......
......@@ -366,10 +366,7 @@ namespace compiler {
V(Mips64S8x8Reverse) \
V(Mips64S8x4Reverse) \
V(Mips64S8x2Reverse) \
V(Mips64S128Load8Splat) \
V(Mips64S128Load16Splat) \
V(Mips64S128Load32Splat) \
V(Mips64S128Load64Splat) \
V(Mips64S128LoadSplat) \
V(Mips64S128Load8x8S) \
V(Mips64S128Load8x8U) \
V(Mips64S128Load16x4S) \
......
......@@ -367,10 +367,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kMips64Ulw:
case kMips64Ulwu:
case kMips64Ulwc1:
case kMips64S128Load8Splat:
case kMips64S128Load16Splat:
case kMips64S128Load32Splat:
case kMips64S128Load64Splat:
case kMips64S128LoadSplat:
case kMips64S128Load8x8S:
case kMips64S128Load8x8U:
case kMips64S128Load16x4S:
......
......@@ -434,16 +434,20 @@ void InstructionSelector::VisitLoadTransform(Node* node) {
InstructionCode opcode = kArchNop;
switch (params.transformation) {
case LoadTransformation::kS128Load8Splat:
opcode = kMips64S128Load8Splat;
opcode = kMips64S128LoadSplat;
opcode |= MiscField::encode(MSASize::MSA_B);
break;
case LoadTransformation::kS128Load16Splat:
opcode = kMips64S128Load16Splat;
opcode = kMips64S128LoadSplat;
opcode |= MiscField::encode(MSASize::MSA_H);
break;
case LoadTransformation::kS128Load32Splat:
opcode = kMips64S128Load32Splat;
opcode = kMips64S128LoadSplat;
opcode |= MiscField::encode(MSASize::MSA_W);
break;
case LoadTransformation::kS128Load64Splat:
opcode = kMips64S128Load64Splat;
opcode = kMips64S128LoadSplat;
opcode |= MiscField::encode(MSASize::MSA_D);
break;
case LoadTransformation::kS128Load8x8S:
opcode = kMips64S128Load8x8S;
......
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