[PATCH] Fix constant folding logic of setcond2_i32

Liren Wei posted 1 patch 2 years, 6 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211021021314.16746-1-lrwei@bupt.edu.cn
Maintainers: Richard Henderson <richard.henderson@linaro.org>
tcg/optimize.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] Fix constant folding logic of setcond2_i32
Posted by Liren Wei 2 years, 6 months ago
For setcond2_i32 DST, A_low, A_high, B_low, B_high, TCG_COND_EQ,
DST should be 0 as long as either half of A and B are not equal.

Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
---
 tcg/optimize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index c239c3bd07..45a10e5e72 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1492,7 +1492,7 @@ void tcg_optimize(TCGContext *s)
                                                op->args[2], op->args[4],
                                                TCG_COND_EQ);
                 if (tmp == 0) {
-                    goto do_setcond_high;
+                    goto do_setcond_const;
                 } else if (tmp != 1) {
                     goto do_default;
                 }
-- 
2.33.0




Re: [PATCH] Fix constant folding logic of setcond2_i32
Posted by Liren Wei 2 years, 6 months ago
On 10/21/21 10:13, Liren Wei wrote:
> For setcond2_i32 DST, A_low, A_high, B_low, B_high, TCG_COND_EQ,
> DST should be 0 as long as either half of A and B are not equal.
>
> Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
> ---
>   tcg/optimize.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index c239c3bd07..45a10e5e72 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -1492,7 +1492,7 @@ void tcg_optimize(TCGContext *s)
>                                                  op->args[2], op->args[4],
>                                                  TCG_COND_EQ);
>                   if (tmp == 0) {
> -                    goto do_setcond_high;
> +                    goto do_setcond_const;
>                   } else if (tmp != 1) {
>                       goto do_default;
>                   }
Just noticed that this has been fixed in new patch series by others, 
please ignore this. Sorry about that...