emit_x64_vector: Fix ArithmeticShiftRightByte zero_extend constant

Should be shifting in _bytes_ of `0x80`. Not bits.
This commit is contained in:
Wunk 2020-11-09 09:47:51 -08:00 committed by GitHub
parent ec52922dae
commit 3e932ca55d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -442,7 +442,7 @@ static void ArithmeticShiftRightByte(EmitContext& ctx, BlockOfCode& code, const
if (code.HasAVX512_Icelake()) { if (code.HasAVX512_Icelake()) {
// Do a logical shift right upon the 8x8 bit-matrix, but shift in // Do a logical shift right upon the 8x8 bit-matrix, but shift in
// `0x80` bytes into the matrix to repeat the most significant bit. // `0x80` bytes into the matrix to repeat the most significant bit.
const u64 zero_extend = ~(0xFFFFFFFFFFFFFFFF << shift_amount) & 0x8080808080808080; const u64 zero_extend = ~(0xFFFFFFFFFFFFFFFF << (shift_amount * 8)) & 0x8080808080808080;
const u64 shift_matrix = (0x0102040810204080 >> (shift_amount * 8)) | zero_extend; const u64 shift_matrix = (0x0102040810204080 >> (shift_amount * 8)) | zero_extend;
code.vgf2p8affineqb(result, result, code.MConst(xword_b, shift_matrix), 0); code.vgf2p8affineqb(result, result, code.MConst(xword_b, shift_matrix), 0);
return; return;