mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-07 06:58:15 +01:00
VFP: Implement VMUL
This commit is contained in:
parent
97b5fa173f
commit
12e7f2c359
8 changed files with 93 additions and 73 deletions
|
|
@ -1090,7 +1090,49 @@ static void DefaultNaN64(XEmitter* code, Routines* routines, X64Reg xmm_value) {
|
|||
code->SetJumpTarget(fixup);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPAbs32(IR::Block& block, IR::Inst* inst) {
|
||||
static void FPOp32(XEmitter* code, Routines* routines, RegAlloc& reg_alloc, IR::Block& block, IR::Inst* inst, void (XEmitter::*fn)(X64Reg, const OpArg&)) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero32(code, result, gpr_scratch);
|
||||
DenormalsAreZero32(code, operand, gpr_scratch);
|
||||
}
|
||||
(code->*fn)(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero32(code, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN32(code, routines, result);
|
||||
}
|
||||
}
|
||||
|
||||
static void FPOp64(XEmitter* code, Routines* routines, RegAlloc& reg_alloc, IR::Block& block, IR::Inst* inst, void (XEmitter::*fn)(X64Reg, const OpArg&)) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero64(code, routines, result, gpr_scratch);
|
||||
DenormalsAreZero64(code, routines, operand, gpr_scratch);
|
||||
}
|
||||
(code->*fn)(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero64(code, routines, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN64(code, routines, result);
|
||||
}
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPAbs32(IR::Block&, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
|
|
@ -1098,7 +1140,7 @@ void EmitX64::EmitFPAbs32(IR::Block& block, IR::Inst* inst) {
|
|||
code->PAND(result, routines->MFloatNonSignMask32());
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPAbs64(IR::Block& block, IR::Inst* inst) {
|
||||
void EmitX64::EmitFPAbs64(IR::Block&, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
|
|
@ -1107,87 +1149,27 @@ void EmitX64::EmitFPAbs64(IR::Block& block, IR::Inst* inst) {
|
|||
}
|
||||
|
||||
void EmitX64::EmitFPAdd32(IR::Block& block, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero32(code, result, gpr_scratch);
|
||||
DenormalsAreZero32(code, operand, gpr_scratch);
|
||||
}
|
||||
code->ADDSS(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero32(code, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN32(code, routines, result);
|
||||
}
|
||||
FPOp32(code, routines, reg_alloc, block, inst, &XEmitter::ADDSS);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPAdd64(IR::Block& block, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
FPOp64(code, routines, reg_alloc, block, inst, &XEmitter::ADDSD);
|
||||
}
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
void EmitX64::EmitFPMul32(IR::Block& block, IR::Inst* inst) {
|
||||
FPOp32(code, routines, reg_alloc, block, inst, &XEmitter::MULSS);
|
||||
}
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero64(code, routines, result, gpr_scratch);
|
||||
DenormalsAreZero64(code, routines, operand, gpr_scratch);
|
||||
}
|
||||
code->ADDSD(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero64(code, routines, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN64(code, routines, result);
|
||||
}
|
||||
void EmitX64::EmitFPMul64(IR::Block& block, IR::Inst* inst) {
|
||||
FPOp64(code, routines, reg_alloc, block, inst, &XEmitter::MULSD);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPSub32(IR::Block& block, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero32(code, result, gpr_scratch);
|
||||
DenormalsAreZero32(code, operand, gpr_scratch);
|
||||
}
|
||||
code->SUBSS(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero32(code, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN32(code, routines, result);
|
||||
}
|
||||
FPOp32(code, routines, reg_alloc, block, inst, &XEmitter::SUBSS);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPSub64(IR::Block& block, IR::Inst* inst) {
|
||||
IR::Value a = inst->GetArg(0);
|
||||
IR::Value b = inst->GetArg(1);
|
||||
|
||||
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_xmm);
|
||||
X64Reg operand = reg_alloc.UseRegister(b, any_xmm);
|
||||
X64Reg gpr_scratch = reg_alloc.ScratchRegister(any_gpr);
|
||||
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
DenormalsAreZero64(code, routines, result, gpr_scratch);
|
||||
DenormalsAreZero64(code, routines, operand, gpr_scratch);
|
||||
}
|
||||
code->SUBSD(result, R(operand));
|
||||
if (block.location.FPSCR_FTZ()) {
|
||||
FlushToZero64(code, routines, result, gpr_scratch);
|
||||
}
|
||||
if (block.location.FPSCR_DN()) {
|
||||
DefaultNaN64(code, routines, result);
|
||||
}
|
||||
FPOp64(code, routines, reg_alloc, block, inst, &XEmitter::SUBSD);
|
||||
}
|
||||
|
||||
void EmitX64::EmitReadMemory8(IR::Block&, IR::Inst* inst) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue