emit_x64_vector: bug: VectorGetElement8 returning incorrect values for non-SSE4.1

This bug wasn't discovered earlier because we previously only used index == 0.
This commit is contained in:
MerryMage 2018-02-02 21:07:00 +00:00
parent ebfc51c609
commit 6414736a8d

View file

@ -41,7 +41,10 @@ void EmitX64::EmitVectorGetElement8(EmitContext& ctx, IR::Inst* inst) {
ctx.reg_alloc.DefineValue(inst, dest);
} else {
Xbyak::Reg32 dest = ctx.reg_alloc.ScratchGpr().cvt32();
code->pextrw(dest, source, index);
code->pextrw(dest, source, index / 2);
if (index % 2 == 1) {
code->shr(dest, 8);
}
ctx.reg_alloc.DefineValue(inst, dest);
}
}