[PATCH 2/2] tcg/aarch64: Fix tcg_out_brcond for test comparisons

Richard Henderson posted 2 patches 1 year, 11 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>
[PATCH 2/2] tcg/aarch64: Fix tcg_out_brcond for test comparisons
Posted by Richard Henderson 1 year, 11 months ago
When converting test vs UINT32_MAX to compare vs 0, we need to
adjust the condition to match.

Cc: qemu-stable@nongnu.org
Fixes: 34aff3c2e06 ("tcg/aarch64: Generate CBNZ for TSTNE of UINT32_MAX")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/aarch64/tcg-target.c.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
index 38446c167e..56fc9cb9e0 100644
--- a/tcg/aarch64/tcg-target.c.inc
+++ b/tcg/aarch64/tcg-target.c.inc
@@ -1464,6 +1464,7 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a,
     case TCG_COND_TSTNE:
         /* tst xN,0xffffffff; b.ne L -> cbnz wN,L */
         if (b_const && b == UINT32_MAX) {
+            c = tcg_tst_eqne_cond(c);
             ext = TCG_TYPE_I32;
             need_cmp = false;
             break;
-- 
2.34.1
Re: [PATCH 2/2] tcg/aarch64: Fix tcg_out_brcond for test comparisons
Posted by Philippe Mathieu-Daudé 1 year, 11 months ago
On 9/3/24 18:51, Richard Henderson wrote:
> When converting test vs UINT32_MAX to compare vs 0, we need to
> adjust the condition to match.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: 34aff3c2e06 ("tcg/aarch64: Generate CBNZ for TSTNE of UINT32_MAX")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/aarch64/tcg-target.c.inc | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>