Re: [PATCH v4 043/163] tcg: Convert divu to TCGOutOpBinary

2025-04-15 Thread Pierrick Bouvier

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

For TCI, we're losing type information in the interpreter.
Introduce a tci-specific opcode to handle the difference.

Signed-off-by: Richard Henderson 
---
  tcg/aarch64/tcg-target-has.h |  2 --
  tcg/arm/tcg-target-has.h |  1 -
  tcg/loongarch64/tcg-target-has.h |  2 --
  tcg/mips/tcg-target-has.h|  2 --
  tcg/ppc/tcg-target-has.h |  2 --
  tcg/riscv/tcg-target-has.h   |  2 --
  tcg/sparc64/tcg-target-has.h |  2 --
  tcg/tcg-has.h| 15 
  tcg/tci/tcg-target-has.h |  2 --
  tcg/tcg-op.c |  8 ++---
  tcg/tcg.c|  8 ++---
  tcg/tci.c|  3 +-
  tcg/aarch64/tcg-target.c.inc | 18 ++
  tcg/arm/tcg-target.c.inc | 26 +++---
  tcg/i386/tcg-target.c.inc|  4 +++
  tcg/loongarch64/tcg-target.c.inc | 24 -
  tcg/mips/tcg-target.c.inc| 37 ++-
  tcg/ppc/tcg-target.c.inc | 21 ++-
  tcg/riscv/tcg-target.c.inc   | 21 ++-
  tcg/s390x/tcg-target.c.inc   |  4 +++
  tcg/sparc64/tcg-target.c.inc | 61 +---
  tcg/tci/tcg-target-opc.h.inc |  1 +
  tcg/tci/tcg-target.c.inc | 17 +++--
  23 files changed, 157 insertions(+), 126 deletions(-)

diff --git a/tcg/aarch64/tcg-target-has.h b/tcg/aarch64/tcg-target-has.h
index bde6db8f2a..e961668ef0 100644
--- a/tcg/aarch64/tcg-target-has.h
+++ b/tcg/aarch64/tcg-target-has.h
@@ -13,7 +13,6 @@
  #define have_lse2   (cpuinfo & CPUINFO_LSE2)
  
  /* optional instructions */

-#define TCG_TARGET_HAS_div_i32  1
  #define TCG_TARGET_HAS_rem_i32  1
  #define TCG_TARGET_HAS_bswap16_i32  1
  #define TCG_TARGET_HAS_bswap32_i32  1
@@ -30,7 +29,6 @@
  #define TCG_TARGET_HAS_extr_i64_i32 0
  #define TCG_TARGET_HAS_qemu_st8_i32 0
  
-#define TCG_TARGET_HAS_div_i64  1

  #define TCG_TARGET_HAS_rem_i64  1
  #define TCG_TARGET_HAS_bswap16_i64  1
  #define TCG_TARGET_HAS_bswap32_i64  1
diff --git a/tcg/arm/tcg-target-has.h b/tcg/arm/tcg-target-has.h
index ab9b7b6162..6ed2b49c84 100644
--- a/tcg/arm/tcg-target-has.h
+++ b/tcg/arm/tcg-target-has.h
@@ -34,7 +34,6 @@ extern bool use_neon_instructions;
  #define TCG_TARGET_HAS_negsetcond_i32   1
  #define TCG_TARGET_HAS_mulu2_i321
  #define TCG_TARGET_HAS_muls2_i321
-#define TCG_TARGET_HAS_div_i32  use_idiv_instructions
  #define TCG_TARGET_HAS_rem_i32  0
  #define TCG_TARGET_HAS_qemu_st8_i32 0
  
diff --git a/tcg/loongarch64/tcg-target-has.h b/tcg/loongarch64/tcg-target-has.h

index e29c892756..96a99b6d4c 100644
--- a/tcg/loongarch64/tcg-target-has.h
+++ b/tcg/loongarch64/tcg-target-has.h
@@ -11,7 +11,6 @@
  
  /* optional instructions */

  #define TCG_TARGET_HAS_negsetcond_i32   0
-#define TCG_TARGET_HAS_div_i32  1
  #define TCG_TARGET_HAS_rem_i32  1
  #define TCG_TARGET_HAS_div2_i32 0
  #define TCG_TARGET_HAS_rot_i32  1
@@ -29,7 +28,6 @@
  
  /* 64-bit operations */

  #define TCG_TARGET_HAS_negsetcond_i64   0
-#define TCG_TARGET_HAS_div_i64  1
  #define TCG_TARGET_HAS_rem_i64  1
  #define TCG_TARGET_HAS_div2_i64 0
  #define TCG_TARGET_HAS_rot_i64  1
