emit_x64_vector: Slightly improve ArithmeticShiftRightByte
This commit is contained in:
parent
43407c4bb4
commit
0921678edb
1 changed files with 5 additions and 8 deletions
|
@ -381,14 +381,11 @@ void EmitX64::EmitVectorAnd(EmitContext& ctx, IR::Inst* inst) {
|
||||||
static void ArithmeticShiftRightByte(EmitContext& ctx, BlockOfCode& code, const Xbyak::Xmm& result, u8 shift_amount) {
|
static void ArithmeticShiftRightByte(EmitContext& ctx, BlockOfCode& code, const Xbyak::Xmm& result, u8 shift_amount) {
|
||||||
const Xbyak::Xmm tmp = ctx.reg_alloc.ScratchXmm();
|
const Xbyak::Xmm tmp = ctx.reg_alloc.ScratchXmm();
|
||||||
|
|
||||||
// TODO: Optimize
|
code.punpckhbw(tmp, result);
|
||||||
code.movdqa(tmp, result);
|
code.punpcklbw(result, result);
|
||||||
code.pslldq(tmp, 1);
|
code.psraw(tmp, 8 + shift_amount);
|
||||||
code.psraw(tmp, shift_amount);
|
code.psraw(result, 8 + shift_amount);
|
||||||
code.psraw(result, shift_amount + 8);
|
code.packsswb(result, tmp);
|
||||||
code.psllw(result, 8);
|
|
||||||
code.psrlw(tmp, 8);
|
|
||||||
code.por(result, tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitX64::EmitVectorArithmeticShiftRight8(EmitContext& ctx, IR::Inst* inst) {
|
void EmitX64::EmitVectorArithmeticShiftRight8(EmitContext& ctx, IR::Inst* inst) {
|
||||||
|
|
Loading…
Reference in a new issue