Re: [PATCH v4 119/163] tcg/i386: Honor carry_live in tcg_out_movi

2025-04-16 Thread Pierrick Bouvier

On 4/15/25 12:24, Richard Henderson wrote:

Do not clobber flags if they're live.  Required in order
to perform register allocation on add/sub carry opcodes.

Signed-off-by: Richard Henderson 
---
  tcg/i386/tcg-target.c.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 04e31cae12..8e0ccbc722 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1092,7 +1092,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type,
  {
  tcg_target_long diff;
  
-if (arg == 0) {

+if (arg == 0 && !s->carry_live) {
  tgen_arithr(s, ARITH_XOR, ret, ret);
  return;
  }


Reviewed-by: Pierrick Bouvier 




[PATCH v4 119/163] tcg/i386: Honor carry_live in tcg_out_movi

2025-04-15 Thread Richard Henderson
Do not clobber flags if they're live.  Required in order
to perform register allocation on add/sub carry opcodes.

Signed-off-by: Richard Henderson 
---
 tcg/i386/tcg-target.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 04e31cae12..8e0ccbc722 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1092,7 +1092,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type,
 {
 tcg_target_long diff;
 
-if (arg == 0) {
+if (arg == 0 && !s->carry_live) {
 tgen_arithr(s, ARITH_XOR, ret, ret);
 return;
 }
-- 
2.43.0