IR: Implement FPVectorAdd

This commit is contained in:
MerryMage 2018-02-11 16:29:48 +00:00
parent 5f77ab28ee
commit 98c8e7d1af
4 changed files with 22 additions and 0 deletions

View file

@ -25,6 +25,14 @@ static void EmitVectorOperation(BlockOfCode& code, EmitContext& ctx, IR::Inst* i
ctx.reg_alloc.DefineValue(inst, xmm_a); ctx.reg_alloc.DefineValue(inst, xmm_a);
} }
void EmitX64::EmitFPVectorAdd32(EmitContext& ctx, IR::Inst* inst) {
EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::addps);
}
void EmitX64::EmitFPVectorAdd64(EmitContext& ctx, IR::Inst* inst) {
EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::addpd);
}
void EmitX64::EmitFPVectorSub32(EmitContext& ctx, IR::Inst* inst) { void EmitX64::EmitFPVectorSub32(EmitContext& ctx, IR::Inst* inst) {
EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::subps); EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::subps);
} }

View file

@ -1154,6 +1154,17 @@ U64 IREmitter::FPU32ToDouble(const U32& a, bool round_to_nearest, bool fpscr_con
return Inst<U64>(Opcode::FPU32ToDouble, a, Imm1(round_to_nearest)); return Inst<U64>(Opcode::FPU32ToDouble, a, Imm1(round_to_nearest));
} }
U128 IREmitter::FPVectorAdd(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 32:
return Inst<U128>(Opcode::FPVectorAdd32, a, b);
case 64:
return Inst<U128>(Opcode::FPVectorAdd64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::FPVectorSub(size_t esize, const U128& a, const U128& b) { U128 IREmitter::FPVectorSub(size_t esize, const U128& a, const U128& b) {
switch (esize) { switch (esize) {
case 32: case 32:

View file

@ -248,6 +248,7 @@ public:
U64 FPS32ToDouble(const U32& a, bool round_to_nearest, bool fpscr_controlled); U64 FPS32ToDouble(const U32& a, bool round_to_nearest, bool fpscr_controlled);
U64 FPU32ToDouble(const U32& a, bool round_to_nearest, bool fpscr_controlled); U64 FPU32ToDouble(const U32& a, bool round_to_nearest, bool fpscr_controlled);
U128 FPVectorAdd(size_t esize, const U128& a, const U128& b);
U128 FPVectorSub(size_t esize, const U128& a, const U128& b); U128 FPVectorSub(size_t esize, const U128& a, const U128& b);
void Breakpoint(); void Breakpoint();

View file

@ -294,6 +294,8 @@ OPCODE(FPU32ToDouble, T::U64, T::U32, T::U1
OPCODE(FPS32ToDouble, T::U64, T::U32, T::U1 ) OPCODE(FPS32ToDouble, T::U64, T::U32, T::U1 )
// Floating-point vector instructions // Floating-point vector instructions
OPCODE(FPVectorAdd32, T::U128, T::U128, T::U128 )
OPCODE(FPVectorAdd64, T::U128, T::U128, T::U128 )
OPCODE(FPVectorSub32, T::U128, T::U128, T::U128 ) OPCODE(FPVectorSub32, T::U128, T::U128, T::U128 )
OPCODE(FPVectorSub64, T::U128, T::U128, T::U128 ) OPCODE(FPVectorSub64, T::U128, T::U128, T::U128 )