From: Richard Henderson Date: Wed, 27 Aug 2025 10:33:27 +0000 (+1000) Subject: tcg/i386: Expand sari of bits-1 as pcmpgt X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26c41cc4a3d998caa700407a27e18755a6e1895c;p=thirdparty%2Fqemu.git tcg/i386: Expand sari of bits-1 as pcmpgt Expand arithmetic right shift of bits-1 as a comparison vs 0. Suggested-by: Paolo Bonzini Signed-off-by: Richard Henderson --- diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 088c6c9264b..4cd5d4276c9 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -4357,6 +4357,12 @@ static void expand_vec_sari(TCGType type, unsigned vece, { TCGv_vec t1, t2; + if (imm >= (8 << vece) - 1) { + tcg_gen_cmp_vec(TCG_COND_LT, vece, v0, v1, + tcg_constant_vec(type, MO_64, 0)); + return; + } + switch (vece) { case MO_8: /* Unpack to 16-bit, shift, and repack. */