From 285fd22c3065917587cd6976e2f2d72dc49c165e Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 24 Jan 2018 17:11:13 +0000 Subject: [PATCH] IR: Add IR instruction VectorZeroUpper --- src/backend_x64/emit_x64_vector.cpp | 11 +++++++++++ src/frontend/ir/ir_emitter.cpp | 4 ++++ src/frontend/ir/ir_emitter.h | 1 + src/frontend/ir/opcodes.inc | 1 + 4 files changed, 17 insertions(+) diff --git a/src/backend_x64/emit_x64_vector.cpp b/src/backend_x64/emit_x64_vector.cpp index 8a468fbf..d3ef22bf 100644 --- a/src/backend_x64/emit_x64_vector.cpp +++ b/src/backend_x64/emit_x64_vector.cpp @@ -367,5 +367,16 @@ void EmitX64::EmitVectorBroadcast64(EmitContext& ctx, IR::Inst* inst) { ctx.reg_alloc.DefineValue(inst, a); } + +void EmitX64::EmitVectorZeroUpper(EmitContext& ctx, IR::Inst* inst) { + auto args = ctx.reg_alloc.GetArgumentInfo(inst); + + Xbyak::Xmm a = ctx.reg_alloc.UseScratchXmm(args[0]); + + code->movq(a, a); // TODO: !IsLastUse + + ctx.reg_alloc.DefineValue(inst, a); +} + } // namespace BackendX64 } // namespace Dynarmic diff --git a/src/frontend/ir/ir_emitter.cpp b/src/frontend/ir/ir_emitter.cpp index d29926d5..0f5f9ec4 100644 --- a/src/frontend/ir/ir_emitter.cpp +++ b/src/frontend/ir/ir_emitter.cpp @@ -761,6 +761,10 @@ U128 IREmitter::VectorPairedAdd64(const U128& a, const U128& b) { return Inst(Opcode::VectorPairedAdd64, a, b); } +U128 IREmitter::VectorZeroUpper(const U128& a) { + return Inst(Opcode::VectorZeroUpper, a); +} + U32 IREmitter::FPAbs32(const U32& a) { return Inst(Opcode::FPAbs32, a); } diff --git a/src/frontend/ir/ir_emitter.h b/src/frontend/ir/ir_emitter.h index 39e0bda6..65fb871c 100644 --- a/src/frontend/ir/ir_emitter.h +++ b/src/frontend/ir/ir_emitter.h @@ -204,6 +204,7 @@ public: U128 VectorPairedAdd16(const U128& a, const U128& b); U128 VectorPairedAdd32(const U128& a, const U128& b); U128 VectorPairedAdd64(const U128& a, const U128& b); + U128 VectorZeroUpper(const U128& a); U32 FPAbs32(const U32& a); U64 FPAbs64(const U64& a); diff --git a/src/frontend/ir/opcodes.inc b/src/frontend/ir/opcodes.inc index 20c40040..67ef1569 100644 --- a/src/frontend/ir/opcodes.inc +++ b/src/frontend/ir/opcodes.inc @@ -189,6 +189,7 @@ OPCODE(VectorPairedAdd8, T::U128, T::U128, T::U128 OPCODE(VectorPairedAdd16, T::U128, T::U128, T::U128 ) OPCODE(VectorPairedAdd32, T::U128, T::U128, T::U128 ) OPCODE(VectorPairedAdd64, T::U128, T::U128, T::U128 ) +OPCODE(VectorZeroUpper, T::U128, T::U128 ) // Floating-point operations OPCODE(FPAbs32, T::U32, T::U32 )