emit_x64_vector: Simplify "position == 0" case for EmitVectorExtractLower()
In the event position == 0, we can just treat it as a simple movq, clearing the upper half of the XMM register. This also makes that case use only one register.
This commit is contained in:
parent
f5fb496e7e
commit
87372917f9
1 changed files with 6 additions and 3 deletions
|
@ -780,13 +780,16 @@ void EmitX64::EmitVectorExtractLower(EmitContext& ctx, IR::Inst* inst) {
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
|
|
||||||
const Xbyak::Xmm xmm_a = ctx.reg_alloc.UseScratchXmm(args[0]);
|
const Xbyak::Xmm xmm_a = ctx.reg_alloc.UseScratchXmm(args[0]);
|
||||||
const Xbyak::Xmm xmm_b = ctx.reg_alloc.UseXmm(args[1]);
|
|
||||||
|
|
||||||
const u8 position = args[2].GetImmediateU8();
|
const u8 position = args[2].GetImmediateU8();
|
||||||
ASSERT(position % 8 == 0);
|
ASSERT(position % 8 == 0);
|
||||||
|
|
||||||
code.punpcklqdq(xmm_a, xmm_b);
|
if (position != 0) {
|
||||||
code.psrldq(xmm_a, position / 8);
|
const Xbyak::Xmm xmm_b = ctx.reg_alloc.UseXmm(args[1]);
|
||||||
|
|
||||||
|
code.punpcklqdq(xmm_a, xmm_b);
|
||||||
|
code.psrldq(xmm_a, position / 8);
|
||||||
|
}
|
||||||
code.movq(xmm_a, xmm_a);
|
code.movq(xmm_a, xmm_a);
|
||||||
|
|
||||||
ctx.reg_alloc.DefineValue(inst, xmm_a);
|
ctx.reg_alloc.DefineValue(inst, xmm_a);
|
||||||
|
|
Loading…
Reference in a new issue