mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-02-18 22:42:58 +00:00
IR: Implement VectorExtract, VectorExtractLower IR instructions
This commit is contained in:
@@ -487,6 +487,38 @@ void EmitX64::EmitVectorEqual128(EmitContext& ctx, IR::Inst* inst) {
|
||||
}
|
||||
}
|
||||
|
||||
void EmitX64::EmitVectorExtract(EmitContext& ctx, IR::Inst* inst) {
|
||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||
|
||||
const Xbyak::Xmm xmm_a = ctx.reg_alloc.UseScratchXmm(args[0]);
|
||||
const Xbyak::Xmm xmm_b = ctx.reg_alloc.UseScratchXmm(args[1]);
|
||||
|
||||
const u8 position = args[2].GetImmediateU8();
|
||||
ASSERT(position % 8 == 0);
|
||||
|
||||
code.psrldq(xmm_a, position / 8);
|
||||
code.pslldq(xmm_b, (128 - position) / 8);
|
||||
code.por(xmm_a, xmm_b);
|
||||
|
||||
ctx.reg_alloc.DefineValue(inst, xmm_a);
|
||||
}
|
||||
|
||||
void EmitX64::EmitVectorExtractLower(EmitContext& ctx, IR::Inst* inst) {
|
||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||
|
||||
const Xbyak::Xmm xmm_a = ctx.reg_alloc.UseScratchXmm(args[0]);
|
||||
const Xbyak::Xmm xmm_b = ctx.reg_alloc.UseScratchXmm(args[1]);
|
||||
|
||||
const u8 position = args[2].GetImmediateU8();
|
||||
ASSERT(position % 8 == 0);
|
||||
|
||||
code.psrldq(xmm_a, position / 8);
|
||||
code.pslldq(xmm_b, (64 - position) / 8);
|
||||
code.por(xmm_a, xmm_b);
|
||||
|
||||
ctx.reg_alloc.DefineValue(inst, xmm_a);
|
||||
}
|
||||
|
||||
void EmitX64::EmitVectorGreaterS8(EmitContext& ctx, IR::Inst* inst) {
|
||||
EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::pcmpgtb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user