From 3e932ca55d450ae6e1ddccad2f8b8be450a0f3d6 Mon Sep 17 00:00:00 2001 From: Wunk Date: Mon, 9 Nov 2020 09:47:51 -0800 Subject: [PATCH] emit_x64_vector: Fix ArithmeticShiftRightByte zero_extend constant Should be shifting in _bytes_ of `0x80`. Not bits. --- src/backend/x64/emit_x64_vector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/x64/emit_x64_vector.cpp b/src/backend/x64/emit_x64_vector.cpp index e71d2a7d..07f7f153 100644 --- a/src/backend/x64/emit_x64_vector.cpp +++ b/src/backend/x64/emit_x64_vector.cpp @@ -442,7 +442,7 @@ static void ArithmeticShiftRightByte(EmitContext& ctx, BlockOfCode& code, const if (code.HasAVX512_Icelake()) { // Do a logical shift right upon the 8x8 bit-matrix, but shift in // `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; code.vgf2p8affineqb(result, result, code.MConst(xword_b, shift_matrix), 0); return;