diff --git a/tcg/mips/tcg-target-has.h b/tcg/mips/tcg-target-has.h
index ebaaa49cdd..9aa5bf9f1b 100644
--- a/tcg/mips/tcg-target-has.h
+++ b/tcg/mips/tcg-target-has.h
@@ -39,7 +39,6 @@ extern bool use_mips32r2_instructions;
  #endif
  
  /* optional instructions */

-#define TCG_TARGET_HAS_div_i32  1
  #define TCG_TARGET_HAS_rem_i32  1
  #define TCG_TARGET_HAS_mulu2_i32(!use_mips32r6_instructions)
  #define TCG_TARGET_HAS_muls2_i32(!use_mips32r6_instructions)
@@ -51,7 +50,6 @@ extern bool use_mips32r2_instructions;
  #define TCG_TARGET_HAS_add2_i32 0
  #define TCG_TARGET_HAS_sub2_i32 0
  #define TCG_TARGET_HAS_extr_i64_i32 1
-#define TCG_TARGET_HAS_div_i64  1
  #define TCG_TARGET_HAS_rem_i64  1
  #define TCG_TARGET_HAS_add2_i64 0
  #define TCG_TARGET_HAS_sub2_i64 0
diff --git a/tcg/ppc/tcg-target-has.h b/tcg/ppc/tcg-target-has.h
index bbbd8de2c7..f8e4c0ad3c 100644
--- a/tcg/ppc/tcg-target-has.h
+++ b/tcg/ppc/tcg-target-has.h
@@ -17,7 +17,6 @@
  #define have_vsx   (cpuinfo & CPUINFO_VSX)
  
  /* optional instructions */

-#define TCG_TARGET_HAS_div_i32  1
  #define TCG_TARGET_HAS_rem_i32  have_isa_3_00
  #define TCG_TARGET_HAS_rot_i32  1
  #define TCG_TARGET_HAS_bswap16_i32  1
@@ -35,7 +34,6 @@
  #define TCG_TARGET_HAS_add2_i32 0
  #define TCG_TARGET_HAS_sub2_i32 0
  #define TCG_TARGET_HAS_extr_i64_i32 0
-#define TCG_TARGET_HAS_div_i64  1
  #define TCG_TARGET_HAS_rem_i64  have_isa_3_00
  #define TCG_TARGET_HAS_rot_i64  1
  #define TCG_TARGET_HAS_bswap16_i64  1
diff --git 

[PATCH v4 043/163] tcg: Convert divu to TCGOutOpBinary

2025-04-15 Thread Richard Henderson
For TCI, we're losing type information in the interpreter.
Introduce a tci-specific opcode to handle the difference.

Signed-off-by: Richard Henderson 
---
 tcg/aarch64/tcg-target-has.h |  2 --
 tcg/arm/tcg-target-has.h |  1 -
 tcg/loongarch64/tcg-target-has.h |  2 --
 tcg/mips/tcg-target-has.h|  2 --
 tcg/ppc/tcg-target-has.h |  2 --
 tcg/riscv/tcg-target-has.h   |  2 --
 tcg/sparc64/tcg-target-has.h |  2 --
 tcg/tcg-has.h| 15 
 tcg/tci/tcg-target-has.h |  2 --
 tcg/tcg-op.c |  8 ++---
 tcg/tcg.c|  8 ++---
 tcg/tci.c|  3 +-
 tcg/aarch64/tcg-target.c.inc | 18 ++
 tcg/arm/tcg-target.c.inc | 26 +++---
 tcg/i386/tcg-target.c.inc|  4 +++
 tcg/loongarch64/tcg-target.c.inc | 24 -
 tcg/mips/tcg-target.c.inc| 37 ++-
 tcg/ppc/tcg-target.c.inc | 21 ++-
 tcg/riscv/tcg-target.c.inc   | 21 ++-
 tcg/s390x/tcg-target.c.inc   |  4 +++
 tcg/sparc64/tcg-target.c.inc | 61 +---
 tcg/tci/tcg-target-opc.h.inc |  1 +
 tcg/tci/tcg-target.c.inc | 17 +++--
 23 files changed, 157 insertions(+), 126 deletions(-)

diff --git a/tcg/aarch64/tcg-target-has.h b/tcg/aarch64/tcg-target-has.h
index bde6db8f2a..e961668ef0 100644
--- a/tcg/aarch64/tcg-target-has.h
+++ b/tcg/aarch64/tcg-target-has.h
@@ -13,7 +13,6 @@
 #define have_lse2   (cpuinfo & CPUINFO_LSE2)
 
 /* optional instructions */
-#define TCG_TARGET_HAS_div_i32  1
 #define TCG_TARGET_HAS_rem_i32  1
 #define TCG_TARGET_HAS_bswap16_i32  1
 #define TCG_TARGET_HAS_bswap32_i32  1
