]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tcg/i386: Use canonical operand ordering in expand_vec_sari
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Aug 2025 10:38:40 +0000 (20:38 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 4 Sep 2025 07:49:23 +0000 (09:49 +0200)
The optimizer prefers to have constants as the second operand,
so expand LT x,0 instead of GT 0,x.  This will not affect the
generated code at all.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/i386/tcg-target.c.inc

index 4cd5d4276c992c61cdd57079e043bbeea2293ff1..8260c35edd09025a7553cc7b67681561085aa894 100644 (file)
@@ -4399,8 +4399,8 @@ static void expand_vec_sari(TCGType type, unsigned vece,
             /* Otherwise we will need to use a compare vs 0 to produce
              * the sign-extend, shift and merge.
              */
-            tcg_gen_cmp_vec(TCG_COND_GT, MO_64, t1,
-                            tcg_constant_vec(type, MO_64, 0), v1);
+            tcg_gen_cmp_vec(TCG_COND_LT, MO_64, t1, v1,
+                            tcg_constant_vec(type, MO_64, 0));
             tcg_gen_shri_vec(MO_64, v0, v1, imm);
             tcg_gen_shli_vec(MO_64, t1, t1, 64 - imm);
             tcg_gen_or_vec(MO_64, v0, v0, t1);