@@ -30,7 +29,6 @@
 #define TCG_TARGET_HAS_extr_i64_i32 0
 #define TCG_TARGET_HAS_qemu_st8_i32 0
 
-#define TCG_TARGET_HAS_div_i64  1
 #define TCG_TARGET_HAS_rem_i64  1
 #define TCG_TARGET_HAS_bswap16_i64  1
 #define TCG_TARGET_HAS_bswap32_i64  1
diff --git a/tcg/arm/tcg-target-has.h b/tcg/arm/tcg-target-has.h
index ab9b7b6162..6ed2b49c84 100644
--- a/tcg/arm/tcg-target-has.h
+++ b/tcg/arm/tcg-target-has.h
@@ -34,7 +34,6 @@ extern bool use_neon_instructions;
 #define TCG_TARGET_HAS_negsetcond_i32   1
 #define TCG_TARGET_HAS_mulu2_i321
 #define TCG_TARGET_HAS_muls2_i321
-#define TCG_TARGET_HAS_div_i32  use_idiv_instructions
 #define TCG_TARGET_HAS_rem_i32  0
 #define TCG_TARGET_HAS_qemu_st8_i32 0
 
diff --git a/tcg/loongarch64/tcg-target-has.h b/tcg/loongarch64/tcg-target-has.h
index e29c892756..96a99b6d4c 100644
--- a/tcg/loongarch64/tcg-target-has.h
+++ b/tcg/loongarch64/tcg-target-has.h
@@ -11,7 +11,6 @@
 
 /* optional instructions */
 #define TCG_TARGET_HAS_negsetcond_i32   0
-#define TCG_TARGET_HAS_div_i32  1
 #define TCG_TARGET_HAS_rem_i32  1
 #define TCG_TARGET_HAS_div2_i32 0
 #define TCG_TARGET_HAS_rot_i32  1
@@ -29,7 +28,6 @@
 
 /* 64-bit operations */
 #define TCG_TARGET_HAS_negsetcond_i64   0
-#define TCG_TARGET_HAS_div_i64  1
 #define TCG_TARGET_HAS_rem_i64  1
 #define TCG_TARGET_HAS_div2_i64 0
 #define TCG_TARGET_HAS_rot_i64  1
diff --git a/tcg/mips/tcg-target-has.h b/tcg/mips/tcg-target-has.h
index ebaaa49cdd..9aa5bf9f1b 100644
--- a/tcg/mips/tcg-target-has.h
+++ b/tcg/mips/tcg-target-has.h
@@ -39,7 +39,6 @@ extern bool use_mips32r2_instructions;
 #endif
 
 /* optional instructions */
-#define TCG_TARGET_HAS_div_i32  1
 #define TCG_TARGET_HAS_rem_i32  1
 #define TCG_TARGET_HAS_mulu2_i32(!use_mips32r6_instructions)
 #define TCG_TARGET_HAS_muls2_i32(!use_mips32r6_instructions)
@@ -51,7 +50,6 @@ extern bool use_mips32r2_instructions;
 #define TCG_TARGET_HAS_add2_i32 0
 #define TCG_TARGET_HAS_sub2_i32 0
 #define TCG_TARGET_HAS_extr_i64_i32 1
-#define TCG_TARGET_HAS_div_i64  1
 #define TCG_TARGET_HAS_rem_i64  1
 #define TCG_TARGET_HAS_add2_i64 0
 #define TCG_TARGET_HAS_sub2_i64 0
diff --git a/tcg/ppc/tcg-target-has.h b/tcg/ppc/tcg-target-has.h
index bbbd8de2c7..f8e4c0ad3c 100644
--- a/tcg/ppc/tcg-target-has.h
+++ b/tcg/ppc/tcg-target-has.h
@@ -17,7 +17,6 @@
 #define have_vsx   (cpuinfo & CPUINFO_VSX)
 
 /* optional instructions */
-#define TCG_TARGET_HAS_div_i32  1
 #define TCG_TARGET_HAS_rem_i32  have_isa_3_00
 #define TCG_TARGET_HAS_rot_i32  1
 #define TCG_TARGET_HAS_bswap16_i32  1
@@ -35,7 +34,6 @@
 #define TCG_TARGET_HAS_add2_i32 0
 #define TCG_TARGET_HAS_sub2_i32 0
 #define TCG_TARGET_HAS_extr_i64_i32 0
-#define TCG_TARGET_HAS_div_i64  1
 #define TCG_TARGET_HAS_rem_i64  have_isa_3_00
 #define TCG_TARGET_HAS_rot_i64  1
 #define TCG_TARGET_HAS_bswap16_i64  1
diff --git a/tcg/riscv/tcg-target-has.h b/tcg/riscv/tcg-target-has.h
index f7e1ef82fc..ae6624b9a4 100644
--- a/tcg/riscv/tcg-target-has.h
+++