tcg: Merge *_i32 and *_i64 opcodes
v2 cover tcg: Merge *_i32 and *_i64 opcodes
Currently we have individual opcodes for each integer type. This makes things difficult in tcg/optimize.c when we want to transform the opcode stream.
Add TCGOP_TYPE() and use that instead. Merge the opcodes that are common to both TCG_TYPE_I32 and TCG_TYPE_I64. We could eventually merge some of the vector opcodes too, but that is a larger job.
This also moves quite a lot of the tcg backend implementation out of the publicly exposed headers. After this patchset is complete, we will not rebuild target translators for most changes to the tcg backend.
Changes for v2:
- Begin reorganizing the tcg backends. Create structures that encapsulate availability, constraints, and output routines. The intent is to keep everything related to an opcode together, so that code for a specific opcode is not scattered around multiple functions and multiple files.
This conversion is incomplete. I've completed the basic arithmetic opcodes.
This is the place where I'd like feedback on readability.
- Replace TCGOp.type with TCGOP_TYPE.
- Add TCGOP_FLAGS, not used so far in v2, but intended to be used with especially load/store opcodes.
r~
Richard Henderson (81):
tcg: Move call abi parameters from tcg-target.h to tcg-target.c.inc
tcg: Replace TCGOP_VECL with TCGOP_TYPE
tcg: Move tcg_op_insert_{after,before} decls to tcg-internal.h
tcg: Copy TCGOP_TYPE in tcg_op_insert_{after,before}
tcg: Add TCGOP_FLAGS
tcg: Add type and flags arguments to tcg_op_supported target/arm: Do not test TCG_TARGET_HAS_bitsel_vec target/arm: Use tcg_op_supported
target/tricore: Use tcg_op_supported
tcg: Add tcg_op_deposit_valid
target/i386: Remove TCG_TARGET_extract_tl_valid target/i386: Use tcg_op_deposit_valid
target/i386: Use tcg_op_supported
tcg: Remove TCG_TARGET_NEED_LDST_LABELS and
TCG_TARGET_NEED_POOL_LABELS
tcg: Rename tcg-target.opc.h to tcg-target-opc.h.inc tcg/tci: Move TCI specific opcodes to tcg-target-opc.h.inc
tcg: Move fallback tcg_can_emit_vec_op out of line
tcg: Split out tcg-target-has.h and tcg-has.h
tcg: Split out tcg-target-mo.h
tcg: Use C_NotImplemented in tcg_target_op_def
tcg: Change have_vec to has_type in tcg_op_supported
tcg: Reorg process_op_defs
tcg: Remove args_ct from TCGOpDef
tcg: Constify tcg_op_defs
tcg: Validate op supported in opcode_args_ct
tcg: Add TCG_OPF_NOT_PRESENT to opcodes without inputs or outputs
tcg: Pass type and flags to tcg_target_op_def
tcg: Add TCGType argument to tcg_out_op
tcg: Remove TCG_OPF_64BIT
tcg: Drop implementation checks from tcg-opc.h
tcg: Replace IMPLVEC with TCG_OPF_VECTOR
tcg/mips: Expand bswap unconditionally
tcg/i386: Handle all 8-bit extensions for i686
tcg/i386: Fold the ext{8,16,32}[us] cases into {s}extract tcg/aarch64: Provide TCG_TARGET_{s}extract_valid tcg/aarch64: Expand extract with offset 0 with andi tcg/arm: Add full [US]XT[BH] into {s}extract tcg/loongarch64: Fold the ext{8,16,32}[us] cases into {s}extract tcg/mips: Fold the ext{8,16,32}[us] cases into {s}extract tcg/ppc: Fold the ext{8,16,32}[us] cases into {s}extract tcg/riscv64: Fold the ext{8,16,32}[us] cases into {s}extract tcg/riscv: Use SRAIW, SRLIW for {s}extract_i64 tcg/s390x: Fold the ext{8,16,32}[us] cases into {s}extract tcg/sparc64: Use SRA, SRL for {s}extract_i64
tcg/tci: Provide TCG_TARGET_{s}extract_valid
tcg/tci: Remove assertions for deposit and extract
tcg: Remove TCG_TARGET_HAS_{s}extract_{i32,i64}
tcg: Remove TCG_TARGET_HAS_deposit_{i32,i64}
tcg: Remove INDEX_op_ext{8,16,32}*
tcg: Add all_outop[]
tcg: Merge INDEX_op_mov_{i32,i64}
tcg: Convert add to TCGOutOpBinary
tcg: Merge INDEX_op_add_{i32,i64}
tcg: Convert and to TCGOutOpBinary
tcg: Merge INDEX_op_and_{i32,i64}
tcg/optimize: Fold andc with immediate to and tcg/optimize: Emit add r,r,-1 in fold_setcond_tst_pow2
tcg: Convert andc to TCGOutOpBinary
tcg: Merge INDEX_op_andc_{i32,i64}
tcg: Convert or to TCGOutOpBinary
tcg: Merge INDEX_op_or_{i32,i64}
tcg/optimize: Fold orc with immediate to or
tcg: Convert orc to TCGOutOpBinary
tcg: Merge INDEX_op_orc_{i32,i64}
tcg: Convert xor to TCGOutOpBinary
tcg: Merge INDEX_op_xor_{i32,i64}
tcg/optimize: Fold eqv with immediate to xor
tcg: Convert eqv to TCGOutOpBinary
tcg: Merge INDEX_op_eqv_{i32,i64}
tcg: Convert nand to TCGOutOpBinary
tcg: Merge INDEX_op_nand_{i32,i64}
tcg/loongarch64: Do not accept constant argument to nor
tcg: Convert nor to TCGOutOpBinary
tcg: Merge INDEX_op_nor_{i32,i64}
tcg/arm: Fix constraints for sub
tcg: Convert sub to TCGOutOpSubtract
tcg: Merge INDEX_op_sub_{i32,i64}
tcg: Convert neg to TCGOutOpUnary
tcg: Merge INDEX_op_neg_{i32,i64}
tcg: Convert not to TCGOutOpUnary
tcg: Merge INDEX_op_not_{i32,i64}
accel/tcg/internal-target.h | 1 +
include/tcg/tcg-opc.h | 346 +++----
include/tcg/tcg.h | 148 +--
tcg/aarch64/tcg-target-has.h | 95 ++
tcg/aarch64/tcg-target-mo.h | 12 +
tcg/aarch64/tcg-target.h | 126 ---
tcg/arm/tcg-target-con-set.h | 1 +
tcg/arm/tcg-target-has.h | 90 ++
tcg/arm/tcg-target-mo.h | 13 +
tcg/arm/tcg-target.h | 86 --
tcg/i386/tcg-target-con-set.h | 2 +-
tcg/i386/tcg-target-has.h | 147 +++
tcg/i386/tcg-target-mo.h | 19 +
tcg/i386/tcg-target.h | 162 ----
tcg/loongarch64/tcg-target-con-set.h | 1 -
tcg/loongarch64/tcg-target-con-str.h | 1 -
tcg/loongarch64/tcg-target-has.h | 97 ++
tcg/loongarch64/tcg-target-mo.h | 12 +
tcg/loongarch64/tcg-target.h | 115 ---
tcg/mips/tcg-target-con-set.h | 1 -
tcg/mips/tcg-target-has.h | 110 +++
tcg/mips/tcg-target-mo.h | 13 +
tcg/mips/tcg-target.h | 130 ---
tcg/ppc/tcg-target-con-set.h | 3 +-
tcg/ppc/tcg-target-has.h | 107 +++
tcg/ppc/tcg-target-mo.h | 12 +
tcg/ppc/tcg-target.h | 126 ---
tcg/riscv/tcg-target-con-set.h | 3 +-
tcg/riscv/tcg-target-con-str.h | 2 -
tcg/riscv/tcg-target-has.h | 107 +++
tcg/riscv/tcg-target-mo.h | 12 +
tcg/riscv/tcg-target.h | 116 ---
tcg/s390x/tcg-target-con-set.h | 2 -
tcg/s390x/tcg-target-has.h | 115 +++
tcg/s390x/tcg-target-mo.h | 12 +
tcg/s390x/tcg-target.h | 126 ---
tcg/sparc64/tcg-target-con-set.h | 1 +
tcg/sparc64/tcg-target-has.h | 65 ++
tcg/sparc64/tcg-target-mo.h | 12 +
tcg/sparc64/tcg-target.h | 91 --
tcg/tcg-has.h | 89 ++
tcg/tcg-internal.h | 18 +-
tcg/tci/tcg-target-has.h | 59 ++
tcg/tci/tcg-target-mo.h | 17 +
tcg/tci/tcg-target.h | 94 --
target/arm/tcg/translate-a64.c | 10 +-
target/arm/tcg/translate-sve.c | 22 +-
target/arm/tcg/translate.c | 2 +-
target/sh4/translate.c | 20 +-
target/tricore/translate.c | 4 +-
tcg/optimize.c | 316 +++---
tcg/tcg-common.c | 5 +-
tcg/tcg-op-gvec.c | 1 +
tcg/tcg-op-ldst.c | 29 +-
tcg/tcg-op-vec.c | 9 +-
tcg/tcg-op.c | 665 +++++--------
tcg/tcg.c | 904 ++++++++++++------
tcg/tci.c | 138 +--
docs/devel/tcg-ops.rst | 29 +-
target/i386/tcg/emit.c.inc | 14 +-
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 4 +-
tcg/aarch64/tcg-target.c.inc | 340 +++----
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 6 +-
tcg/arm/tcg-target.c.inc | 305 ++++--
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 22 +-
tcg/i386/tcg-target.c.inc | 384 +++++---
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/loongarch64/tcg-target.c.inc | 370 +++----
tcg/mips/tcg-target-opc.h.inc | 1 +
tcg/mips/tcg-target.c.inc | 318 +++---
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 12 +-
tcg/ppc/tcg-target.c.inc | 394 ++++----
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/riscv/tcg-target.c.inc | 380 ++++----
...{tcg-target.opc.h => tcg-target-opc.h.inc} | 6 +-
tcg/s390x/tcg-target.c.inc | 589 ++++++------
tcg/sparc64/tcg-target-opc.h.inc | 1 +
tcg/sparc64/tcg-target.c.inc | 234 +++--
tcg/tcg-ldst.c.inc | 65 --
tcg/tcg-pool.c.inc | 162 ----
tcg/tci/tcg-target-opc.h.inc | 4 +
tcg/tci/tcg-target.c.inc | 341 ++++---
82 files changed, 4631 insertions(+), 4392 deletions(-)
create mode 100644 tcg/aarch64/tcg-target-has.h
create mode 100644 tcg/aarch64/tcg-target-mo.h
create mode 100644 tcg/arm/tcg-target-has.h
create mode 100644 tcg/arm/tcg-target-mo.h
create mode 100644 tcg/i386/tcg-target-has.h
create mode 100644 tcg/i386/tcg-target-mo.h
create mode 100644 tcg/loongarch64/tcg-target-has.h
create mode 100644 tcg/loongarch64/tcg-target-mo.h
create mode 100644 tcg/mips/tcg-target-has.h
create mode 100644 tcg/mips/tcg-target-mo.h
create mode 100644 tcg/ppc/tcg-target-has.h
create mode 100644 tcg/ppc/tcg-target-mo.h
create mode 100644 tcg/riscv/tcg-target-has.h
create mode 100644 tcg/riscv/tcg-target-mo.h
create mode 100644 tcg/s390x/tcg-target-has.h
create mode 100644 tcg/s390x/tcg-target-mo.h
create mode 100644 tcg/sparc64/tcg-target-has.h
create mode 100644 tcg/sparc64/tcg-target-mo.h
create mode 100644 tcg/tcg-has.h
create mode 100644 tcg/tci/tcg-target-has.h
create mode 100644 tcg/tci/tcg-target-mo.h
rename tcg/aarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} (82%)
rename tcg/arm/{tcg-target.opc.h => tcg-target-opc.h.inc} (75%)
rename tcg/i386/{tcg-target.opc.h => tcg-target-opc.h.inc} (72%)
rename tcg/loongarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
create mode 100644 tcg/mips/tcg-target-opc.h.inc
rename tcg/ppc/{tcg-target.opc.h => tcg-target-opc.h.inc} (83%)
rename tcg/riscv/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/s390x/{tcg-target.opc.h => tcg-target-opc.h.inc} (75%)
create mode 100644 tcg/sparc64/tcg-target-opc.h.inc
delete mode 100644 tcg/tcg-ldst.c.inc
delete mode 100644 tcg/tcg-pool.c.inc
create mode 100644 tcg/tci/tcg-target-opc.h.incSignature · 1 line
2.43.0
PATCH v2 1/81 tcg: Move call abi parameters from tcg-target.h to tcg-target.c.inc
These defines are not required outside of tcg/tcg.c, which includes tcg-target.c.inc before use. Reduces the exported symbol set of tcg-target.h.
--- tcg/aarch64/tcg-target.h | 13 ------------- tcg/arm/tcg-target.h | 8 -------- tcg/i386/tcg-target.h | 20 -------------------- tcg/loongarch64/tcg-target.h | 9 --------- tcg/mips/tcg-target.h | 14 -------------- tcg/riscv/tcg-target.h | 9 --------- tcg/s390x/tcg-target.h | 8 -------- tcg/sparc64/tcg-target.h | 11 ----------- tcg/tci/tcg-target.h | 14 -------------- tcg/aarch64/tcg-target.c.inc | 13 +++++++++++++ tcg/arm/tcg-target.c.inc | 8 ++++++++ tcg/i386/tcg-target.c.inc | 20 ++++++++++++++++++++ tcg/loongarch64/tcg-target.c.inc | 9 +++++++++ tcg/mips/tcg-target.c.inc | 14 ++++++++++++++ tcg/riscv/tcg-target.c.inc | 9 +++++++++ tcg/s390x/tcg-target.c.inc | 8 ++++++++ tcg/sparc64/tcg-target.c.inc | 10 ++++++++++ tcg/tci/tcg-target.c.inc | 14 ++++++++++++++ 18 files changed, 105 insertions(+), 106 deletions(-)
tcg/aarch64/tcg-target.h +0 -13
@@ -49,19 +49,6 @@ typedef enum {#define TCG_TARGET_NB_REGS 64 -/* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_SP -#define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#ifdef CONFIG_DARWIN -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -#else -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN -#endif -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -#define have_lse (cpuinfo & CPUINFO_LSE)#define have_lse2 (cpuinfo & CPUINFO_LSE2)
tcg/arm/tcg-target.h +0 -8
@@ -85,14 +85,6 @@ extern bool use_idiv_instructions;extern bool use_neon_instructions;#endif -/* used for function call generation */ -#define TCG_TARGET_STACK_ALIGN 8 -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF -/* optional instructions */ #define TCG_TARGET_HAS_ext8s_i32 1#define TCG_TARGET_HAS_ext16s_i32 1
tcg/i386/tcg-target.h +0 -20
@@ -90,26 +90,6 @@ typedef enum { TCG_REG_CALL_STACK = TCG_REG_ESP } TCGReg; -/* used for function call generation */ -#define TCG_TARGET_STACK_ALIGN 16 -#if defined(_WIN64) -#define TCG_TARGET_CALL_STACK_OFFSET 32 -#else -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#endif -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#if defined(_WIN64) -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_BY_REF -# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_VEC -#elif TCG_TARGET_REG_BITS ==64 -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -#else -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF -#endif -#define have_bmi1 (cpuinfo & CPUINFO_BMI1)#define have_popcnt (cpuinfo & CPUINFO_POPCNT)#define have_avx1 (cpuinfo & CPUINFO_AVX1)
tcg/loongarch64/tcg-target.h +0 -9
@@ -87,15 +87,6 @@ typedef enum {TCG_VEC_TMP0 =TCG_REG_V23 , } TCGReg; -/* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_SP -#define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -/* optional instructions */ #define TCG_TARGET_HAS_negsetcond_i32 0#define TCG_TARGET_HAS_div_i32 1
tcg/mips/tcg-target.h +0 -14
@@ -70,20 +70,6 @@ typedef enum {TCG_AREG0 =TCG_REG_S8 , } TCGReg; -/* used for function call generation */ -#define TCG_TARGET_STACK_ALIGN 16 -#if _MIPS_SIM == _ABIO32 -# define TCG_TARGET_CALL_STACK_OFFSET 16 -# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN -# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF -#else -# define TCG_TARGET_CALL_STACK_OFFSET 0 -# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -#endif -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN -/* MOVN/MOVZ instructions detection */ #if (defined(__mips_isa_rev) && (__mips_isa_rev >= 1)) || \ defined(_MIPS_ARCH_LOONGSON2E) || defined(_MIPS_ARCH_LOONGSON2F) || \
tcg/riscv/tcg-target.h +0 -9
@@ -59,15 +59,6 @@ typedef enum {TCG_REG_TMP2 =TCG_REG_T4 , } TCGReg; -/* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_SP -#define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -/* optional instructions */ #define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_div_i32 1
tcg/s390x/tcg-target.h +0 -8
@@ -165,14 +165,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_cmpsel_vec 1#define TCG_TARGET_HAS_tst_vec 0 -/* used for function call generation */ -#define TCG_TARGET_STACK_ALIGN 8 -#define TCG_TARGET_CALL_STACK_OFFSET 160 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_BY_REF -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF -#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)#define TCG_TARGET_NEED_LDST_LABELS #define TCG_TARGET_NEED_POOL_LABELS
tcg/sparc64/tcg-target.h +0 -11
@@ -64,17 +64,6 @@ typedef enum {TCG_REG_I7 , } TCGReg; -/* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_O6 - -#define TCG_TARGET_STACK_BIAS 2047 -#define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_STACK_OFFSET (128 + 6*8 + TCG_TARGET_STACK_BIAS) -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND -#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -#if defined(__VIS__) && __VIS__ >=0x300 #define use_vis3_instructions 1#else
tcg/tci/tcg-target.h +0 -14
@@ -146,20 +146,6 @@ typedef enum {TCG_REG_CALL_STACK =TCG_REG_R15 , } TCGReg; -/* Used for function call generation. */ -#define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_STACK_ALIGN 8 -#if TCG_TARGET_REG_BITS ==32 -# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EVEN -# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN -#else -# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL -# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL -# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL -#endif -#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -#define HAVE_TCG_QEMU_TB_EXEC #define TCG_TARGET_NEED_POOL_LABELS
tcg/aarch64/tcg-target.c.inc +13 -0
@@ -14,6 +14,19 @@ #include "../tcg-pool.c.inc" #include "qemu/bitops.h" +/* Used for function call generation. */ +#define TCG_REG_CALL_STACK TCG_REG_SP +#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#ifdef CONFIG_DARWIN +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +#else +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN +#endif +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL + /* We're going to re-use TCGType in setting of the SF bit, which controls the size of the operation performed. If we know the values match, it makes things much cleaner. */
tcg/arm/tcg-target.c.inc +8 -0
@@ -35,6 +35,14 @@ bool use_idiv_instructions; bool use_neon_instructions; #endif +/* Used for function call generation. */ +#define TCG_TARGET_STACK_ALIGN 8 +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF + #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
tcg/i386/tcg-target.c.inc +20 -0
@@ -25,6 +25,26 @@ #include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" +/* Used for function call generation. */ +#define TCG_TARGET_STACK_ALIGN 16 +#if defined(_WIN64) +#define TCG_TARGET_CALL_STACK_OFFSET 32 +#else +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#endif +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#if defined(_WIN64) +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_BY_REF +# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_VEC +#elif TCG_TARGET_REG_BITS == 64 +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL +#else +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF +#endif + #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { #if TCG_TARGET_REG_BITS == 64
tcg/loongarch64/tcg-target.c.inc +9 -0
@@ -32,6 +32,15 @@ #include "../tcg-ldst.c.inc" #include <asm/hwcap.h> +/* used for function call generation */ +#define TCG_REG_CALL_STACK TCG_REG_SP +#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL + #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "zero",
tcg/mips/tcg-target.c.inc +14 -0
@@ -27,6 +27,20 @@ #include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" +/* used for function call generation */ +#define TCG_TARGET_STACK_ALIGN 16 +#if _MIPS_SIM == _ABIO32 +# define TCG_TARGET_CALL_STACK_OFFSET 16 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF +#else +# define TCG_TARGET_CALL_STACK_OFFSET 0 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +# define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL +#endif +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN + #if TCG_TARGET_REG_BITS == 32 # define LO_OFF (HOST_BIG_ENDIAN * 4) # define HI_OFF (4 - LO_OFF)
tcg/riscv/tcg-target.c.inc +9 -0
@@ -30,6 +30,15 @@ #include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" +/* Used for function call generation. */ +#define TCG_REG_CALL_STACK TCG_REG_SP +#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL + #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2",
tcg/s390x/tcg-target.c.inc +8 -0
@@ -28,6 +28,14 @@ #include "../tcg-pool.c.inc" #include "elf.h" +/* Used for function call generation. */ +#define TCG_TARGET_STACK_ALIGN 8 +#define TCG_TARGET_CALL_STACK_OFFSET 160 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_BY_REF +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_BY_REF + #define TCG_CT_CONST_S16 (1 << 8) #define TCG_CT_CONST_S32 (1 << 9) #define TCG_CT_CONST_U32 (1 << 10)
tcg/sparc64/tcg-target.c.inc +10 -0
@@ -30,6 +30,16 @@ #include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" +/* Used for function call generation. */ +#define TCG_REG_CALL_STACK TCG_REG_O6 +#define TCG_TARGET_STACK_BIAS 2047 +#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_CALL_STACK_OFFSET (128 + 6 * 8 + TCG_TARGET_STACK_BIAS) +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL + #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "%g0",
tcg/tci/tcg-target.c.inc +14 -0
@@ -24,6 +24,20 @@ #include "../tcg-pool.c.inc" +/* Used for function call generation. */ +#define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_STACK_ALIGN 8 +#if TCG_TARGET_REG_BITS == 32 +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EVEN +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN +#else +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +# define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_NORMAL +#endif +#define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL + static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) { switch (op) {
Signature · 1 line
2.43.0
Re: [PATCH v2 01/81] tcg: Move call abi parameters from tcg-target.h to tcg-target.c.inc
Quoted 6 lines · Richard Henderson
These defines are not required outside of
tcg/tcg.c, which includes tcg-target.c.inc before use. Reduces the exported symbol set oftcg-target.h.Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 2/81 tcg: Replace TCGOP_VECL with TCGOP_TYPE
In reply to Richard HendersonIn the replacement, drop the TCGType - TCG_TYPE_V64 adjustment, except for the call to tcg_out_vec_op. Pass type to tcg_gen_op[1-6], so that all integer opcodes gain the type.
--- include/tcg/tcg.h | 2 +- tcg/tcg-internal.h | 13 ++--- tcg/optimize.c | 10 +--- tcg/tcg-op-ldst.c | 26 ++++++---- tcg/tcg-op-vec.c | 8 +-- tcg/tcg-op.c | 113 +++++++++++++++++++++++------------------ tcg/tcg.c | 11 ++-- docs/devel/tcg-ops.rst | 15 +++--- 8 files changed, 105 insertions(+), 93 deletions(-)
include/tcg/tcg.h +1 -1
@@ -439,7 +439,7 @@ struct TCGOp {#define TCGOP_CALLI (X ) (X)->param1#define TCGOP_CALLO (X ) (X)->param2 -#define TCGOP_VECL (X ) (X)->param1 +#define TCGOP_TYPE (X ) (X)->param1#define TCGOP_VECE (X ) (X)->param2/* Make sure operands fit in the bitfields above. */
tcg/tcg-internal.h +7 -6
@@ -92,12 +92,13 @@ TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind);*/ TCGTemp *tcg_constant_internal (TCGType type,int64_t val); -TCGOp *tcg_gen_op1 (TCGOpcode ,TCGArg ); -TCGOp *tcg_gen_op2 (TCGOpcode ,TCGArg ,TCGArg ); -TCGOp *tcg_gen_op3 (TCGOpcode ,TCGArg ,TCGArg ,TCGArg ); -TCGOp *tcg_gen_op4 (TCGOpcode ,TCGArg ,TCGArg ,TCGArg ,TCGArg ); -TCGOp *tcg_gen_op5 (TCGOpcode ,TCGArg ,TCGArg ,TCGArg ,TCGArg ,TCGArg ); -TCGOp *tcg_gen_op6 (TCGOpcode ,TCGArg ,TCGArg ,TCGArg ,TCGArg ,TCGArg ,TCGArg ); +TCGOp *tcg_gen_op1 (TCGOpcode ,TCGType ,TCGArg ); +TCGOp *tcg_gen_op2 (TCGOpcode ,TCGType ,TCGArg ,TCGArg ); +TCGOp *tcg_gen_op3 (TCGOpcode ,TCGType ,TCGArg ,TCGArg ,TCGArg ); +TCGOp *tcg_gen_op4 (TCGOpcode ,TCGType ,TCGArg ,TCGArg ,TCGArg ,TCGArg ); +TCGOp *tcg_gen_op5 (TCGOpcode ,TCGType ,TCGArg ,TCGArg ,TCGArg ,TCGArg ,TCGArg ); +TCGOp *tcg_gen_op6 (TCGOpcode ,TCGType ,TCGArg ,TCGArg , +TCGArg ,TCGArg ,TCGArg ,TCGArg );void vec_gen_2 (TCGOpcode ,TCGType ,unsigned ,TCGArg ,TCGArg );void vec_gen_3 (TCGOpcode ,TCGType ,unsigned ,TCGArg ,TCGArg ,TCGArg );
tcg/optimize.c +2 -8
@@ -370,7 +370,7 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src)case TCG_TYPE_V64 :case TCG_TYPE_V128 :case TCG_TYPE_V256 : -/* TCGOP_VECL and TCGOP_VECE remain unchanged. */ +/* TCGOP_TYPE and TCGOP_VECE remain unchanged. */ new_op = INDEX_op_mov_vec;break ;default :
@@ -2866,13 +2866,7 @@ void tcg_optimize(TCGContext *s)copy_propagate (&ctx, op, def->nb_oargs, def->nb_iargs);/* Pre-compute the type of the operation. */ -if (def->flags &TCG_OPF_VECTOR ) { - ctx.type =TCG_TYPE_V64 +TCGOP_VECL (op); - }else if (def->flags &TCG_OPF_64BIT ) { - ctx.type =TCG_TYPE_I64 ; - }else { - ctx.type =TCG_TYPE_I32 ; - } + ctx.type =TCGOP_TYPE (op);/* * Process each opcode.
tcg/tcg-op-ldst.c +15 -11
@@ -87,14 +87,15 @@ static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st)return op; } -static void gen_ldst (TCGOpcode opc,TCGTemp *vl,TCGTemp *vh, +static void gen_ldst (TCGOpcode opc,TCGType type,TCGTemp *vl,TCGTemp *vh,TCGTemp *addr,MemOpIdx oi) {if (TCG_TARGET_REG_BITS ==64 || tcg_ctx->addr_type ==TCG_TYPE_I32 ) {if (vh) { -tcg_gen_op4 (opc,temp_arg (vl),temp_arg (vh),temp_arg (addr), oi); +tcg_gen_op4 (opc, type,temp_arg (vl),temp_arg (vh), +temp_arg (addr), oi); }else { -tcg_gen_op3 (opc,temp_arg (vl),temp_arg (addr), oi); +tcg_gen_op3 (opc, type,temp_arg (vl),temp_arg (addr), oi); } }else {/* See TCGV_LOW/HIGH. */
@@ -102,10 +103,11 @@ static void gen_ldst(TCGOpcode opc, TCGTemp *vl, TCGTemp *vh,TCGTemp *ah = addr + !HOST_BIG_ENDIAN ;if (vh) { -tcg_gen_op5 (opc,temp_arg (vl),temp_arg (vh), +tcg_gen_op5 (opc, type,temp_arg (vl),temp_arg (vh),temp_arg (al),temp_arg (ah), oi); }else { -tcg_gen_op4 (opc,temp_arg (vl),temp_arg (al),temp_arg (ah), oi); +tcg_gen_op4 (opc, type,temp_arg (vl), +temp_arg (al),temp_arg (ah), oi); } } }
@@ -115,9 +117,9 @@ static void gen_ldst_i64(TCGOpcode opc, TCGv_i64 v, TCGTemp *addr, MemOpIdx oi)if (TCG_TARGET_REG_BITS ==32 ) {TCGTemp *vl =tcgv_i32_temp (TCGV_LOW (v));TCGTemp *vh =tcgv_i32_temp (TCGV_HIGH (v)); -gen_ldst (opc, vl, vh, addr, oi); +gen_ldst (opc,TCG_TYPE_I64 , vl, vh, addr, oi); }else { -gen_ldst (opc,tcgv_i64_temp (v),NULL , addr, oi); +gen_ldst (opc,TCG_TYPE_I64 ,tcgv_i64_temp (v),NULL , addr, oi); } }
@@ -250,7 +252,7 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr, }else { opc = INDEX_op_qemu_ld_a64_i32; } -gen_ldst (opc,tcgv_i32_temp (val),NULL , addr, oi); +gen_ldst (opc,TCG_TYPE_I32 ,tcgv_i32_temp (val),NULL , addr, oi);plugin_gen_mem_callbacks_i32 (val, copy_addr, addr, orig_oi,QEMU_PLUGIN_MEM_R );
@@ -319,7 +321,7 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr, opc = INDEX_op_qemu_st_a64_i32; } } -gen_ldst (opc,tcgv_i32_temp (val),NULL , addr, oi); +gen_ldst (opc,TCG_TYPE_I32 ,tcgv_i32_temp (val),NULL , addr, oi);plugin_gen_mem_callbacks_i32 (val,NULL , addr, orig_oi,QEMU_PLUGIN_MEM_W );if (swap) {
@@ -590,7 +592,8 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr, }else { opc = INDEX_op_qemu_ld_a64_i128; } -gen_ldst (opc,tcgv_i64_temp (lo),tcgv_i64_temp (hi), addr, oi); +gen_ldst (opc,TCG_TYPE_I128 ,tcgv_i64_temp (lo), +tcgv_i64_temp (hi), addr, oi);if (need_bswap) {tcg_gen_bswap64_i64 (lo, lo);
@@ -710,7 +713,8 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr, }else { opc = INDEX_op_qemu_st_a64_i128; } -gen_ldst (opc,tcgv_i64_temp (lo),tcgv_i64_temp (hi), addr, oi); +gen_ldst (opc,TCG_TYPE_I128 ,tcgv_i64_temp (lo), +tcgv_i64_temp (hi), addr, oi);if (need_bswap) {tcg_temp_free_i64 (lo);
tcg/tcg-op-vec.c +4 -4
@@ -143,7 +143,7 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list,void vec_gen_2 (TCGOpcode opc,TCGType type,unsigned vece,TCGArg r,TCGArg a) {TCGOp *op =tcg_emit_op (opc,2 ); -TCGOP_VECL (op) = type -TCG_TYPE_V64 ; +TCGOP_TYPE (op) = type;TCGOP_VECE (op) = vece; op->args[0 ] = r; op->args[1 ] = a;
@@ -153,7 +153,7 @@ void vec_gen_3(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b) { TCGOp *op = tcg_emit_op(opc, 3); -TCGOP_VECL (op) = type -TCG_TYPE_V64 ; +TCGOP_TYPE (op) = type;TCGOP_VECE (op) = vece; op->args[0 ] = r; op->args[1 ] = a;
@@ -164,7 +164,7 @@ void vec_gen_4(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b, TCGArg c) { TCGOp *op = tcg_emit_op(opc, 4); -TCGOP_VECL (op) = type -TCG_TYPE_V64 ; +TCGOP_TYPE (op) = type;TCGOP_VECE (op) = vece; op->args[0 ] = r; op->args[1 ] = a;
@@ -176,7 +176,7 @@ void vec_gen_6(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b, TCGArg c, TCGArg d, TCGArg e) { TCGOp *op = tcg_emit_op(opc, 6); -TCGOP_VECL (op) = type -TCG_TYPE_V64 ; +TCGOP_TYPE (op) = type;TCGOP_VECE (op) = vece; op->args[0 ] = r; op->args[1 ] = a;
tcg/tcg-op.c +63 -50
378 lines not on this page · raw message
tcg/tcg.c +6 -5
@@ -2616,7 +2616,8 @@ void tcg_dump_ops(TCGContext *s, FILE *f, bool have_prefs) nb_cargs = def->nb_cargs;if (def->flags &TCG_OPF_VECTOR ) { - col +=ne_fprintf (f,"v%d,e%d," ,64 <<TCGOP_VECL (op), + col +=ne_fprintf (f,"v%d,e%d," , +8 *tcg_type_size (TCGOP_TYPE (op)),8 <<TCGOP_VECE (op)); }
@@ -4709,7 +4710,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) itype = its->type; vece =TCGOP_VECE (op); - vtype =TCGOP_VECL (op) +TCG_TYPE_V64 ; + vtype =TCGOP_TYPE (op);if (its->val_type ==TEMP_VAL_CONST ) {/* Propagate constant via movi -> dupi. */
@@ -5176,8 +5177,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)break ;default :if (def->flags &TCG_OPF_VECTOR ) { -tcg_out_vec_op (s, op->opc,TCGOP_VECL (op),TCGOP_VECE (op), - new_args, const_args); +tcg_out_vec_op (s, op->opc,TCGOP_TYPE (op) -TCG_TYPE_V64 , +TCGOP_VECE (op), new_args, const_args); }else {tcg_out_op (s, op->opc, new_args, const_args); }
@@ -5203,7 +5204,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op) {const TCGLifeData arg_life = op->life;TCGTemp *ots, *itsl, *itsh; -TCGType vtype =TCGOP_VECL (op) +TCG_TYPE_V64 ; +TCGType vtype =TCGOP_TYPE (op);/* This opcode is only valid for 32-bit hosts, for 64-bit elements. */ tcg_debug_assert (TCG_TARGET_REG_BITS ==32 );
docs/devel/tcg-ops.rst +7 -8
@@ -712,10 +712,9 @@ QEMU specific operations Host vector operations ---------------------- -All of the vector ops have two parameters, ``TCGOP_VECL`` & ``TCGOP_VECE``. -The former specifies the length of the vector in log2 64-bit units; the -latter specifies the length of the element (if applicable) in log2 8-bit units. -E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. +All of the vector ops have two parameters, ``TCGOP_TYPE`` & ``TCGOP_VECE``. +The former specifies the length of the vector as a TCGType; the latter +specifies the length of the element (if applicable) in log2 8-bit units. .. list-table::
@@ -729,7 +728,7 @@ E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. * - dup_vec *v0*, *r1* - - | Duplicate the low N bits of *r1* into VECL/VECE copies across *v0*. + - | Duplicate the low N bits of *r1* into TYPE/VECE copies across *v0*. * - dupi_vec *v0*, *c*
@@ -738,7 +737,7 @@ E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. * - dup2_vec *v0*, *r1*, *r2* - - | Duplicate *r2*:*r1* into VECL/64 copies across *v0*. This opcode is + - | Duplicate *r2*:*r1* into TYPE/64 copies across *v0*. This opcode is only present for 32-bit hosts. * - add_vec *v0*, *v1*, *v2*
@@ -810,7 +809,7 @@ E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. .. code-block:: c - for (i = 0; i < VECL/VECE; ++i) { + for (i = 0; i < TYPE/VECE; ++i) { v0[i] = v1[i] << s2; }
@@ -832,7 +831,7 @@ E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. .. code-block:: c - for (i = 0; i < VECL/VECE; ++i) { + for (i = 0; i < TYPE/VECE; ++i) { v0[i] = v1[i] << v2[i]; }
Signature · 1 line
2.43.0
Re: [PATCH v2 02/81] tcg: Replace TCGOP_VECL with TCGOP_TYPE
Quoted 18 lines · Richard Henderson
In the replacement, drop the TCGType -
TCG_TYPE_V64adjustment, except for the call totcg_out_vec_op. Pass type to tcg_gen_op[1-6], so that all integer opcodes gain the type.Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 2 +- tcg/tcg-internal.h | 13 ++--- tcg/optimize.c | 10 +--- tcg/tcg-op-ldst.c | 26 ++++++---- tcg/tcg-op-vec.c | 8 +-- tcg/tcg-op.c | 113 +++++++++++++++++++++++------------------ tcg/tcg.c | 11 ++-- docs/devel/tcg-ops.rst | 15 +++--- 8 files changed, 105 insertions(+), 93 deletions(-)
tcg/tcg-op.c void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) · line 3336
Quoted 5 lines
tcg/tcg-op.c +1
-1@@ -3320,7 +3333,7 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx)tcg_debug_assert (idx ==TB_EXIT_REQUESTED ); } -tcg_gen_op1i (INDEX_op_exit_tb, val); +tcg_gen_op1i (INDEX_op_exit_tb,0 , val);
Having TCG_TYPE_I32 = 0 is confusing.
Should we define TCG_TYPE_VOID = 0 first, shifting all other types (and updating tcg_type_size())?
Otherwise,
Quoted 10 lines
tcg/tcg-op.c +1
-1}void tcg_gen_goto_tb (unsigned idx)@@ -3335,7 +3348,7 @@ void tcg_gen_goto_tb(unsigned idx) tcg_ctx->goto_tb_issue_mask |=1 << idx;#endif plugin_gen_disable_mem_helpers (); -tcg_gen_op1i (INDEX_op_goto_tb, idx); +tcg_gen_op1i (INDEX_op_goto_tb,0 , idx); }
Re: [PATCH v2 02/81] tcg: Replace TCGOP_VECL with TCGOP_TYPE
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Richard Henderson
In the replacement, drop the TCGType -
TCG_TYPE_V64adjustment, except for the call to tcg_out_vec_op. Pass type to tcg_gen_op[1-6], so that all integer opcodes gain the type.Signed-off-by Richard Henderson <[email protected]>---
include/tcg/tcg.h | 2 +-
tcg/tcg-internal.h | 13 ++---
tcg/optimize.c | 10 +---
tcg/tcg-op-ldst.c | 26 ++++++----
tcg/tcg-op-vec.c | 8 +--
tcg/tcg-op.c | 113 +++++++++++++++++++++++------------------ tcg/tcg.c | 11 ++--
docs/devel/tcg-ops.rst| 15 +++---8 files changed, 105 insertions(+), 93 deletions(-)tcg/tcg-op.c void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) · line 3335
Quoted 4 lines
tcg/tcg-op.c +1
-1@@ -3320,7 +3333,7 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) tcg_debug_assert(idx == TB_EXIT_REQUESTED); } - tcg_gen_op1i(INDEX_op_exit_tb, val); + tcg_gen_op1i(INDEX_op_exit_tb, 0, val);Having
TCG_TYPE_I32= 0 is confusing.
Quoted 2 lines
Should we define
TCG_TYPE_VOID= 0 first, shifting all other types (and updatingtcg_type_size())?
No. E.g. tcg/aarch64/tcg-target.c.inc:
/* We're going to re-use TCGType in setting of the SF bit, which controls
the size of the operation performed. If we know the values match, it makes things much cleaner. */QEMU_BUILD_BUG_ON(TCG_TYPE_I32 != 0 || TCG_TYPE_I64 != 1);
Obviously this value is never used for INDEX_op_exit_tb (and others). If you really think it's important, we could add VOID as another value. But I think that might be more confusing than anything else. So far we're restricted to integer and vector types. If we add a third classification, we're going to want to adjust all of the checks everywhere.
r~
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v2 02/81] tcg: Replace TCGOP_VECL with TCGOP_TYPE
Quoted 31 lines · Richard Henderson
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Richard Henderson
In the replacement, drop the TCGType -
TCG_TYPE_V64adjustment, except for the call to tcg_out_vec_op. Pass type to tcg_gen_op[1-6], so that all integer opcodes gain the type.Signed-off-by Richard Henderson <[email protected]>---
include/tcg/tcg.h | 2 +-
tcg/tcg-internal.h | 13 ++---
tcg/optimize.c | 10 +---
tcg/tcg-op-ldst.c | 26 ++++++----
tcg/tcg-op-vec.c | 8 +--
tcg/tcg-op.c | 113 +++++++++++++++++++++++------------------ tcg/tcg.c | 11 ++--
docs/devel/tcg-ops.rst| 15 +++---8 files changed, 105 insertions(+), 93 deletions(-)tcg/tcg-op.c void tcg_gen_exit_tb(const TranslationBlock · line 3336
Quoted 5 lines
tcg/tcg-op.c +1
-1@@ -3320,7 +3333,7 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) tcg_debug_assert(idx == TB_EXIT_REQUESTED); } - tcg_gen_op1i(INDEX_op_exit_tb, val); + tcg_gen_op1i(INDEX_op_exit_tb, 0, val);Having
TCG_TYPE_I32= 0 is confusing.Quoted 2 lines
Should we define
TCG_TYPE_VOID= 0 first, shifting all other types (and updatingtcg_type_size())?
Quoted 8 lines
No. E.g. tcg/aarch64/tcg-target.c.inc:
/* We're going to re-use TCGType in setting of the SF bit, which controls
the size of the operation performed. If we know the values match, it makes things much cleaner. */QEMU_BUILD_BUG_ON(TCG_TYPE_I32 != 0 || TCG_TYPE_I64 != 1);Obviously this value is never used for
INDEX_op_exit_tb(and others). If you really think it's important, we could add VOID as another value. But I think that might be more confusing than anything else. So far we're restricted to integer and vector types. If we add a third classification, we're going to want to adjust all of the checks everywhere.
No need for VOID, I'm good ;)
PATCH v2 3/81 tcg: Move tcg_op_insert_{after, before} decls to tcg-internal.h
In reply to Richard HendersonThese are not particularly useful outside of optimization passes.
--- include/tcg/tcg.h | 4 ---- tcg/tcg-internal.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-)
include/tcg/tcg.h +0 -4
@@ -854,10 +854,6 @@ void tcg_gen_call7(void *func, TCGHelperInfo *, TCGTemp *ret,TCGOp *tcg_emit_op (TCGOpcode opc,unsigned nargs);void tcg_op_remove (TCGContext *s,TCGOp *op); -TCGOp *tcg_op_insert_before (TCGContext *s,TCGOp *op, -TCGOpcode opc,unsigned nargs); -TCGOp *tcg_op_insert_after (TCGContext *s,TCGOp *op, -TCGOpcode opc,unsigned nargs);/** * tcg_remove_ops_after:
tcg/tcg-internal.h +5 -0
@@ -106,4 +106,9 @@ void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg);void vec_gen_6 (TCGOpcode opc,TCGType type,unsigned vece,TCGArg r,TCGArg a,TCGArg b,TCGArg c,TCGArg d,TCGArg e); +TCGOp *tcg_op_insert_before (TCGContext *s,TCGOp *op, +TCGOpcode opc,unsigned nargs); +TCGOp *tcg_op_insert_after (TCGContext *s,TCGOp *op, +TCGOpcode opc,unsigned nargs); +#endif /* TCG_INTERNAL_H */
Signature · 1 line
2.43.0
Re: [PATCH v2 03/81] tcg: Move tcg_op_insert_{after, before} decls to tcg-internal.h
Quoted 7 lines · Richard Henderson
These are not particularly useful outside of optimization passes.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 4 ---- tcg/tcg-internal.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-)
Re: [PATCH v2 03/81] tcg: Move tcg_op_insert_{after, before} decls to tcg-internal.h
In reply to Richard HendersonQuoted 3 lines · Richard Henderson
These are not particularly useful outside of optimization passes.
Signed-off-by Richard Henderson <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 4/81 tcg: Copy TCGOP_TYPE in tcg_op_insert_{after, before}
In reply to Richard HendersonSimplify use within the optimizers by defaulting the new opcode to the same type as the old opcode.
--- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+)
tcg/tcg.c +4 -0
@@ -3249,6 +3249,8 @@ TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op, TCGOpcode opc, unsigned nargs) {TCGOp *new_op =tcg_op_alloc (opc, nargs); + +TCGOP_TYPE (new_op) =TCGOP_TYPE (old_op);QTAILQ_INSERT_BEFORE (old_op, new_op, link);return new_op; }
@@ -3257,6 +3259,8 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op, TCGOpcode opc, unsigned nargs) {TCGOp *new_op =tcg_op_alloc (opc, nargs); + +TCGOP_TYPE (new_op) =TCGOP_TYPE (old_op);QTAILQ_INSERT_AFTER (&s->ops, old_op, new_op, link);return new_op; }
Signature · 1 line
2.43.0
Re: [PATCH v2 04/81] tcg: Copy TCGOP_TYPE in tcg_op_insert_{after,before}
Quoted 7 lines · Richard Henderson
Simplify use within the optimizers by defaulting the new opcode to the same type as the old opcode.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+)
PATCH v2 5/81 tcg: Add TCGOP_FLAGS
In reply to Richard HendersonTo be used by some integer operations instead of, or in addition to, a trailing constant argument.
--- include/tcg/tcg.h | 1 + 1 file changed, 1 insertion(+)
include/tcg/tcg.h +1 -0
@@ -440,6 +440,7 @@ struct TCGOp {#define TCGOP_CALLO (X ) (X)->param2#define TCGOP_TYPE (X ) (X)->param1 +#define TCGOP_FLAGS (X ) (X)->param1#define TCGOP_VECE (X ) (X)->param2/* Make sure operands fit in the bitfields above. */
Signature · 1 line
2.43.0
Re: [PATCH v2 05/81] tcg: Add TCGOP_FLAGS
Quoted 13 lines · Richard Henderson
To be used by some integer operations instead of, or in addition to, a trailing constant argument.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 1 + 1 file changed, 1 insertion(+)include/tcg/tcg.h +0
-0
include/tcg/tcg.h struct TCGOp { · line 443
Quoted 4 lines
include/tcg/tcg.h +1
-0@@ -440,6 +440,7 @@ struct TCGOp {#define TCGOP_CALLO (X ) (X)->param2#define TCGOP_TYPE (X ) (X)->param1 +#define TCGOP_FLAGS (X ) (X)->param1
I skipped this because there was some code smell around I couldn't figure. Hopefully a typo :)
Quoted 3 lines
include/tcg/tcg.h +0
-0#define TCGOP_VECE (X ) (X)->param2/* Make sure operands fit in the bitfields above. */
Re: [PATCH v2 05/81] tcg: Add TCGOP_FLAGS
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Richard Henderson
To be used by some integer operations instead of, or in addition to, a trailing constant argument.
Signed-off-by Richard Henderson <[email protected]>---
include/tcg/tcg.h| 1 +1 file changed, 1 insertion(+)
Quoted 11 lines
include/tcg/tcg.h struct TCGOp { · line 442
Quoted 8 lines
include/tcg/tcg.h +1
-0@@ -440,6 +440,7 @@ struct TCGOp { #define TCGOP_CALLO(X) (X)->param2 #define TCGOP_TYPE(X) (X)->param1 +#define TCGOP_FLAGS (X ) (X)->param1I skipped this because there was some code smell around I couldn't figure. Hopefully a typo :)
Yes, a typo. Thankfully this field isn't within these converted opcodes.
r~
PATCH v2 6/81 tcg: Add type and flags arguments to tcg_op_supported
In reply to Richard Henderson--- include/tcg/tcg.h | 7 ++++++- tcg/tcg.c | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
include/tcg/tcg.h +6 -1
@@ -834,7 +834,12 @@ typedef struct TCGTargetOpDef {const char *args_ct_str[TCG_MAX_OP_ARGS ]; } TCGTargetOpDef; -bool tcg_op_supported (TCGOpcode op); +/* +* tcg_op_supported: +* Query if @op, for @type and @flags, is supported by the host +* on which we are currently executing. +*/ +bool tcg_op_supported (TCGOpcode op,TCGType type,unsigned flags);void tcg_gen_call0 (void *func,TCGHelperInfo *,TCGTemp *ret);void tcg_gen_call1 (void *func,TCGHelperInfo *,TCGTemp *ret,TCGTemp *);
tcg/tcg.c +7 -4
@@ -1931,9 +1931,11 @@ TCGTemp *tcgv_i32_temp(TCGv_i32 v) }#endif /* CONFIG_DEBUG_TCG */ -/* Return true if OP may appear in the opcode stream. -Test the runtime variable that controls each opcode. */ -bool tcg_op_supported (TCGOpcode op) +/* +* Return true if OP may appear in the opcode stream with TYPE. +* Test the runtime variable that controls each opcode. +*/ +bool tcg_op_supported (TCGOpcode op,TCGType type,unsigned flags) {const bool have_vec = TCG_TARGET_HAS_v64 | TCG_TARGET_HAS_v128 | TCG_TARGET_HAS_v256;
@@ -6243,7 +6245,8 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start)/* fall through */ default :/* Sanity check that we've not introduced any unhandled opcodes. */ -tcg_debug_assert (tcg_op_supported (opc)); +tcg_debug_assert (tcg_op_supported (opc,TCGOP_TYPE (op), +TCGOP_FLAGS (op)));/* Note: in order to speed up the code, it would be much faster to have specialized register allocator functions for some common argument patterns */
Signature · 1 line
2.43.0
Re: [PATCH v2 06/81] tcg: Add type and flags arguments to tcg_op_supported
Quoted 5 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 7 ++++++- tcg/tcg.c | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
PATCH v2 7/81 target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
In reply to Richard HendersonRely on tcg-op-vec.c to expand the opcode if missing.
--- target/arm/tcg/translate-sve.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
target/arm/tcg/translate-sve.c +4 -16
@@ -596,14 +596,8 @@ static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)static void gen_bsl1n_vec (unsigned vece,TCGv_vec d,TCGv_vec n,TCGv_vec m,TCGv_vec k) { -if (TCG_TARGET_HAS_bitsel_vec) { -tcg_gen_not_vec (vece, n, n); -tcg_gen_bitsel_vec (vece, d, k, n, m); - }else { -tcg_gen_andc_vec (vece, n, k, n); -tcg_gen_andc_vec (vece, m, m, k); -tcg_gen_or_vec (vece, d, n, m); - } +tcg_gen_not_vec (vece, n, n); +tcg_gen_bitsel_vec (vece, d, k, n, m); } static void gen_bsl1n(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
@@ -640,14 +634,8 @@ static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)static void gen_bsl2n_vec (unsigned vece,TCGv_vec d,TCGv_vec n,TCGv_vec m,TCGv_vec k) { -if (TCG_TARGET_HAS_bitsel_vec) { -tcg_gen_not_vec (vece, m, m); -tcg_gen_bitsel_vec (vece, d, k, n, m); - }else { -tcg_gen_and_vec (vece, n, n, k); -tcg_gen_or_vec (vece, m, m, k); -tcg_gen_orc_vec (vece, d, n, m); - } +tcg_gen_not_vec (vece, m, m); +tcg_gen_bitsel_vec (vece, d, k, n, m); } static void gen_bsl2n(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
Signature · 1 line
2.43.0
Re: [PATCH v2 07/81] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
Quoted 12 lines · Richard Henderson
Rely on
tcg-op-vec.cto expand the opcode if missing.Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/translate-sve.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)target/arm/tcg/translate-sve.c +0
-0
target/arm/tcg/translate-sve.c static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) · line 602
Quoted 7 lines
target/arm/tcg/translate-sve.c +0
-4@@ -596,14 +596,8 @@ static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)static void gen_bsl1n_vec (unsigned vece,TCGv_vec d,TCGv_vec n,TCGv_vec m,TCGv_vec k) { -if (TCG_TARGET_HAS_bitsel_vec) { -tcg_gen_not_vec (vece, n, n); -tcg_gen_bitsel_vec (vece, d, k, n, m); - }else {
Why aren't we doing the NOT n operation here?
Quoted 26 lines
target/arm/tcg/translate-sve.c +4
-12-tcg_gen_andc_vec (vece, n, k, n); -tcg_gen_andc_vec (vece, m, m, k); -tcg_gen_or_vec (vece, d, n, m); - } +tcg_gen_not_vec (vece, n, n); +tcg_gen_bitsel_vec (vece, d, k, n, m); } static void gen_bsl1n(unsigned vece, uint32_t d, uint32_t n, uint32_t m,@@ -640,14 +634,8 @@ static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)static void gen_bsl2n_vec (unsigned vece,TCGv_vec d,TCGv_vec n,TCGv_vec m,TCGv_vec k) { -if (TCG_TARGET_HAS_bitsel_vec) { -tcg_gen_not_vec (vece, m, m); -tcg_gen_bitsel_vec (vece, d, k, n, m); - }else { -tcg_gen_and_vec (vece, n, n, k); -tcg_gen_or_vec (vece, m, m, k); -tcg_gen_orc_vec (vece, d, n, m); - } +tcg_gen_not_vec (vece, m, m); +tcg_gen_bitsel_vec (vece, d, k, n, m); } static void gen_bsl2n(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
Re: [PATCH v2 07/81] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Richard Henderson
Rely on
tcg-op-vec.cto expand the opcode if missing.Signed-off-by Richard Henderson <[email protected]>---
target/arm/tcg/translate-sve.c| 20 ++++----------------1 file changed, 4 insertions(+), 16 deletions(-)
Quoted 22 lines
target/arm/tcg/translate-sve.c static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, · line 603
Quoted 13 lines
target/arm/tcg/translate-sve.c +0
-4@@ -596,14 +596,8 @@ static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) static void gen_bsl1n_vec(unsigned vece, TCGv_vec d, TCGv_vec n, TCGv_vec m, TCGv_vec k) { - if (TCG_TARGET_HAS_bitsel_vec) { - tcg_gen_not_vec(vece, n, n); - tcg_gen_bitsel_vec(vece, d, k, n, m); - } else {Why aren't we doing the NOT n operation here?
Quoted 6 lines
target/arm/tcg/translate-sve.c +2
-4- tcg_gen_andc_vec(vece, n, k, n); - tcg_gen_andc_vec(vece, m, m, k); - tcg_gen_or_vec(vece, d, n, m); - } + tcg_gen_not_vec(vece, n, n); + tcg_gen_bitsel_vec(vece, d, k, n, m);
Pardon? It's right there, unindented.
Anyway, maybe I'll keep this, as it's still used on pre-avx512 x86 hosts.
r~
Re: [PATCH v2 07/81] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
Quoted 25 lines · Richard Henderson
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Richard Henderson
Rely on
tcg-op-vec.cto expand the opcode if missing.Signed-off-by Richard Henderson <[email protected]>---
target/arm/tcg/translate-sve.c| 20 ++++----------------1 file changed, 4 insertions(+), 16 deletions(-)target/arm/tcg/translate-sve.c +0
-0target/arm/tcg/translate-sve.c static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 · line 603
Quoted 8 lines
target/arm/tcg/translate-sve.c +0
-4@@ -596,14 +596,8 @@ static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) static void gen_bsl1n_vec(unsigned vece, TCGv_vec d, TCGv_vec n, TCGv_vec m, TCGv_vec k) { - if (TCG_TARGET_HAS_bitsel_vec) { - tcg_gen_not_vec(vece, n, n); - tcg_gen_bitsel_vec(vece, d, k, n, m); - } else {Why aren't we doing the NOT n operation here?
Quoted 8 lines
Quoted 6 lines
target/arm/tcg/translate-sve.c static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) · line 600
Quoted 6 lines
target/arm/tcg/translate-sve.c +2
-4- tcg_gen_andc_vec(vece, n, k, n); - tcg_gen_andc_vec(vece, m, m, k); - tcg_gen_or_vec(vece, d, n, m); - } + tcg_gen_not_vec(vece, n, n); + tcg_gen_bitsel_vec(vece, d, k, n, m);Pardon? It's right there, unindented.
Sorry I'm not clear. Previous to your change, in the TCG_TARGET_HAS_bitsel_vec side we use the NOT opcode, but not in the other side where we expand, why?
Quoted 4 lines
Anyway, maybe I'll keep this, as it's still used on pre-avx512 x86 hosts.
r~
Re: [PATCH v2 07/81] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
static void
gen_bsl1n_vec(unsigned vece, TCGv_vec d, TCGv_vec n, TCGv_vec m, TCGv_vec k)
{
- if (TCG_TARGET_HAS_bitsel_vec) {
-tcg_gen_not_vec(vece, n, n);
-tcg_gen_bitsel_vec(vece, d, k, n, m);
- } else {Why aren't we doing the NOT n operation here?
Quoted 6 lines
-
tcg_gen_andc_vec(vece, n, k, n);
-tcg_gen_andc_vec(vece, m, m, k);
-tcg_gen_or_vec(vece, d, n, m);
- }
+tcg_gen_not_vec(vece, n, n);
+tcg_gen_bitsel_vec(vece, d, k, n, m);
Quoted 5 lines
Quoted 1 line
Pardon? It's right there, unindented.
Sorry I'm not clear. Previous to your change, in the
TCG_TARGET_HAS_bitsel_vecside we use the NOT opcode, but not in the other side where we expand, why?
Are you asking about the code being removed?
Recall that bitsel = (n & k) | (m & ~k).
Passing n = ~n' we get (~n & k) | (m & ~k),
= (k & ~n) | (m & ~k).
which is the two andc + or operations above.
r~
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v2 07/81] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec
Quoted 9 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
static void
gen_bsl1n_vec(unsigned vece, TCGv_vec d, TCGv_vec n, TCGv_vec m, TCGv_vec k)
{
- if (TCG_TARGET_HAS_bitsel_vec) {
-tcg_gen_not_vec(vece, n, n);
-tcg_gen_bitsel_vec(vece, d, k, n, m);
- } else {
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Why aren't we doing the NOT n operation here?
Quoted 1 line
-
tcg_gen_andc_vec(vece, n, k, n);
[*]
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
-
tcg_gen_andc_vec(vece, m, m, k);
-tcg_gen_or_vec(vece, d, n, m);
- }
+tcg_gen_not_vec(vece, n, n);
+tcg_gen_bitsel_vec(vece, d, k, n, m);Pardon? It's right there, unindented.
Sorry I'm not clear. Previous to your change, in the
TCG_TARGET_HAS_bitsel_vecside we use the NOT opcode, but not in the other side where we expand, why?
Quoted 8 lines
Are you asking about the code being removed?
Recall that bitsel = (n & k) | (m & ~k).
Passing n = ~n' we get (~n & k) | (m & ~k),
= (k & ~n) | (m & ~k).which is the two andc + or operations above.
Sorry, I misread the first ANDC [*] as AND...
PATCH v2 8/81 target/arm: Use tcg_op_supported
In reply to Richard HendersonDo not reference TCG_TARGET_HAS_* directly.
--- target/arm/tcg/translate-a64.c | 10 ++++++---- target/arm/tcg/translate-sve.c | 2 +- target/arm/tcg/translate.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
target/arm/tcg/translate-a64.c +6 -4
@@ -8219,6 +8219,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)TCGv_i64 tcg_rn, tcg_y;DisasCompare c;unsigned nzcv; +bool has_andc;/* Set T0 = !COND. */ arm_test_cc (&c, a->cond);
@@ -8249,17 +8250,18 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)tcg_gen_subi_i32 (tcg_t2, tcg_t0,1 ); nzcv = a->nzcv; + has_andc =tcg_op_supported (INDEX_op_andc_i32,TCG_TYPE_I32 ,0 );if (nzcv &8 ) {/* N */ tcg_gen_or_i32 (cpu_NF, cpu_NF, tcg_t1); }else { -if (TCG_TARGET_HAS_andc_i32) { +if (has_andc) {tcg_gen_andc_i32 (cpu_NF, cpu_NF, tcg_t1); }else {tcg_gen_and_i32 (cpu_NF, cpu_NF, tcg_t2); } }if (nzcv &4 ) {/* Z */ -if (TCG_TARGET_HAS_andc_i32) { +if (has_andc) {tcg_gen_andc_i32 (cpu_ZF, cpu_ZF, tcg_t1); }else {tcg_gen_and_i32 (cpu_ZF, cpu_ZF, tcg_t2);
@@ -8270,7 +8272,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)if (nzcv &2 ) {/* C */ tcg_gen_or_i32 (cpu_CF, cpu_CF, tcg_t0); }else { -if (TCG_TARGET_HAS_andc_i32) { +if (has_andc) {tcg_gen_andc_i32 (cpu_CF, cpu_CF, tcg_t1); }else {tcg_gen_and_i32 (cpu_CF, cpu_CF, tcg_t2);
@@ -8279,7 +8281,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)if (nzcv &1 ) {/* V */ tcg_gen_or_i32 (cpu_VF, cpu_VF, tcg_t1); }else { -if (TCG_TARGET_HAS_andc_i32) { +if (has_andc) {tcg_gen_andc_i32 (cpu_VF, cpu_VF, tcg_t1); }else {tcg_gen_and_i32 (cpu_VF, cpu_VF, tcg_t2);
target/arm/tcg/translate-sve.c +1 -1
@@ -622,7 +622,7 @@ static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)* = | ~(m | k) */ tcg_gen_and_i64 (n, n, k); -if (TCG_TARGET_HAS_orc_i64) { +if (tcg_op_supported (INDEX_op_orc_i64,TCG_TYPE_I64 ,0 )) {tcg_gen_or_i64 (m, m, k);tcg_gen_orc_i64 (d, n, m); }else {
target/arm/tcg/translate.c +1 -1
@@ -493,7 +493,7 @@ static void gen_add_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1)static void gen_adc_CC (TCGv_i32 dest,TCGv_i32 t0,TCGv_i32 t1) {TCGv_i32 tmp =tcg_temp_new_i32 (); -if (TCG_TARGET_HAS_add2_i32) { +if (tcg_op_supported (INDEX_op_add2_i32,TCG_TYPE_I32 ,0 )) {tcg_gen_movi_i32 (tmp,0 );tcg_gen_add2_i32 (cpu_NF, cpu_CF, t0, tmp, cpu_CF, tmp);tcg_gen_add2_i32 (cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1, tmp);
Signature · 1 line
2.43.0
PATCH v2 9/81 target/tricore: Use tcg_op_supported
In reply to Richard HendersonDo not reference TCG_TARGET_HAS_* directly.
--- target/tricore/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/tricore/translate.c +2 -2
@@ -3980,7 +3980,7 @@ static void decode_bit_andacc(DisasContext *ctx) pos1, pos2, &tcg_gen_andc_tl, &tcg_gen_and_tl);break ;case OPC2_32_BIT_AND_NOR_T : -if (TCG_TARGET_HAS_andc_i32) { +if (tcg_op_supported (INDEX_op_andc_i32,TCG_TYPE_I32 ,0 )) {gen_bit_2op (cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2], pos1, pos2, &tcg_gen_or_tl, &tcg_gen_andc_tl); }else {
@@ -4113,7 +4113,7 @@ static void decode_bit_orand(DisasContext *ctx) pos1, pos2, &tcg_gen_andc_tl, &tcg_gen_or_tl);break ;case OPC2_32_BIT_OR_NOR_T : -if (TCG_TARGET_HAS_orc_i32) { +if (tcg_op_supported (INDEX_op_orc_i32,TCG_TYPE_I32 ,0 )) {gen_bit_2op (cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2], pos1, pos2, &tcg_gen_or_tl, &tcg_gen_orc_tl); }else {
Signature · 1 line
2.43.0
PATCH v2 10/81 tcg: Add tcg_op_deposit_valid
In reply to Richard Henderson--- include/tcg/tcg.h | 6 ++++++ tcg/tcg.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)
include/tcg/tcg.h +6 -0
@@ -840,6 +840,12 @@ typedef struct TCGTargetOpDef {* on which we are currently executing. */ bool tcg_op_supported (TCGOpcode op,TCGType type,unsigned flags); +/* +* tcg_op_deposit_valid: +* Query if a deposit into (ofs, len) is supported for @type by +* the host on which we are currently executing. +*/ +bool tcg_op_deposit_valid (TCGType type,unsigned ofs,unsigned len);void tcg_gen_call0 (void *func,TCGHelperInfo *,TCGTemp *ret);void tcg_gen_call1 (void *func,TCGHelperInfo *,TCGTemp *ret,TCGTemp *);
tcg/tcg.c +21 -0
@@ -2238,6 +2238,27 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags) } } +bool tcg_op_deposit_valid (TCGType type,unsigned ofs,unsigned len) +{ +tcg_debug_assert (len >0 ); +switch (type) { +case TCG_TYPE_I32 : +tcg_debug_assert (ofs <32 ); +tcg_debug_assert (len <=32 ); +tcg_debug_assert (ofs + len <=32 ); +return TCG_TARGET_HAS_deposit_i32 && +TCG_TARGET_deposit_i32_valid (ofs, len); +case TCG_TYPE_I64 : +tcg_debug_assert (ofs <64 ); +tcg_debug_assert (len <=64 ); +tcg_debug_assert (ofs + len <=64 ); +return TCG_TARGET_HAS_deposit_i64 && +TCG_TARGET_deposit_i64_valid (ofs, len); +default : +g_assert_not_reached (); + } +} +static TCGOp *tcg_op_alloc (TCGOpcode opc,unsigned nargs); static void tcg_gen_callN(void *func, TCGHelperInfo *info,
Signature · 1 line
2.43.0
PATCH v2 11/81 target/i386: Remove TCG_TARGET_extract_tl_valid
In reply to Richard HendersonThis macro is unused.
--- target/i386/tcg/emit.c.inc | 2 -- 1 file changed, 2 deletions(-)
target/i386/tcg/emit.c.inc +0 -2
@@ -26,11 +26,9 @@ #ifdef TARGET_X86_64 #define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i64 #define TCG_TARGET_deposit_tl_valid TCG_TARGET_deposit_i64_valid -#define TCG_TARGET_extract_tl_valid TCG_TARGET_extract_i64_valid #else #define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i32 #define TCG_TARGET_deposit_tl_valid TCG_TARGET_deposit_i32_valid -#define TCG_TARGET_extract_tl_valid TCG_TARGET_extract_i32_valid #endif #define MMX_OFFSET(reg) \
Signature · 1 line
2.43.0
PATCH v2 12/81 target/i386: Use tcg_op_deposit_valid
In reply to Richard HendersonAvoid direct usage of TCG_TARGET_deposit_*_valid.
--- target/i386/tcg/emit.c.inc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
target/i386/tcg/emit.c.inc +2 -4
@@ -25,10 +25,8 @@ */ #ifdef TARGET_X86_64 #define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i64 -#define TCG_TARGET_deposit_tl_valid TCG_TARGET_deposit_i64_valid #else #define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i32 -#define TCG_TARGET_deposit_tl_valid TCG_TARGET_deposit_i32_valid #endif #define MMX_OFFSET(reg) \
@@ -3449,7 +3447,7 @@ static void gen_RCL(DisasContext *s, X86DecodedInsn *decode) } /* Compute high part, including incoming carry. */ - if (!have_1bit_cin || TCG_TARGET_deposit_tl_valid(1, TARGET_LONG_BITS - 1)) { + if (!have_1bit_cin || tcg_op_deposit_valid(TCG_TYPE_TL, 1, TARGET_LONG_BITS - 1)) { /* high = (T0 << 1) | cin */ TCGv cin = have_1bit_cin ? decode->cc_dst : decode->cc_src; tcg_gen_deposit_tl(high, cin, s->T0, 1, TARGET_LONG_BITS - 1);
@@ -3501,7 +3499,7 @@ static void gen_RCR(DisasContext *s, X86DecodedInsn *decode) } /* Save incoming carry into high, it will be shifted later. */ - if (!have_1bit_cin || TCG_TARGET_deposit_tl_valid(1, TARGET_LONG_BITS - 1)) { + if (!have_1bit_cin || tcg_op_deposit_valid(TCG_TYPE_TL, 1, TARGET_LONG_BITS - 1)) { TCGv cin = have_1bit_cin ? decode->cc_dst : decode->cc_src; tcg_gen_deposit_tl(high, cin, s->T0, 1, TARGET_LONG_BITS - 1); } else {
Signature · 1 line
2.43.0
PATCH v2 13/81 target/i386: Use tcg_op_supported
In reply to Richard HendersonDo not reference TCG_TARGET_HAS_* directly.
--- target/i386/tcg/emit.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/i386/tcg/emit.c.inc +3 -3
@@ -24,9 +24,9 @@ * The exact opcode to check depends on 32- vs. 64-bit. */ #ifdef TARGET_X86_64 -#define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i64 +#define INDEX_op_extract2_tl INDEX_op_extract2_i64 #else -#define TCG_TARGET_HAS_extract2_tl TCG_TARGET_HAS_extract2_i32 +#define INDEX_op_extract2_tl INDEX_op_extract2_i32 #endif #define MMX_OFFSET(reg) \
@@ -2993,7 +2993,7 @@ static void gen_PMOVMSKB(DisasContext *s, X86DecodedInsn *decode) tcg_gen_ld8u_tl(s->T0, tcg_env, offsetof(CPUX86State, xmm_t0.ZMM_B(vec_len - 1))); while (vec_len > 8) { vec_len -= 8; - if (TCG_TARGET_HAS_extract2_tl) { + if (tcg_op_supported(INDEX_op_extract2_tl, TCG_TYPE_TL, 0)) { /* * Load the next byte of the result into the high byte of T. * TCG does a similar expansion of deposit to shl+extract2; by
Signature · 1 line
2.43.0
PATCH v2 14/81 tcg: Remove TCG_TARGET_NEED_LDST_LABELS and TCG_TARGET_NEED_POOL_LABELS
In reply to Richard HendersonMake these features unconditional, as they're used by most tcg backends anyway. Merge tcg-ldst.c.inc and tcg-pool.c.inc into tcg.c and mark some of the functions unused, so that when the features are not used we won't get Werrors.
--- include/tcg/tcg.h | 4 - tcg/aarch64/tcg-target.h | 2 - tcg/arm/tcg-target.h | 2 - tcg/i386/tcg-target.h | 2 - tcg/loongarch64/tcg-target.h | 2 - tcg/mips/tcg-target.h | 2 - tcg/ppc/tcg-target.h | 2 - tcg/riscv/tcg-target.h | 3 - tcg/s390x/tcg-target.h | 2 - tcg/sparc64/tcg-target.h | 2 - tcg/tcg.c | 211 +++++++++++++++++++++++++++++-- tcg/aarch64/tcg-target.c.inc | 2 - tcg/arm/tcg-target.c.inc | 2 - tcg/i386/tcg-target.c.inc | 3 - tcg/loongarch64/tcg-target.c.inc | 9 +- tcg/mips/tcg-target.c.inc | 3 - tcg/ppc/tcg-target.c.inc | 2 - tcg/riscv/tcg-target.c.inc | 3 - tcg/s390x/tcg-target.c.inc | 2 - tcg/sparc64/tcg-target.c.inc | 3 - tcg/tcg-ldst.c.inc | 65 ---------- tcg/tcg-pool.c.inc | 162 ------------------------ tcg/tci/tcg-target.c.inc | 12 +- 23 files changed, 216 insertions(+), 286 deletions(-) delete mode 100644 tcg/tcg-ldst.c.inc delete mode 100644 tcg/tcg-pool.c.inc
include/tcg/tcg.h +0 -4
@@ -498,12 +498,8 @@ struct TCGContext {CPUState *cpu;/* *_trans */ /* These structures are private to tcg-target.c.inc. */ -#ifdef TCG_TARGET_NEED_LDST_LABELS QSIMPLEQ_HEAD(, TCGLabelQemuLdst) ldst_labels; -#endif -#ifdef TCG_TARGET_NEED_POOL_LABELS struct TCGLabelPoolData *pool_labels; -#endif TCGLabel *exitreq_label;
tcg/aarch64/tcg-target.h +0 -2
@@ -157,7 +157,5 @@ typedef enum {#define TCG_TARGET_HAS_tst_vec 1#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif /* AARCH64_TCG_TARGET_H */
tcg/arm/tcg-target.h +0 -2
@@ -145,7 +145,5 @@ extern bool use_neon_instructions;#define TCG_TARGET_HAS_tst_vec 1#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/i386/tcg-target.h +0 -2
@@ -227,7 +227,5 @@ typedef enum {#include "tcg/tcg-mo.h" #define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/loongarch64/tcg-target.h +0 -2
@@ -189,6 +189,4 @@ typedef enum {#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#endif /* LOONGARCH_TCG_TARGET_H */
tcg/mips/tcg-target.h +0 -2
@@ -183,7 +183,5 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_tst 0#define TCG_TARGET_DEFAULT_MO 0 -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/ppc/tcg-target.h +0 -2
@@ -176,7 +176,5 @@ typedef enum {#define TCG_TARGET_HAS_tst_vec 0#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/riscv/tcg-target.h +0 -3
@@ -161,7 +161,4 @@ typedef enum {#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS -#endif
tcg/s390x/tcg-target.h +0 -2
@@ -166,7 +166,5 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_tst_vec 0#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/sparc64/tcg-target.h +0 -2
@@ -143,7 +143,5 @@ extern bool use_vis3_instructions;#define TCG_AREG0 TCG_REG_I0#define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_NEED_LDST_LABELS -#define TCG_TARGET_NEED_POOL_LABELS #endif
tcg/tcg.c +198 -13
263 lines not on this page · raw message
tcg/aarch64/tcg-target.c.inc +0 -2
@@ -10,8 +10,6 @@ * See the COPYING file in the top-level directory for details. */ -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" #include "qemu/bitops.h" /* Used for function call generation. */
tcg/arm/tcg-target.c.inc +0 -2
@@ -23,8 +23,6 @@ */ #include "elf.h" -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" int arm_arch = __ARM_ARCH;
tcg/i386/tcg-target.c.inc +0 -3
@@ -22,9 +22,6 @@ * THE SOFTWARE. */ -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" - /* Used for function call generation. */ #define TCG_TARGET_STACK_ALIGN 16 #if defined(_WIN64)
tcg/loongarch64/tcg-target.c.inc +8 -1
@@ -29,7 +29,6 @@ * THE SOFTWARE. */ -#include "../tcg-ldst.c.inc" #include <asm/hwcap.h> /* used for function call generation */
@@ -2465,6 +2464,14 @@ static void tcg_out_tb_start(TCGContext *s) /* nothing to do */ } +static void tcg_out_nop_fill(tcg_insn_unit *p, int count) +{ + for (int i = 0; i < count; ++i) { + /* Canonical nop is andi r0,r0,0 */ + p[i] = OPC_ANDI; + } +} + static void tcg_target_init(TCGContext *s) { unsigned long hwcap = qemu_getauxval(AT_HWCAP);
tcg/mips/tcg-target.c.inc +0 -3
@@ -24,9 +24,6 @@ * THE SOFTWARE. */ -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" - /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 16 #if _MIPS_SIM == _ABIO32
tcg/ppc/tcg-target.c.inc +0 -2
@@ -23,8 +23,6 @@ */ #include "elf.h" -#include "../tcg-pool.c.inc" -#include "../tcg-ldst.c.inc" /* * Standardize on the _CALL_FOO symbols used by GCC:
tcg/riscv/tcg-target.c.inc +0 -3
@@ -27,9 +27,6 @@ * THE SOFTWARE. */ -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" - /* Used for function call generation. */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16
tcg/s390x/tcg-target.c.inc +0 -2
@@ -24,8 +24,6 @@ * THE SOFTWARE. */ -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" #include "elf.h" /* Used for function call generation. */
tcg/sparc64/tcg-target.c.inc +0 -3
@@ -27,9 +27,6 @@ #error "unsupported code generation mode" #endif -#include "../tcg-ldst.c.inc" -#include "../tcg-pool.c.inc" - /* Used for function call generation. */ #define TCG_REG_CALL_STACK TCG_REG_O6 #define TCG_TARGET_STACK_BIAS 2047
tcg/tcg-ldst.c.inc deleted +0 -65
65 lines not on this page · raw message
tcg/tcg-pool.c.inc deleted +0 -162
162 lines not on this page · raw message
tcg/tci/tcg-target.c.inc +10 -2
@@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include "../tcg-pool.c.inc" - /* Used for function call generation. */ #define TCG_TARGET_CALL_STACK_OFFSET 0 #define TCG_TARGET_STACK_ALIGN 8
@@ -979,3 +977,13 @@ bool tcg_target_has_memory_bswap(MemOp memop) { return true; } + +static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + g_assert_not_reached(); +} + +static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + g_assert_not_reached(); +}
Signature · 1 line
2.43.0
Re: [PATCH v2 14/81] tcg: Remove TCG_TARGET_NEED_LDST_LABELS and TCG_TARGET_NEED_POOL_LABELS
Quoted 31 lines · Richard Henderson
Make these features unconditional, as they're used by most tcg backends anyway. Merge tcg-ldst.c.inc and tcg-pool.c.inc into
tcg.cand mark some of the functions unused, so that when the features are not used we won't get Werrors.Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 4 - tcg/aarch64/tcg-target.h | 2 - tcg/arm/tcg-target.h | 2 - tcg/i386/tcg-target.h | 2 - tcg/loongarch64/tcg-target.h | 2 - tcg/mips/tcg-target.h | 2 - tcg/ppc/tcg-target.h | 2 - tcg/riscv/tcg-target.h | 3 - tcg/s390x/tcg-target.h | 2 - tcg/sparc64/tcg-target.h | 2 - tcg/tcg.c | 211 +++++++++++++++++++++++++++++-- tcg/aarch64/tcg-target.c.inc | 2 - tcg/arm/tcg-target.c.inc | 2 - tcg/i386/tcg-target.c.inc | 3 - tcg/loongarch64/tcg-target.c.inc | 9 +- tcg/mips/tcg-target.c.inc | 3 - tcg/ppc/tcg-target.c.inc | 2 - tcg/riscv/tcg-target.c.inc | 3 - tcg/s390x/tcg-target.c.inc | 2 - tcg/sparc64/tcg-target.c.inc | 3 - tcg/tcg-ldst.c.inc | 65 ---------- tcg/tcg-pool.c.inc | 162 ------------------------ tcg/tci/tcg-target.c.inc | 12 +- 23 files changed, 216 insertions(+), 286 deletions(-)
Quoted 2 lines
delete mode 100644 tcg/tcg-ldst.c.inc
delete mode 100644 tcg/tcg-pool.c.inc
Simpler to review using --color-moved=dimmed-zebra.
PATCH v2 15/81 tcg: Rename tcg-target.opc.h to tcg-target-opc.h.inc
In reply to Richard HendersonIn addition, add empty files for mips, sparc64 and tci. Make the include unconditional within tcg-opc.h.
---
include/tcg/tcg-opc.h | 4 +---
tcg/aarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/arm/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/i386/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/loongarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/mips/tcg-target-opc.h.inc | 1 +
tcg/ppc/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/riscv/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/s390x/{tcg-target.opc.h => tcg-target-opc.h.inc} | 0
tcg/sparc64/tcg-target-opc.h.inc | 1 +
tcg/tci/tcg-target-opc.h.inc | 1 +
11 files changed, 4 insertions(+), 3 deletions(-)
rename tcg/aarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/arm/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/i386/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/loongarch64/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
create mode 100644 tcg/mips/tcg-target-opc.h.inc
rename tcg/ppc/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/riscv/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
rename tcg/s390x/{tcg-target.opc.h => tcg-target-opc.h.inc} (100%)
create mode 100644 tcg/sparc64/tcg-target-opc.h.inc
create mode 100644 tcg/tci/tcg-target-opc.h.incinclude/tcg/tcg-opc.h +1 -3
@@ -301,9 +301,7 @@ DEF(cmpsel_vec, 1, 4, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_cmpsel_vec)) DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) -#if TCG_TARGET_MAYBE_vec -#include "tcg-target.opc.h" -#endif +#include "tcg-target-opc.h.inc" #ifdef TCG_TARGET_INTERPRETER /* These opcodes are only for use between the tci generator and interpreter. */
tcg/aarch64/tcg-target-opc.h.inc renamed from tcg/aarch64/tcg-target.opc.h +0 -0
tcg/arm/tcg-target-opc.h.inc renamed from tcg/arm/tcg-target.opc.h +0 -0
tcg/i386/tcg-target-opc.h.inc renamed from tcg/i386/tcg-target.opc.h +0 -0
tcg/loongarch64/tcg-target-opc.h.inc renamed from tcg/loongarch64/tcg-target.opc.h +0 -0
tcg/mips/tcg-target-opc.h.inc new file +1 -0
@@ -0,0 +1 @@ +/* No target specific opcodes. */
tcg/ppc/tcg-target-opc.h.inc renamed from tcg/ppc/tcg-target.opc.h +0 -0
tcg/riscv/tcg-target-opc.h.inc renamed from tcg/riscv/tcg-target.opc.h +0 -0
tcg/s390x/tcg-target-opc.h.inc renamed from tcg/s390x/tcg-target.opc.h +0 -0
tcg/sparc64/tcg-target-opc.h.inc new file +1 -0
@@ -0,0 +1 @@ +/* No target specific opcodes. */
tcg/tci/tcg-target-opc.h.inc new file +1 -0
@@ -0,0 +1 @@ +/* No target specific opcodes. */
Signature · 1 line
2.43.0
PATCH v2 16/81 tcg/tci: Move TCI specific opcodes to tcg-target-opc.h.inc
In reply to Richard HendersonNow that tcg-target-opc.h.inc is unconditional,
we can move these out of the generic header.
--- include/tcg/tcg-opc.h | 6 ------ tcg/tci/tcg-target-opc.h.inc | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-)
include/tcg/tcg-opc.h +0 -6
@@ -303,12 +303,6 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)#include "tcg-target-opc.h.inc" -#ifdef TCG_TARGET_INTERPRETER -/* These opcodes are only for use between the tci generator and interpreter. */ -DEF(tci_movi, 1, 0, 1, TCG_OPF_NOT_PRESENT) -DEF(tci_movl, 1, 0, 1, TCG_OPF_NOT_PRESENT) -#endif -#undef DATA64_ARGS#undef IMPL#undef IMPL64
tcg/tci/tcg-target-opc.h.inc +4 -1
@@ -1 +1,4 @@ -/* No target specific opcodes. */ +/* SPDX-License-Identifier: MIT */ +/* These opcodes for use between the tci generator and interpreter. */ +DEF(tci_movi, 1, 0, 1, TCG_OPF_NOT_PRESENT) +DEF(tci_movl, 1, 0, 1, TCG_OPF_NOT_PRESENT)
Signature · 1 line
2.43.0
PATCH v2 17/81 tcg: Move fallback tcg_can_emit_vec_op out of line
In reply to Richard HendersonDon't reference TCG_TARGET_MAYBE_vec in a public header.
--- include/tcg/tcg.h | 7 ------- tcg/tcg.c | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-)
include/tcg/tcg.h +0 -7
@@ -1020,17 +1020,10 @@ extern tcg_prologue_fn *tcg_qemu_tb_exec;void tcg_register_jit (const void *buf,size_t buf_size); -#if TCG_TARGET_MAYBE_vec/* Return zero if the tuple (opc, type, vece) is unsupportable; return > 0 if it is directly supportable; return < 0 if we must call tcg_expand_vec_op. */ int tcg_can_emit_vec_op (TCGOpcode ,TCGType ,unsigned ); -#else -static inline int tcg_can_emit_vec_op (TCGOpcode o,TCGType t,unsigned ve) -{ -return 0 ; -} -#endif /* Expand the tuple (opc, type, vece) on the given arguments. */ void tcg_expand_vec_op (TCGOpcode ,TCGType ,unsigned ,TCGArg , ...);
tcg/tcg.c +4 -0
@@ -170,6 +170,10 @@ static inline void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, {g_assert_not_reached (); } +int tcg_can_emit_vec_op (TCGOpcode o,TCGType t,unsigned ve) +{ +return 0 ; +}#endif static void tcg_out_st (TCGContext *s,TCGType type,TCGReg arg,TCGReg arg1,intptr_t arg2);
Signature · 1 line
2.43.0
PATCH v2 18/81 tcg: Split out tcg-target-has.h and tcg-has.h
In reply to Richard HendersonMove all of the TCG_TARGET_HAS_* definitions to their own files. These need not be exposed by include/tcg/tcg.h.
--- include/tcg/tcg.h | 105 ----------------------- tcg/aarch64/tcg-target-has.h | 119 ++++++++++++++++++++++++++ tcg/aarch64/tcg-target.h | 109 ------------------------ tcg/arm/tcg-target-has.h | 85 +++++++++++++++++++ tcg/arm/tcg-target.h | 74 ---------------- tcg/i386/tcg-target-has.h | 139 +++++++++++++++++++++++++++++++ tcg/i386/tcg-target.h | 129 ---------------------------- tcg/loongarch64/tcg-target-has.h | 113 +++++++++++++++++++++++++ tcg/loongarch64/tcg-target.h | 102 ----------------------- tcg/mips/tcg-target-has.h | 122 +++++++++++++++++++++++++++ tcg/mips/tcg-target.h | 112 ------------------------- tcg/ppc/tcg-target-has.h | 124 +++++++++++++++++++++++++++ tcg/ppc/tcg-target.h | 122 --------------------------- tcg/riscv/tcg-target-has.h | 112 +++++++++++++++++++++++++ tcg/riscv/tcg-target.h | 102 ----------------------- tcg/s390x/tcg-target-has.h | 124 +++++++++++++++++++++++++++ tcg/s390x/tcg-target.h | 114 ------------------------- tcg/sparc64/tcg-target-has.h | 86 +++++++++++++++++++ tcg/sparc64/tcg-target.h | 76 ----------------- tcg/tcg-has.h | 117 ++++++++++++++++++++++++++ tcg/tci/tcg-target-has.h | 83 ++++++++++++++++++ tcg/tci/tcg-target.h | 75 ----------------- tcg/optimize.c | 1 + tcg/tcg-common.c | 1 + tcg/tcg-op-gvec.c | 1 + tcg/tcg-op-ldst.c | 2 +- tcg/tcg-op-vec.c | 1 + tcg/tcg-op.c | 2 +- tcg/tcg.c | 1 + tcg/tci.c | 1 + 30 files changed, 1232 insertions(+), 1122 deletions(-) create mode 100644 tcg/aarch64/tcg-target-has.h create mode 100644 tcg/arm/tcg-target-has.h create mode 100644 tcg/i386/tcg-target-has.h create mode 100644 tcg/loongarch64/tcg-target-has.h create mode 100644 tcg/mips/tcg-target-has.h create mode 100644 tcg/ppc/tcg-target-has.h create mode 100644 tcg/riscv/tcg-target-has.h create mode 100644 tcg/s390x/tcg-target-has.h create mode 100644 tcg/sparc64/tcg-target-has.h create mode 100644 tcg/tcg-has.h create mode 100644 tcg/tci/tcg-target-has.h
include/tcg/tcg.h +0 -105
@@ -64,111 +64,6 @@ typedef uint64_t TCGRegSet;#error unsupported#endif -#if TCG_TARGET_REG_BITS ==32 -/* Turn some undef macros into false macros. */ -#define TCG_TARGET_HAS_extr_i64_i32 0 -#define TCG_TARGET_HAS_div_i64 0 -#define TCG_TARGET_HAS_rem_i64 0 -#define TCG_TARGET_HAS_div2_i64 0 -#define TCG_TARGET_HAS_rot_i64 0 -#define TCG_TARGET_HAS_ext8s_i64 0 -#define TCG_TARGET_HAS_ext16s_i64 0 -#define TCG_TARGET_HAS_ext32s_i64 0 -#define TCG_TARGET_HAS_ext8u_i64 0 -#define TCG_TARGET_HAS_ext16u_i64 0 -#define TCG_TARGET_HAS_ext32u_i64 0 -#define TCG_TARGET_HAS_bswap16_i64 0 -#define TCG_TARGET_HAS_bswap32_i64 0 -#define TCG_TARGET_HAS_bswap64_i64 0 -#define TCG_TARGET_HAS_not_i64 0 -#define TCG_TARGET_HAS_andc_i64 0 -#define TCG_TARGET_HAS_orc_i64 0 -#define TCG_TARGET_HAS_eqv_i64 0 -#define TCG_TARGET_HAS_nand_i64 0 -#define TCG_TARGET_HAS_nor_i64 0 -#define TCG_TARGET_HAS_clz_i64 0 -#define TCG_TARGET_HAS_ctz_i64 0 -#define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 -#define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_negsetcond_i64 0 -#define TCG_TARGET_HAS_add2_i64 0 -#define TCG_TARGET_HAS_sub2_i64 0 -#define TCG_TARGET_HAS_mulu2_i64 0 -#define TCG_TARGET_HAS_muls2_i64 0 -#define TCG_TARGET_HAS_muluh_i64 0 -#define TCG_TARGET_HAS_mulsh_i64 0 -/* Turn some undef macros into true macros. */ -#define TCG_TARGET_HAS_add2_i32 1 -#define TCG_TARGET_HAS_sub2_i32 1 -#endif - -#ifndef TCG_TARGET_deposit_i32_valid -#define TCG_TARGET_deposit_i32_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_deposit_i64_valid -#define TCG_TARGET_deposit_i64_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_extract_i32_valid -#define TCG_TARGET_extract_i32_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_extract_i64_valid -#define TCG_TARGET_extract_i64_valid (ofs, len) 1 -#endif - -/* Only one of DIV or DIV2 should be defined. */ -#if defined(TCG_TARGET_HAS_div_i32) -#define TCG_TARGET_HAS_div2_i32 0 -#elif defined(TCG_TARGET_HAS_div2_i32) -#define TCG_TARGET_HAS_div_i32 0 -#define TCG_TARGET_HAS_rem_i32 0 -#endif -#if defined(TCG_TARGET_HAS_div_i64) -#define TCG_TARGET_HAS_div2_i64 0 -#elif defined(TCG_TARGET_HAS_div2_i64) -#define TCG_TARGET_HAS_div_i64 0 -#define TCG_TARGET_HAS_rem_i64 0 -#endif - -#if !defined(TCG_TARGET_HAS_v64) \ - && !defined(TCG_TARGET_HAS_v128) \ - && !defined(TCG_TARGET_HAS_v256) -#define TCG_TARGET_MAYBE_vec 0 -#define TCG_TARGET_HAS_abs_vec 0 -#define TCG_TARGET_HAS_neg_vec 0 -#define TCG_TARGET_HAS_not_vec 0 -#define TCG_TARGET_HAS_andc_vec 0 -#define TCG_TARGET_HAS_orc_vec 0 -#define TCG_TARGET_HAS_nand_vec 0 -#define TCG_TARGET_HAS_nor_vec 0 -#define TCG_TARGET_HAS_eqv_vec 0 -#define TCG_TARGET_HAS_roti_vec 0 -#define TCG_TARGET_HAS_rots_vec 0 -#define TCG_TARGET_HAS_rotv_vec 0 -#define TCG_TARGET_HAS_shi_vec 0 -#define TCG_TARGET_HAS_shs_vec 0 -#define TCG_TARGET_HAS_shv_vec 0 -#define TCG_TARGET_HAS_mul_vec 0 -#define TCG_TARGET_HAS_sat_vec 0 -#define TCG_TARGET_HAS_minmax_vec 0 -#define TCG_TARGET_HAS_bitsel_vec 0 -#define TCG_TARGET_HAS_cmpsel_vec 0 -#define TCG_TARGET_HAS_tst_vec 0 -#else -#define TCG_TARGET_MAYBE_vec 1 -#endif -#ifndef TCG_TARGET_HAS_v64 -#define TCG_TARGET_HAS_v64 0 -#endif -#ifndef TCG_TARGET_HAS_v128 -#define TCG_TARGET_HAS_v128 0 -#endif -#ifndef TCG_TARGET_HAS_v256 -#define TCG_TARGET_HAS_v256 0 -#endif - typedef enum TCGOpcode { #define DEF(name, oargs, iargs, cargs, flags) INDEX_op_ ## name,#include "tcg/tcg-opc.h"
tcg/aarch64/tcg-target-has.h new file +119 -0
119 lines not on this page · raw message
tcg/aarch64/tcg-target.h +0 -109
121 lines not on this page · raw message
tcg/arm/tcg-target-has.h new file +85 -0
85 lines not on this page · raw message
tcg/arm/tcg-target.h +0 -74
86 lines not on this page · raw message
tcg/i386/tcg-target-has.h new file +139 -0
139 lines not on this page · raw message
tcg/i386/tcg-target.h +0 -129
141 lines not on this page · raw message
tcg/loongarch64/tcg-target-has.h new file +113 -0
113 lines not on this page · raw message
tcg/loongarch64/tcg-target.h +0 -102
114 lines not on this page · raw message
tcg/mips/tcg-target-has.h new file +122 -0
122 lines not on this page · raw message
tcg/mips/tcg-target.h +0 -112
118 lines not on this page · raw message
tcg/ppc/tcg-target-has.h new file +124 -0
124 lines not on this page · raw message
tcg/ppc/tcg-target.h +0 -122
134 lines not on this page · raw message
tcg/riscv/tcg-target-has.h new file +112 -0
112 lines not on this page · raw message
tcg/riscv/tcg-target.h +0 -102
114 lines not on this page · raw message
tcg/s390x/tcg-target-has.h new file +124 -0
124 lines not on this page · raw message
tcg/s390x/tcg-target.h +0 -114
120 lines not on this page · raw message
tcg/sparc64/tcg-target-has.h new file +86 -0
86 lines not on this page · raw message
tcg/sparc64/tcg-target.h +0 -76
82 lines not on this page · raw message
tcg/tcg-has.h new file +117 -0
117 lines not on this page · raw message
tcg/tci/tcg-target-has.h new file +83 -0
83 lines not on this page · raw message
tcg/tci/tcg-target.h +0 -75
81 lines not on this page · raw message
tcg/optimize.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/interval-tree.h" #include "tcg/tcg-op-common.h" #include "tcg-internal.h" +#include "tcg-has.h" #define CASE_OP_32_64 (x) \ glue(glue(case INDEX_op_, x), _i32): \
tcg/tcg-common.c +1 -0
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "tcg/tcg.h" +#include "tcg-has.h" TCGOpDef tcg_op_defs[] = { #define DEF(s, oargs, iargs, cargs, flags) \
tcg/tcg-op-gvec.c +1 -0
@@ -23,6 +23,7 @@#include "tcg/tcg-op-common.h" #include "tcg/tcg-op-gvec-common.h" #include "tcg/tcg-gvec-desc.h" +#include "tcg-has.h" #define MAX_UNROLL 4
tcg/tcg-op-ldst.c +1 -1
@@ -30,7 +30,7 @@#include "exec/translation-block.h" #include "exec/plugin-gen.h" #include "tcg-internal.h" - +#include "tcg-has.h" static void check_max_alignment (unsigned a_bits) {
tcg/tcg-op-vec.c +1 -0
@@ -23,6 +23,7 @@#include "tcg/tcg-op-common.h" #include "tcg/tcg-mo.h" #include "tcg-internal.h" +#include "tcg-has.h" /* * Vector optional opcode tracking.
tcg/tcg-op.c +1 -1
@@ -29,7 +29,7 @@#include "exec/translation-block.h" #include "exec/plugin-gen.h" #include "tcg-internal.h" - +#include "tcg-has.h" /* * Encourage the compiler to tail-call to a function, rather than inlining.
tcg/tcg.c +1 -0
@@ -56,6 +56,7 @@#include "tcg/tcg-temp-internal.h" #include "tcg-internal.h" #include "tcg/perf.h" +#include "tcg-has.h" #ifdef CONFIG_USER_ONLY #include "user/guest-base.h" #endif
tcg/tci.c +1 -0
@@ -22,6 +22,7 @@#include "tcg/helper-info.h" #include "tcg/tcg-ldst.h" #include "disas/dis-asm.h" +#include "tcg-has.h" #include <ffi.h>
Signature · 1 line
2.43.0
v3 cover tcg: Split out tcg-target-has.h and tcg-has.h
Split of <[email protected]> patch in multiple ones simpler to review (in particular using git-diff --color-moved=dimmed-zebra option).
Richard Henderson (14):
tcg/ppc: Remove TCGPowerISA enum
tcg: Extract default TCG_TARGET_HAS_foo definitions to 'tcg-has.h' tcg/aarch64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/arm: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/i386: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/loongarch64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/mips: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/ppc: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/riscv: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/s390x: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/sparc64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' tcg/tci: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
tcg: Include 'tcg-target-has.h' once in 'tcg-has.h'
tcg: Only include 'tcg-has.h' when necessary
include/tcg/tcg.h | 105 ----------------------- tcg/aarch64/tcg-target-has.h | 119 ++++++++++++++++++++++++++ tcg/aarch64/tcg-target.h | 109 ------------------------ tcg/arm/tcg-target-has.h | 85 +++++++++++++++++++ tcg/arm/tcg-target.h | 74 ---------------- tcg/i386/tcg-target-has.h | 139 +++++++++++++++++++++++++++++++ tcg/i386/tcg-target.h | 129 ---------------------------- tcg/loongarch64/tcg-target-has.h | 113 +++++++++++++++++++++++++ tcg/loongarch64/tcg-target.h | 102 ----------------------- tcg/mips/tcg-target-has.h | 122 +++++++++++++++++++++++++++ tcg/mips/tcg-target.h | 112 ------------------------- tcg/ppc/tcg-target-has.h | 124 +++++++++++++++++++++++++++ tcg/ppc/tcg-target.h | 122 --------------------------- tcg/riscv/tcg-target-has.h | 112 +++++++++++++++++++++++++ tcg/riscv/tcg-target.h | 102 ----------------------- tcg/s390x/tcg-target-has.h | 124 +++++++++++++++++++++++++++ tcg/s390x/tcg-target.h | 114 ------------------------- tcg/sparc64/tcg-target-has.h | 86 +++++++++++++++++++ tcg/sparc64/tcg-target.h | 76 ----------------- tcg/tcg-has.h | 117 ++++++++++++++++++++++++++ tcg/tci/tcg-target-has.h | 83 ++++++++++++++++++ tcg/tci/tcg-target.h | 75 ----------------- tcg/optimize.c | 1 + tcg/tcg-common.c | 1 + tcg/tcg-op-gvec.c | 1 + tcg/tcg-op-ldst.c | 2 +- tcg/tcg-op-vec.c | 1 + tcg/tcg-op.c | 2 +- tcg/tcg.c | 1 + tcg/tci.c | 1 + 30 files changed, 1232 insertions(+), 1122 deletions(-) create mode 100644 tcg/aarch64/tcg-target-has.h create mode 100644 tcg/arm/tcg-target-has.h create mode 100644 tcg/i386/tcg-target-has.h create mode 100644 tcg/loongarch64/tcg-target-has.h create mode 100644 tcg/mips/tcg-target-has.h create mode 100644 tcg/ppc/tcg-target-has.h create mode 100644 tcg/riscv/tcg-target-has.h create mode 100644 tcg/s390x/tcg-target-has.h create mode 100644 tcg/sparc64/tcg-target-has.h create mode 100644 tcg/tcg-has.h create mode 100644 tcg/tci/tcg-target-has.h
Signature · 1 line
2.47.1
PATCH v3 1/14 tcg/ppc: Remove TCGPowerISA enum
From: Richard Henderson <[email protected]>
Left-over from commit 623d7e3551a ("util: Add cpuinfo-ppc.c").
--- tcg/ppc/tcg-target.h | 8 -------- 1 file changed, 8 deletions(-)
tcg/ppc/tcg-target.h +0 -8
@@ -55,14 +55,6 @@ typedef enum { TCG_AREG0 = TCG_REG_R27 } TCGReg; -typedef enum { - tcg_isa_base, - tcg_isa_2_06, - tcg_isa_2_07, - tcg_isa_3_00, - tcg_isa_3_10, -}TCGPowerISA ; -#define have_isa_2_06 (cpuinfo & CPUINFO_V2_06)#define have_isa_2_07 (cpuinfo & CPUINFO_V2_07)#define have_isa_3_00 (cpuinfo & CPUINFO_V3_0)
Signature · 1 line
2.47.1
PATCH v3 2/14 tcg: Extract default TCG_TARGET_HAS_foo definitions to 'tcg-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- include/tcg/tcg.h | 105 +----------------------------------------- tcg/tcg-has.h | 115 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 104 deletions(-) create mode 100644 tcg/tcg-has.h
include/tcg/tcg.h +1 -104
@@ -64,110 +64,7 @@ typedef uint64_t TCGRegSet;#error unsupported#endif -#if TCG_TARGET_REG_BITS ==32 -/* Turn some undef macros into false macros. */ -#define TCG_TARGET_HAS_extr_i64_i32 0 -#define TCG_TARGET_HAS_div_i64 0 -#define TCG_TARGET_HAS_rem_i64 0 -#define TCG_TARGET_HAS_div2_i64 0 -#define TCG_TARGET_HAS_rot_i64 0 -#define TCG_TARGET_HAS_ext8s_i64 0 -#define TCG_TARGET_HAS_ext16s_i64 0 -#define TCG_TARGET_HAS_ext32s_i64 0 -#define TCG_TARGET_HAS_ext8u_i64 0 -#define TCG_TARGET_HAS_ext16u_i64 0 -#define TCG_TARGET_HAS_ext32u_i64 0 -#define TCG_TARGET_HAS_bswap16_i64 0 -#define TCG_TARGET_HAS_bswap32_i64 0 -#define TCG_TARGET_HAS_bswap64_i64 0 -#define TCG_TARGET_HAS_not_i64 0 -#define TCG_TARGET_HAS_andc_i64 0 -#define TCG_TARGET_HAS_orc_i64 0 -#define TCG_TARGET_HAS_eqv_i64 0 -#define TCG_TARGET_HAS_nand_i64 0 -#define TCG_TARGET_HAS_nor_i64 0 -#define TCG_TARGET_HAS_clz_i64 0 -#define TCG_TARGET_HAS_ctz_i64 0 -#define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 -#define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_negsetcond_i64 0 -#define TCG_TARGET_HAS_add2_i64 0 -#define TCG_TARGET_HAS_sub2_i64 0 -#define TCG_TARGET_HAS_mulu2_i64 0 -#define TCG_TARGET_HAS_muls2_i64 0 -#define TCG_TARGET_HAS_muluh_i64 0 -#define TCG_TARGET_HAS_mulsh_i64 0 -/* Turn some undef macros into true macros. */ -#define TCG_TARGET_HAS_add2_i32 1 -#define TCG_TARGET_HAS_sub2_i32 1 -#endif - -#ifndef TCG_TARGET_deposit_i32_valid -#define TCG_TARGET_deposit_i32_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_deposit_i64_valid -#define TCG_TARGET_deposit_i64_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_extract_i32_valid -#define TCG_TARGET_extract_i32_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_extract_i64_valid -#define TCG_TARGET_extract_i64_valid (ofs, len) 1 -#endif - -/* Only one of DIV or DIV2 should be defined. */ -#if defined(TCG_TARGET_HAS_div_i32) -#define TCG_TARGET_HAS_div2_i32 0 -#elif defined(TCG_TARGET_HAS_div2_i32) -#define TCG_TARGET_HAS_div_i32 0 -#define TCG_TARGET_HAS_rem_i32 0 -#endif -#if defined(TCG_TARGET_HAS_div_i64) -#define TCG_TARGET_HAS_div2_i64 0 -#elif defined(TCG_TARGET_HAS_div2_i64) -#define TCG_TARGET_HAS_div_i64 0 -#define TCG_TARGET_HAS_rem_i64 0 -#endif - -#if !defined(TCG_TARGET_HAS_v64) \ - && !defined(TCG_TARGET_HAS_v128) \ - && !defined(TCG_TARGET_HAS_v256) -#define TCG_TARGET_MAYBE_vec 0 -#define TCG_TARGET_HAS_abs_vec 0 -#define TCG_TARGET_HAS_neg_vec 0 -#define TCG_TARGET_HAS_not_vec 0 -#define TCG_TARGET_HAS_andc_vec 0 -#define TCG_TARGET_HAS_orc_vec 0 -#define TCG_TARGET_HAS_nand_vec 0 -#define TCG_TARGET_HAS_nor_vec 0 -#define TCG_TARGET_HAS_eqv_vec 0 -#define TCG_TARGET_HAS_roti_vec 0 -#define TCG_TARGET_HAS_rots_vec 0 -#define TCG_TARGET_HAS_rotv_vec 0 -#define TCG_TARGET_HAS_shi_vec 0 -#define TCG_TARGET_HAS_shs_vec 0 -#define TCG_TARGET_HAS_shv_vec 0 -#define TCG_TARGET_HAS_mul_vec 0 -#define TCG_TARGET_HAS_sat_vec 0 -#define TCG_TARGET_HAS_minmax_vec 0 -#define TCG_TARGET_HAS_bitsel_vec 0 -#define TCG_TARGET_HAS_cmpsel_vec 0 -#define TCG_TARGET_HAS_tst_vec 0 -#else -#define TCG_TARGET_MAYBE_vec 1 -#endif -#ifndef TCG_TARGET_HAS_v64 -#define TCG_TARGET_HAS_v64 0 -#endif -#ifndef TCG_TARGET_HAS_v128 -#define TCG_TARGET_HAS_v128 0 -#endif -#ifndef TCG_TARGET_HAS_v256 -#define TCG_TARGET_HAS_v256 0 -#endif +#include "tcg/tcg-has.h" typedef enum TCGOpcode { #define DEF(name, oargs, iargs, cargs, flags) INDEX_op_ ## name,
tcg/tcg-has.h new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 3/14 tcg/aarch64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/aarch64/tcg-target-has.h | 119 +++++++++++++++++++++++++++++++++++ tcg/aarch64/tcg-target.h | 109 +------------------------------- 2 files changed, 120 insertions(+), 108 deletions(-) create mode 100644 tcg/aarch64/tcg-target-has.h
tcg/aarch64/tcg-target-has.h new file +119 -0
@@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Define target-specific opcode support +* Copyright (c) 2013 Huawei Technologies Duesseldorf GmbH +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#include "host/cpuinfo.h" + +#define have_lse (cpuinfo & CPUINFO_LSE) +#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_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_rot_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_orc_i32 1 +#define TCG_TARGET_HAS_eqv_i32 1 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 +#define TCG_TARGET_HAS_extract2_i32 1 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#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_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_rot_i64 1 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_orc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 1 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1 +#define TCG_TARGET_HAS_extract2_i64 1 +#define TCG_TARGET_HAS_negsetcond_i64 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 + +/* +* Without FEAT_LSE2, we must use LDXP+STXP to implement atomic 128-bit load, +* which requires writable pages. We must defer to the helper for user-only, +* but in system mode all ram is writable for the host. +*/ +#ifdef CONFIG_USER_ONLY +#define TCG_TARGET_HAS_qemu_ldst_i128 have_lse2 +#else +#define TCG_TARGET_HAS_qemu_ldst_i128 1 +#endif + +#define TCG_TARGET_HAS_tst 1 + +#define TCG_TARGET_HAS_v64 1 +#define TCG_TARGET_HAS_v128 1 +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec 1 +#define TCG_TARGET_HAS_nand_vec 0 +#define TCG_TARGET_HAS_nor_vec 0 +#define TCG_TARGET_HAS_eqv_vec 0 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 1 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec 1 +#define TCG_TARGET_HAS_cmpsel_vec 0 +#define TCG_TARGET_HAS_tst_vec 1 + +#endif
tcg/aarch64/tcg-target.h +1 -108
121 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 4/14 tcg/arm: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/arm/tcg-target-has.h | 85 ++++++++++++++++++++++++++++++++++++++++ tcg/arm/tcg-target.h | 74 +--------------------------------- 2 files changed, 86 insertions(+), 73 deletions(-) create mode 100644 tcg/arm/tcg-target-has.h
tcg/arm/tcg-target-has.h new file +85 -0
@@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2008 Fabrice Bellard +* Copyright (c) 2008 Andrzej Zaborowski +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +extern int arm_arch; + +#define use_armv7_instructions (__ARM_ARCH >= 7 || arm_arch >= 7) + +#ifdef __ARM_ARCH_EXT_IDIV__ +#define use_idiv_instructions 1 +#else +extern bool use_idiv_instructions; +#endif +#ifdef __ARM_NEON__ +#define use_neon_instructions 1 +#else +extern bool use_neon_instructions; +#endif + +/* optional instructions */ +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 0/* and r0, r1, #0xff */ +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_rot_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_orc_i32 0 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 use_armv7_instructions +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions +#define TCG_TARGET_HAS_extract_i32 use_armv7_instructions +#define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions +#define TCG_TARGET_HAS_extract2_i32 1 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 1 +#define TCG_TARGET_HAS_muls2_i32 1 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_div_i32 use_idiv_instructions +#define TCG_TARGET_HAS_rem_i32 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#define TCG_TARGET_HAS_qemu_ldst_i128 0 + +#define TCG_TARGET_HAS_tst 1 + +#define TCG_TARGET_HAS_v64 use_neon_instructions +#define TCG_TARGET_HAS_v128 use_neon_instructions +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec 1 +#define TCG_TARGET_HAS_nand_vec 0 +#define TCG_TARGET_HAS_nor_vec 0 +#define TCG_TARGET_HAS_eqv_vec 0 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 0 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec 1 +#define TCG_TARGET_HAS_cmpsel_vec 0 +#define TCG_TARGET_HAS_tst_vec 1 + +#endif
tcg/arm/tcg-target.h +1 -73
86 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 5/14 tcg/i386: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/i386/tcg-target-has.h | 139 ++++++++++++++++++++++++++++++++++++++ tcg/i386/tcg-target.h | 129 +---------------------------------- 2 files changed, 140 insertions(+), 128 deletions(-) create mode 100644 tcg/i386/tcg-target-has.h
tcg/i386/tcg-target-has.h new file +139 -0
@@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#include "host/cpuinfo.h" + +#define have_bmi1 (cpuinfo & CPUINFO_BMI1) +#define have_popcnt (cpuinfo & CPUINFO_POPCNT) +#define have_avx1 (cpuinfo & CPUINFO_AVX1) +#define have_avx2 (cpuinfo & CPUINFO_AVX2) +#define have_movbe (cpuinfo & CPUINFO_MOVBE) + +/* +* There are interesting instructions in AVX512, so long as we have AVX512VL, +* which indicates support for EVEX on sizes smaller than 512 bits. +*/ +#define have_avx512vl ((cpuinfo & CPUINFO_AVX512VL) && \ + (cpuinfo & CPUINFO_AVX512F)) +#define have_avx512bw ((cpuinfo & CPUINFO_AVX512BW) && have_avx512vl) +#define have_avx512dq ((cpuinfo & CPUINFO_AVX512DQ) && have_avx512vl) +#define have_avx512vbmi2 ((cpuinfo & CPUINFO_AVX512VBMI2) && have_avx512vl) + +/* optional instructions */ +#define TCG_TARGET_HAS_div2_i32 1 +#define TCG_TARGET_HAS_rot_i32 1 +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_andc_i32 have_bmi1 +#define TCG_TARGET_HAS_orc_i32 0 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 have_popcnt +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 +#define TCG_TARGET_HAS_extract2_i32 1 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 1 +#define TCG_TARGET_HAS_muls2_i32 1 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 + +#if TCG_TARGET_REG_BITS ==64 +/* Keep 32-bit values zero-extended in a register. */ +#define TCG_TARGET_HAS_extr_i64_i32 1 +#define TCG_TARGET_HAS_div2_i64 1 +#define TCG_TARGET_HAS_rot_i64 1 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_andc_i64 have_bmi1 +#define TCG_TARGET_HAS_orc_i64 0 +#define TCG_TARGET_HAS_eqv_i64 0 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 have_popcnt +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 1 +#define TCG_TARGET_HAS_negsetcond_i64 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 1 +#define TCG_TARGET_HAS_muls2_i64 1 +#define TCG_TARGET_HAS_muluh_i64 0 +#define TCG_TARGET_HAS_mulsh_i64 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 +#else +#define TCG_TARGET_HAS_qemu_st8_i32 1 +#endif + +#define TCG_TARGET_HAS_qemu_ldst_i128 \ + (TCG_TARGET_REG_BITS == 64 && (cpuinfo & CPUINFO_ATOMIC_VMOVDQA)) + +#define TCG_TARGET_HAS_tst 1 + +/* We do not support older SSE systems, only beginning with AVX1. */ +#define TCG_TARGET_HAS_v64 have_avx1 +#define TCG_TARGET_HAS_v128 have_avx1 +#define TCG_TARGET_HAS_v256 have_avx2 + +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec have_avx512vl +#define TCG_TARGET_HAS_nand_vec have_avx512vl +#define TCG_TARGET_HAS_nor_vec have_avx512vl +#define TCG_TARGET_HAS_eqv_vec have_avx512vl +#define TCG_TARGET_HAS_not_vec have_avx512vl +#define TCG_TARGET_HAS_neg_vec 0 +#define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec have_avx512vl +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec have_avx512vl +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 1 +#define TCG_TARGET_HAS_shv_vec have_avx2 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec have_avx512vl +#define TCG_TARGET_HAS_cmpsel_vec 1 +#define TCG_TARGET_HAS_tst_vec have_avx512bw + +#define TCG_TARGET_deposit_i32_valid (ofs, len) \ + (((ofs) == 0 && ((len) == 8 || (len) == 16)) || \ + (TCG_TARGET_REG_BITS == 32 && (ofs) == 8 && (len) == 8)) +#define TCG_TARGET_deposit_i64_valid TCG_TARGET_deposit_i32_valid + +/* Check for the possibility of high-byte extraction and, for 64-bit, +zero-extending 32-bit right-shift. */ +#define TCG_TARGET_extract_i32_valid (ofs, len) ((ofs) == 8 && (len) == 8) +#define TCG_TARGET_extract_i64_valid (ofs, len) \ + (((ofs) == 8 && (len) == 8) || ((ofs) + (len)) == 32) + +#endif
tcg/i386/tcg-target.h +1 -128
141 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 6/14 tcg/loongarch64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/loongarch64/tcg-target-has.h | 113 +++++++++++++++++++++++++++++++ tcg/loongarch64/tcg-target.h | 102 +--------------------------- 2 files changed, 114 insertions(+), 101 deletions(-) create mode 100644 tcg/loongarch64/tcg-target-has.h
tcg/loongarch64/tcg-target-has.h new file +113 -0
@@ -0,0 +1,113 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2021 WANG Xuerui <[email protected]> +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#include "host/cpuinfo.h" + +/* 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 +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_add2_i32 0 +#define TCG_TARGET_HAS_sub2_i32 0 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 1 +#define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_orc_i32 1 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 1 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_brcond2 0 +#define TCG_TARGET_HAS_setcond2 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +/* 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 +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_extr_i64_i32 1 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_orc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 0 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 1 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_add2_i64 0 +#define TCG_TARGET_HAS_sub2_i64 0 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 + +#define TCG_TARGET_HAS_qemu_ldst_i128 (cpuinfo & CPUINFO_LSX) + +#define TCG_TARGET_HAS_tst 0 + +#define TCG_TARGET_HAS_v64 (cpuinfo & CPUINFO_LSX) +#define TCG_TARGET_HAS_v128 (cpuinfo & CPUINFO_LSX) +#define TCG_TARGET_HAS_v256 (cpuinfo & CPUINFO_LASX) + +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec 1 +#define TCG_TARGET_HAS_nand_vec 0 +#define TCG_TARGET_HAS_nor_vec 1 +#define TCG_TARGET_HAS_eqv_vec 0 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 1 +#define TCG_TARGET_HAS_roti_vec 1 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec 1 +#define TCG_TARGET_HAS_cmpsel_vec 0 +#define TCG_TARGET_HAS_tst_vec 0 + + +#endif
tcg/loongarch64/tcg-target.h +1 -101
114 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 7/14 tcg/mips: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/mips/tcg-target-has.h | 122 ++++++++++++++++++++++++++++++++++++++ tcg/mips/tcg-target.h | 112 +--------------------------------- 2 files changed, 123 insertions(+), 111 deletions(-) create mode 100644 tcg/mips/tcg-target-has.h
tcg/mips/tcg-target-has.h new file +122 -0
@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2008-2009 Arnaud Patard <[email protected]> +* Copyright (c) 2009 Aurelien Jarno <[email protected]> +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +/* MOVN/MOVZ instructions detection */ +#if (defined(__mips_isa_rev) && (__mips_isa_rev >=1 )) || \ + defined(_MIPS_ARCH_LOONGSON2E) || defined(_MIPS_ARCH_LOONGSON2F) || \ + defined(_MIPS_ARCH_MIPS4) +#define use_movnz_instructions 1 +#else +extern bool use_movnz_instructions; +#endif + +/* MIPS32 instruction set detection */ +#if defined(__mips_isa_rev) && (__mips_isa_rev >=1 ) +#define use_mips32_instructions 1 +#else +extern bool use_mips32_instructions; +#endif + +/* MIPS32R2 instruction set detection */ +#if defined(__mips_isa_rev) && (__mips_isa_rev >=2 ) +#define use_mips32r2_instructions 1 +#else +extern bool use_mips32r2_instructions; +#endif + +/* MIPS32R6 instruction set detection */ +#if defined(__mips_isa_rev) && (__mips_isa_rev >=6 ) +#define use_mips32r6_instructions 1 +#else +#define use_mips32r6_instructions 0 +#endif + +/* optional instructions */ +#define TCG_TARGET_HAS_div_i32 1 +#define TCG_TARGET_HAS_rem_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_nor_i32 1 +#define TCG_TARGET_HAS_andc_i32 0 +#define TCG_TARGET_HAS_orc_i32 0 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_mulu2_i32 (!use_mips32r6_instructions) +#define TCG_TARGET_HAS_muls2_i32 (!use_mips32r6_instructions) +#define TCG_TARGET_HAS_muluh_i32 1 +#define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_negsetcond_i32 0 + +#if TCG_TARGET_REG_BITS ==64 +#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_not_i64 1 +#define TCG_TARGET_HAS_nor_i64 1 +#define TCG_TARGET_HAS_andc_i64 0 +#define TCG_TARGET_HAS_orc_i64 0 +#define TCG_TARGET_HAS_eqv_i64 0 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_add2_i64 0 +#define TCG_TARGET_HAS_sub2_i64 0 +#define TCG_TARGET_HAS_mulu2_i64 (!use_mips32r6_instructions) +#define TCG_TARGET_HAS_muls2_i64 (!use_mips32r6_instructions) +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_negsetcond_i64 0 +#endif + +/* optional instructions detected at runtime */ +#define TCG_TARGET_HAS_bswap16_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_ext8s_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_ext16s_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_rot_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_clz_i32 use_mips32r2_instructions +#define TCG_TARGET_HAS_ctz_i32 0 +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#if TCG_TARGET_REG_BITS ==64 +#define TCG_TARGET_HAS_bswap16_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_bswap32_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_bswap64_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_deposit_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_extract_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_ext8s_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_ext16s_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_rot_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_clz_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_ctz_i64 0 +#define TCG_TARGET_HAS_ctpop_i64 0 +#endif + +/* optional instructions automatically implemented */ +#define TCG_TARGET_HAS_ext8u_i32 0/* andi rt, rs, 0xff */ +#define TCG_TARGET_HAS_ext16u_i32 0/* andi rt, rs, 0xffff */ + +#if TCG_TARGET_REG_BITS ==64 +#define TCG_TARGET_HAS_ext8u_i64 0/* andi rt, rs, 0xff */ +#define TCG_TARGET_HAS_ext16u_i64 0/* andi rt, rs, 0xffff */ +#endif + +#define TCG_TARGET_HAS_qemu_ldst_i128 0 +#define TCG_TARGET_HAS_tst 0 + +#endif
tcg/mips/tcg-target.h +1 -111
118 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 8/14 tcg/ppc: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/ppc/tcg-target-has.h | 124 +++++++++++++++++++++++++++++++++++++++ tcg/ppc/tcg-target.h | 114 +---------------------------------- 2 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 tcg/ppc/tcg-target-has.h
tcg/ppc/tcg-target-has.h new file +124 -0
@@ -0,0 +1,124 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#include "host/cpuinfo.h" + +#define have_isa_2_06 (cpuinfo & CPUINFO_V2_06) +#define have_isa_2_07 (cpuinfo & CPUINFO_V2_07) +#define have_isa_3_00 (cpuinfo & CPUINFO_V3_0) +#define have_isa_3_10 (cpuinfo & CPUINFO_V3_1) +#define have_altivec (cpuinfo & CPUINFO_ALTIVEC) +#define have_vsx (cpuinfo & CPUINFO_VSX) + +/* optional instructions automatically implemented */ +#define TCG_TARGET_HAS_ext8u_i32 0/* andi */ +#define TCG_TARGET_HAS_ext16u_i32 0 + +/* 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_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_orc_i32 1 +#define TCG_TARGET_HAS_eqv_i32 1 +#define TCG_TARGET_HAS_nand_i32 1 +#define TCG_TARGET_HAS_nor_i32 1 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 have_isa_3_00 +#define TCG_TARGET_HAS_ctpop_i32 have_isa_2_06 +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 1 +#define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#if TCG_TARGET_REG_BITS ==64 +#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_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 0 +#define TCG_TARGET_HAS_ext16u_i64 0 +#define TCG_TARGET_HAS_ext32u_i64 0 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_orc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 1 +#define TCG_TARGET_HAS_nand_i64 1 +#define TCG_TARGET_HAS_nor_i64 1 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 have_isa_3_00 +#define TCG_TARGET_HAS_ctpop_i64 have_isa_2_06 +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_negsetcond_i64 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 +#endif + +#define TCG_TARGET_HAS_qemu_ldst_i128 \ + (TCG_TARGET_REG_BITS == 64 && have_isa_2_07) + +#define TCG_TARGET_HAS_tst 1 + +/* +* While technically Altivec could support V64, it has no 64-bit store +* instruction and substituting two 32-bit stores makes the generated +* code quite large. +*/ +#define TCG_TARGET_HAS_v64 have_vsx +#define TCG_TARGET_HAS_v128 have_altivec +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec have_isa_2_07 +#define TCG_TARGET_HAS_nand_vec have_isa_2_07 +#define TCG_TARGET_HAS_nor_vec 1 +#define TCG_TARGET_HAS_eqv_vec have_isa_2_07 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec have_isa_3_00 +#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 1 +#define TCG_TARGET_HAS_shi_vec 0 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 1 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec have_vsx +#define TCG_TARGET_HAS_cmpsel_vec 1 +#define TCG_TARGET_HAS_tst_vec 0 + +#endif
tcg/ppc/tcg-target.h +1 -113
126 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 9/14 tcg/riscv: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/riscv/tcg-target-has.h | 112 +++++++++++++++++++++++++++++++++++++ tcg/riscv/tcg-target.h | 102 +-------------------------------- 2 files changed, 113 insertions(+), 101 deletions(-) create mode 100644 tcg/riscv/tcg-target-has.h
tcg/riscv/tcg-target-has.h new file +112 -0
@@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2018 SiFive, Inc +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#include "host/cpuinfo.h" + +/* optional instructions */ +#define TCG_TARGET_HAS_negsetcond_i32 1 +#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 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_deposit_i32 0 +#define TCG_TARGET_HAS_extract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_bswap32_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_andc_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_orc_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_eqv_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_ctz_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_ctpop_i32 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_brcond2 1 +#define TCG_TARGET_HAS_setcond2 1 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#define TCG_TARGET_HAS_negsetcond_i64 1 +#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 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_deposit_i64 0 +#define TCG_TARGET_HAS_extract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_extr_i64_i32 1 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_bswap32_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_bswap64_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_andc_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_orc_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_eqv_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_clz_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_ctz_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_ctpop_i64 (cpuinfo & CPUINFO_ZBB) +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 + +#define TCG_TARGET_HAS_qemu_ldst_i128 0 + +#define TCG_TARGET_HAS_tst 0 + +/* vector instructions */ +#define TCG_TARGET_HAS_v64 (cpuinfo & CPUINFO_ZVE64X) +#define TCG_TARGET_HAS_v128 (cpuinfo & CPUINFO_ZVE64X) +#define TCG_TARGET_HAS_v256 (cpuinfo & CPUINFO_ZVE64X) +#define TCG_TARGET_HAS_andc_vec 0 +#define TCG_TARGET_HAS_orc_vec 0 +#define TCG_TARGET_HAS_nand_vec 0 +#define TCG_TARGET_HAS_nor_vec 0 +#define TCG_TARGET_HAS_eqv_vec 0 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_roti_vec 1 +#define TCG_TARGET_HAS_rots_vec 1 +#define TCG_TARGET_HAS_rotv_vec 1 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 1 +#define TCG_TARGET_HAS_shv_vec 1 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec 0 +#define TCG_TARGET_HAS_cmpsel_vec 1 + +#define TCG_TARGET_HAS_tst_vec 0 + +#endif
tcg/riscv/tcg-target.h +1 -101
114 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 10/14 tcg/s390x: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/s390x/tcg-target-has.h | 124 +++++++++++++++++++++++++++++++++++++ tcg/s390x/tcg-target.h | 114 +--------------------------------- 2 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 tcg/s390x/tcg-target-has.h
tcg/s390x/tcg-target-has.h new file +124 -0
@@ -0,0 +1,124 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2009 Ulrich Hecht <[email protected]> +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +/* Facilities required for proper operation; checked at startup. */ + +#define FACILITY_ZARCH_ACTIVE 2 +#define FACILITY_LONG_DISP 18 +#define FACILITY_EXT_IMM 21 +#define FACILITY_GEN_INST_EXT 34 +#define FACILITY_45 45 + +/* Facilities that are checked at runtime. */ + +#define FACILITY_LOAD_ON_COND2 53 +#define FACILITY_MISC_INSN_EXT2 58 +#define FACILITY_MISC_INSN_EXT3 61 +#define FACILITY_VECTOR 129 +#define FACILITY_VECTOR_ENH1 135 + +extern uint64_t s390_facilities[3 ]; + +#define HAVE_FACILITY (X ) \ + ((s390_facilities[FACILITY_##X / 64] >> (63 - FACILITY_##X % 64)) & 1) + +/* optional instructions */ +#define TCG_TARGET_HAS_div2_i32 1 +#define TCG_TARGET_HAS_rot_i32 1 +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_not_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_andc_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_orc_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_eqv_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nand_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nor_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_clz_i32 0 +#define TCG_TARGET_HAS_ctz_i32 0 +#define TCG_TARGET_HAS_ctpop_i32 1 +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_extr_i64_i32 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#define TCG_TARGET_HAS_div2_i64 1 +#define TCG_TARGET_HAS_rot_i64 1 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_not_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_andc_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_orc_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_eqv_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nand_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nor_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 0 +#define TCG_TARGET_HAS_ctpop_i64 1 +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_negsetcond_i64 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 1 +#define TCG_TARGET_HAS_muls2_i64 HAVE_FACILITY(MISC_INSN_EXT2) +#define TCG_TARGET_HAS_muluh_i64 0 +#define TCG_TARGET_HAS_mulsh_i64 0 + +#define TCG_TARGET_HAS_qemu_ldst_i128 1 + +#define TCG_TARGET_HAS_tst 1 + +#define TCG_TARGET_HAS_v64 HAVE_FACILITY(VECTOR) +#define TCG_TARGET_HAS_v128 HAVE_FACILITY(VECTOR) +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec HAVE_FACILITY(VECTOR_ENH1) +#define TCG_TARGET_HAS_nand_vec HAVE_FACILITY(VECTOR_ENH1) +#define TCG_TARGET_HAS_nor_vec 1 +#define TCG_TARGET_HAS_eqv_vec HAVE_FACILITY(VECTOR_ENH1) +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 1 +#define TCG_TARGET_HAS_roti_vec 1 +#define TCG_TARGET_HAS_rots_vec 1 +#define TCG_TARGET_HAS_rotv_vec 1 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 1 +#define TCG_TARGET_HAS_shv_vec 1 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 0 +#define TCG_TARGET_HAS_minmax_vec 1 +#define TCG_TARGET_HAS_bitsel_vec 1 +#define TCG_TARGET_HAS_cmpsel_vec 1 +#define TCG_TARGET_HAS_tst_vec 0 + +#endif
tcg/s390x/tcg-target.h +1 -113
120 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 11/14 tcg/sparc64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/sparc64/tcg-target-has.h | 86 ++++++++++++++++++++++++++++++++++++ tcg/sparc64/tcg-target.h | 78 +------------------------------- 2 files changed, 88 insertions(+), 76 deletions(-) create mode 100644 tcg/sparc64/tcg-target-has.h
tcg/sparc64/tcg-target-has.h new file +86 -0
@@ -0,0 +1,86 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#if defined(__VIS__) && __VIS__ >=0x300 +#define use_vis3_instructions 1 +#else +extern bool use_vis3_instructions; +#endif + +/* optional instructions */ +#define TCG_TARGET_HAS_div_i32 1 +#define TCG_TARGET_HAS_rem_i32 0 +#define TCG_TARGET_HAS_rot_i32 0 +#define TCG_TARGET_HAS_ext8s_i32 0 +#define TCG_TARGET_HAS_ext16s_i32 0 +#define TCG_TARGET_HAS_ext8u_i32 0 +#define TCG_TARGET_HAS_ext16u_i32 0 +#define TCG_TARGET_HAS_bswap16_i32 0 +#define TCG_TARGET_HAS_bswap32_i32 0 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_orc_i32 1 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 0 +#define TCG_TARGET_HAS_ctz_i32 0 +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_deposit_i32 0 +#define TCG_TARGET_HAS_extract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_negsetcond_i32 1 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 1 +#define TCG_TARGET_HAS_muls2_i32 1 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#define TCG_TARGET_HAS_extr_i64_i32 0 +#define TCG_TARGET_HAS_div_i64 1 +#define TCG_TARGET_HAS_rem_i64 0 +#define TCG_TARGET_HAS_rot_i64 0 +#define TCG_TARGET_HAS_ext8s_i64 0 +#define TCG_TARGET_HAS_ext16s_i64 0 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 0 +#define TCG_TARGET_HAS_ext16u_i64 0 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 0 +#define TCG_TARGET_HAS_bswap32_i64 0 +#define TCG_TARGET_HAS_bswap64_i64 0 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_orc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 0 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_clz_i64 0 +#define TCG_TARGET_HAS_ctz_i64 0 +#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_deposit_i64 0 +#define TCG_TARGET_HAS_extract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_negsetcond_i64 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 use_vis3_instructions +#define TCG_TARGET_HAS_mulsh_i64 0 + +#define TCG_TARGET_HAS_qemu_ldst_i128 0 + +#define TCG_TARGET_HAS_tst 1 + +#endif
tcg/sparc64/tcg-target.h +2 -76
86 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 12/14 tcg/tci: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/tci/tcg-target-has.h | 83 ++++++++++++++++++++++++++++++++++++++++ tcg/tci/tcg-target.h | 75 +----------------------------------- 2 files changed, 84 insertions(+), 74 deletions(-) create mode 100644 tcg/tci/tcg-target-has.h
tcg/tci/tcg-target-has.h new file +83 -0
@@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific opcode support +* Copyright (c) 2009, 2011 Stefan Weil +*/ + +#ifndef TCG_TARGET_HAS_H +#define TCG_TARGET_HAS_H + +#define TCG_TARGET_HAS_bswap16_i32 1 +#define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_div_i32 1 +#define TCG_TARGET_HAS_rem_i32 1 +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_andc_i32 1 +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 +#define TCG_TARGET_HAS_extract2_i32 0 +#define TCG_TARGET_HAS_eqv_i32 1 +#define TCG_TARGET_HAS_nand_i32 1 +#define TCG_TARGET_HAS_nor_i32 1 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 1 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_orc_i32 1 +#define TCG_TARGET_HAS_rot_i32 1 +#define TCG_TARGET_HAS_negsetcond_i32 0 +#define TCG_TARGET_HAS_muls2_i32 1 +#define TCG_TARGET_HAS_muluh_i32 0 +#define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_qemu_st8_i32 0 + +#if TCG_TARGET_REG_BITS ==64 +#define TCG_TARGET_HAS_extr_i64_i32 0 +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1 +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1 +#define TCG_TARGET_HAS_extract2_i64 0 +#define TCG_TARGET_HAS_div_i64 1 +#define TCG_TARGET_HAS_rem_i64 1 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 1 +#define TCG_TARGET_HAS_nand_i64 1 +#define TCG_TARGET_HAS_nor_i64 1 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 1 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_orc_i64 1 +#define TCG_TARGET_HAS_rot_i64 1 +#define TCG_TARGET_HAS_negsetcond_i64 0 +#define TCG_TARGET_HAS_muls2_i64 1 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1 +#define TCG_TARGET_HAS_mulu2_i32 1 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1 +#define TCG_TARGET_HAS_mulu2_i64 1 +#define TCG_TARGET_HAS_muluh_i64 0 +#define TCG_TARGET_HAS_mulsh_i64 0 +#else +#define TCG_TARGET_HAS_mulu2_i32 1 +#endif /* TCG_TARGET_REG_BITS == 64 */ + +#define TCG_TARGET_HAS_qemu_ldst_i128 0 + +#define TCG_TARGET_HAS_tst 1 + +#endif
tcg/tci/tcg-target.h +1 -74
81 lines not on this page · raw message
Signature · 1 line
2.47.1
PATCH v3 13/14 tcg: Include 'tcg-target-has.h' once in 'tcg-has.h'
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
--- tcg/aarch64/tcg-target.h | 2 -- tcg/arm/tcg-target.h | 2 -- tcg/i386/tcg-target.h | 2 -- tcg/loongarch64/tcg-target.h | 2 -- tcg/mips/tcg-target.h | 2 -- tcg/ppc/tcg-target.h | 2 -- tcg/riscv/tcg-target.h | 2 -- tcg/s390x/tcg-target.h | 2 -- tcg/sparc64/tcg-target.h | 2 -- tcg/tcg-has.h | 2 ++ tcg/tci/tcg-target.h | 2 -- 11 files changed, 2 insertions(+), 20 deletions(-)
tcg/aarch64/tcg-target.h +0 -2
@@ -47,8 +47,6 @@ typedef enum {#define TCG_TARGET_NB_REGS 64 -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif /* AARCH64_TCG_TARGET_H */
tcg/arm/tcg-target.h +0 -2
@@ -70,8 +70,6 @@ typedef enum {#define TCG_TARGET_NB_REGS 32 -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif
tcg/i386/tcg-target.h +0 -2
@@ -88,8 +88,6 @@ typedef enum { TCG_REG_CALL_STACK = TCG_REG_ESP } TCGReg; -#include "tcg-target-has.h" -/* This defines the natural memory order supported by this * architecture before guarantees made by various barrier * instructions.
tcg/loongarch64/tcg-target.h +0 -2
@@ -85,8 +85,6 @@ typedef enum {TCG_VEC_TMP0 =TCG_REG_V23 , } TCGReg; -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif /* LOONGARCH_TCG_TARGET_H */
tcg/mips/tcg-target.h +0 -2
@@ -70,8 +70,6 @@ typedef enum {TCG_AREG0 =TCG_REG_S8 , } TCGReg; -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO 0#endif
tcg/ppc/tcg-target.h +0 -2
@@ -53,8 +53,6 @@ typedef enum {TCG_AREG0 =TCG_REG_R27 } TCGReg; -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif
tcg/riscv/tcg-target.h +0 -2
@@ -57,8 +57,6 @@ typedef enum {TCG_REG_TMP2 =TCG_REG_T4 , } TCGReg; -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif
tcg/s390x/tcg-target.h +0 -2
@@ -51,8 +51,6 @@ typedef enum TCGReg {#define TCG_TARGET_NB_REGS 64 -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)#endif
tcg/sparc64/tcg-target.h +0 -2
@@ -66,8 +66,6 @@ typedef enum {#define TCG_AREG0 TCG_REG_I0 -#include "tcg-target-has.h" -#define TCG_TARGET_DEFAULT_MO (0)#endif
tcg/tcg-has.h +2 -0
@@ -7,6 +7,8 @@#ifndef TCG_HAS_H #define TCG_HAS_H +#include "tcg-target-has.h" +#if TCG_TARGET_REG_BITS ==32 /* Turn some undef macros into false macros. */ #define TCG_TARGET_HAS_extr_i64_i32 0
tcg/tci/tcg-target.h +0 -2
@@ -44,8 +44,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1) -#include "tcg-target-has.h" -/* Number of registers available. */ #define TCG_TARGET_NB_REGS 16
Signature · 1 line
2.47.1
PATCH v3 14/14 tcg: Only include 'tcg-has.h' when necessary
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
TCG_TARGET_HAS_* definitions don't need to be exposed by "tcg/tcg.h". Only include 'tcg-has.h' when necessary.
--- include/tcg/tcg.h | 2 -- tcg/optimize.c | 1 + tcg/tcg-common.c | 1 + tcg/tcg-op-gvec.c | 1 + tcg/tcg-op-ldst.c | 2 +- tcg/tcg-op-vec.c | 1 + tcg/tcg-op.c | 2 +- tcg/tcg.c | 1 + tcg/tci.c | 1 + 9 files changed, 8 insertions(+), 4 deletions(-)
include/tcg/tcg.h +0 -2
@@ -64,8 +64,6 @@ typedef uint64_t TCGRegSet;#error unsupported#endif -#include "tcg/tcg-has.h" - typedef enum TCGOpcode { #define DEF(name, oargs, iargs, cargs, flags) INDEX_op_ ## name,#include "tcg/tcg-opc.h"
tcg/optimize.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/interval-tree.h" #include "tcg/tcg-op-common.h" #include "tcg-internal.h" +#include "tcg-has.h" #define CASE_OP_32_64 (x) \ glue(glue(case INDEX_op_, x), _i32): \
tcg/tcg-common.c +1 -0
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "tcg/tcg.h" +#include "tcg-has.h" TCGOpDef tcg_op_defs[] = { #define DEF(s, oargs, iargs, cargs, flags) \
tcg/tcg-op-gvec.c +1 -0
@@ -23,6 +23,7 @@#include "tcg/tcg-op-common.h" #include "tcg/tcg-op-gvec-common.h" #include "tcg/tcg-gvec-desc.h" +#include "tcg-has.h" #define MAX_UNROLL 4
tcg/tcg-op-ldst.c +1 -1
@@ -30,7 +30,7 @@#include "exec/translation-block.h" #include "exec/plugin-gen.h" #include "tcg-internal.h" - +#include "tcg-has.h" static void check_max_alignment (unsigned a_bits) {
tcg/tcg-op-vec.c +1 -0
@@ -23,6 +23,7 @@#include "tcg/tcg-op-common.h" #include "tcg/tcg-mo.h" #include "tcg-internal.h" +#include "tcg-has.h" /* * Vector optional opcode tracking.
tcg/tcg-op.c +1 -1
@@ -29,7 +29,7 @@#include "exec/translation-block.h" #include "exec/plugin-gen.h" #include "tcg-internal.h" - +#include "tcg-has.h" /* * Encourage the compiler to tail-call to a function, rather than inlining.
tcg/tcg.c +1 -0
@@ -56,6 +56,7 @@#include "tcg/tcg-temp-internal.h" #include "tcg-internal.h" #include "tcg/perf.h" +#include "tcg-has.h" #ifdef CONFIG_USER_ONLY #include "user/guest-base.h" #endif
tcg/tci.c +1 -0
@@ -22,6 +22,7 @@#include "tcg/helper-info.h" #include "tcg/tcg-ldst.h" #include "disas/dis-asm.h" +#include "tcg-has.h" #include <ffi.h>
Signature · 1 line
2.47.1
PATCH v2 19/81 tcg: Split out tcg-target-mo.h
In reply to Richard Henderson--- accel/tcg/internal-target.h | 1 + tcg/aarch64/tcg-target-mo.h | 12 ++++++++++++ tcg/aarch64/tcg-target.h | 2 -- tcg/arm/tcg-target-mo.h | 13 +++++++++++++ tcg/arm/tcg-target.h | 2 -- tcg/i386/tcg-target-mo.h | 19 +++++++++++++++++++ tcg/i386/tcg-target.h | 11 ----------- tcg/loongarch64/tcg-target-mo.h | 12 ++++++++++++ tcg/loongarch64/tcg-target.h | 2 -- tcg/mips/tcg-target-mo.h | 13 +++++++++++++ tcg/mips/tcg-target.h | 2 -- tcg/ppc/tcg-target-mo.h | 12 ++++++++++++ tcg/ppc/tcg-target.h | 2 -- tcg/riscv/tcg-target-mo.h | 12 ++++++++++++ tcg/riscv/tcg-target.h | 2 -- tcg/s390x/tcg-target-mo.h | 12 ++++++++++++ tcg/s390x/tcg-target.h | 2 -- tcg/sparc64/tcg-target-mo.h | 12 ++++++++++++ tcg/sparc64/tcg-target.h | 2 -- tcg/tci/tcg-target-mo.h | 17 +++++++++++++++++ tcg/tci/tcg-target.h | 5 ----- tcg/tcg-op-ldst.c | 1 + 22 files changed, 136 insertions(+), 32 deletions(-) create mode 100644 tcg/aarch64/tcg-target-mo.h create mode 100644 tcg/arm/tcg-target-mo.h create mode 100644 tcg/i386/tcg-target-mo.h create mode 100644 tcg/loongarch64/tcg-target-mo.h create mode 100644 tcg/mips/tcg-target-mo.h create mode 100644 tcg/ppc/tcg-target-mo.h create mode 100644 tcg/riscv/tcg-target-mo.h create mode 100644 tcg/s390x/tcg-target-mo.h create mode 100644 tcg/sparc64/tcg-target-mo.h create mode 100644 tcg/tci/tcg-target-mo.h
accel/tcg/internal-target.h +1 -0
@@ -12,6 +12,7 @@#include "exec/exec-all.h" #include "exec/translation-block.h" #include "tb-internal.h" +#include "tcg-target-mo.h" /* * Access to the various translations structures need to be serialised
tcg/aarch64/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Define target-specific memory model +* Copyright (c) 2013 Huawei Technologies Duesseldorf GmbH +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/aarch64/tcg-target.h +0 -2
@@ -47,6 +47,4 @@ typedef enum {#define TCG_TARGET_NB_REGS 64 -#define TCG_TARGET_DEFAULT_MO (0) -#endif /* AARCH64_TCG_TARGET_H */
tcg/arm/tcg-target-mo.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2008 Fabrice Bellard +* Copyright (c) 2008 Andrzej Zaborowski +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/arm/tcg-target.h +0 -2
@@ -70,6 +70,4 @@ typedef enum {#define TCG_TARGET_NB_REGS 32 -#define TCG_TARGET_DEFAULT_MO (0) -#endif
tcg/i386/tcg-target-mo.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +/* +* This defines the natural memory order supported by this architecture +* before guarantees made by various barrier instructions. +* +* The x86 has a pretty strong memory ordering which only really +* allows for some stores to be re-ordered after loads. +*/ +#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) + +#endif
tcg/i386/tcg-target.h +0 -11
@@ -88,15 +88,4 @@ typedef enum {TCG_REG_CALL_STACK =TCG_REG_ESP } TCGReg; -/* This defines the natural memory order supported by this -* architecture before guarantees made by various barrier -* instructions. -* -* The x86 has a pretty strong memory ordering which only really -* allows for some stores to be re-ordered after loads. -*/ -#include "tcg/tcg-mo.h" - -#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#endif
tcg/loongarch64/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2021 WANG Xuerui <[email protected]> +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/loongarch64/tcg-target.h +0 -2
@@ -85,6 +85,4 @@ typedef enum {TCG_VEC_TMP0 =TCG_REG_V23 , } TCGReg; -#define TCG_TARGET_DEFAULT_MO (0) -#endif /* LOONGARCH_TCG_TARGET_H */
tcg/mips/tcg-target-mo.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2008-2009 Arnaud Patard <[email protected]> +* Copyright (c) 2009 Aurelien Jarno <[email protected]> +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/mips/tcg-target.h +0 -2
@@ -70,6 +70,4 @@ typedef enum {TCG_AREG0 =TCG_REG_S8 , } TCGReg; -#define TCG_TARGET_DEFAULT_MO 0 -#endif
tcg/ppc/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/ppc/tcg-target.h +0 -2
@@ -53,6 +53,4 @@ typedef enum {TCG_AREG0 =TCG_REG_R27 } TCGReg; -#define TCG_TARGET_DEFAULT_MO (0) -#endif
tcg/riscv/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2018 SiFive, Inc +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/riscv/tcg-target.h +0 -2
@@ -57,6 +57,4 @@ typedef enum {TCG_REG_TMP2 =TCG_REG_T4 , } TCGReg; -#define TCG_TARGET_DEFAULT_MO (0) -#endif
tcg/s390x/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2009 Ulrich Hecht <[email protected]> +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) + +#endif
tcg/s390x/tcg-target.h +0 -2
@@ -51,6 +51,4 @@ typedef enum TCGReg {#define TCG_TARGET_NB_REGS 64 -#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#endif
tcg/sparc64/tcg-target-mo.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2008 Fabrice Bellard +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/sparc64/tcg-target.h +0 -2
@@ -66,6 +66,4 @@ typedef enum {#define TCG_AREG0 TCG_REG_I0 -#define TCG_TARGET_DEFAULT_MO (0) -#endif
tcg/tci/tcg-target-mo.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Define target-specific memory model +* Copyright (c) 2009, 2011 Stefan Weil +*/ + +#ifndef TCG_TARGET_MO_H +#define TCG_TARGET_MO_H + +/* +* We could notice __i386__ or __s390x__ and reduce the barriers depending +* on the host. But if you want performance, you use the normal backend. +* We prefer consistency across hosts on this. +*/ +#define TCG_TARGET_DEFAULT_MO 0 + +#endif
tcg/tci/tcg-target.h +0 -5
@@ -74,9 +74,4 @@ typedef enum {#define HAVE_TCG_QEMU_TB_EXEC #define TCG_TARGET_NEED_POOL_LABELS -/* We could notice __i386__ or __s390x__ and reduce the barriers depending -on the host. But if you want performance, you use the normal backend. -We prefer consistency across hosts on this. */ -#define TCG_TARGET_DEFAULT_MO (0) -#endif /* TCG_TARGET_H */
tcg/tcg-op-ldst.c +1 -0
@@ -31,6 +31,7 @@#include "exec/plugin-gen.h" #include "tcg-internal.h" #include "tcg-has.h" +#include "tcg-target-mo.h" static void check_max_alignment (unsigned a_bits) {
Signature · 1 line
2.43.0
PATCH v2 20/81 tcg: Use C_NotImplemented in tcg_target_op_def
In reply to Richard HendersonReturn C_NotImplemented instead of asserting for opcodes not implemented by the backend. For now, the assertion moves to process_op_defs.
--- tcg/tcg.c | 10 ++++++---- tcg/aarch64/tcg-target.c.inc | 2 +- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc | 2 +- tcg/loongarch64/tcg-target.c.inc | 2 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 2 +- tcg/riscv/tcg-target.c.inc | 2 +- tcg/s390x/tcg-target.c.inc | 2 +- tcg/sparc64/tcg-target.c.inc | 2 +- tcg/tci/tcg-target.c.inc | 2 +- 11 files changed, 16 insertions(+), 14 deletions(-)
tcg/tcg.c +6 -4
@@ -862,6 +862,7 @@ static int tcg_out_pool_finalize(TCGContext *s)#define C_N1_O1_I4 (O1 ,O2 ,I1 ,I2 ,I3 ,I4 ) C_PFX6(c_n1_o1_i4_, O1, O2, I1, I2, I3, I4),typedef enum { + C_NotImplemented =-1 ,#include "tcg-target-con-set.h" }TCGConstraintSetIndex ;
@@ -3176,6 +3177,7 @@ static void process_op_defs(TCGContext *s)const TCGTargetOpDef *tdefs;bool saw_alias_pair = false;int i, o, i2, o2, nb_args; +TCGConstraintSetIndex con_set;if (def->flags &TCG_OPF_NOT_PRESENT ) {continue ;
@@ -3188,11 +3190,11 @@ static void process_op_defs(TCGContext *s)/* * Macro magic should make it impossible, but double-check that -* the array index is in range. Since the signness of an enum -* is implementation defined, force the result to unsigned. +* the array index is in range. At the same time, double-check +* that the opcode is implemented, i.e. not C_NotImplemented. */ -unsigned con_set =tcg_target_op_def (op); -tcg_debug_assert (con_set <ARRAY_SIZE (constraint_sets)); + con_set =tcg_target_op_def (op); +tcg_debug_assert (con_set >=0 && con_set <ARRAY_SIZE (constraint_sets)); tdefs = &constraint_sets[con_set];for (i =0 ; i < nb_args; i++) {
tcg/aarch64/tcg-target.c.inc +1 -1
@@ -3158,7 +3158,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(w, 0, w); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/arm/tcg-target.c.inc +1 -1
@@ -2260,7 +2260,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_bitsel_vec: return C_O1_I3(w, w, w, w); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/i386/tcg-target.c.inc +1 -1
@@ -3885,7 +3885,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I4(x, x, x, xO, x); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/loongarch64/tcg-target.c.inc +1 -1
@@ -2391,7 +2391,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I3(w, w, w, w); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/mips/tcg-target.c.inc +1 -1
@@ -2292,7 +2292,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) : C_O0_I4(rZ, rZ, r, r)); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/ppc/tcg-target.c.inc +1 -1
@@ -4354,7 +4354,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I4(v, v, v, vZM, v); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/riscv/tcg-target.c.inc +1 -1
@@ -2767,7 +2767,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_cmpsel_vec: return C_O1_I4(v, v, vL, vK, vK); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/s390x/tcg-target.c.inc +1 -1
@@ -3427,7 +3427,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) : C_O1_I4(v, v, v, vZ, v)); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/sparc64/tcg-target.c.inc +1 -1
@@ -1627,7 +1627,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, r, r); default: - g_assert_not_reached(); + return C_NotImplemented; } }
tcg/tci/tcg-target.c.inc +1 -1
@@ -186,7 +186,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return TCG_TARGET_REG_BITS == 64 ? C_O0_I2(r, r) : C_O0_I4(r, r, r, r); default: - g_assert_not_reached(); + return C_NotImplemented; } }
Signature · 1 line
2.43.0
PATCH v2 21/81 tcg: Change have_vec to has_type in tcg_op_supported
In reply to Richard HendersonTest each vector type, not just lumping them all together. Add tests for I32 (always true) and I64 (64-bit hosts).
--- tcg/tcg.c | 66 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 23 deletions(-)
tcg/tcg.c +43 -23
@@ -2136,8 +2136,28 @@ TCGTemp *tcgv_i32_temp(TCGv_i32 v)*/ bool tcg_op_supported (TCGOpcode op,TCGType type,unsigned flags) { -const bool have_vec - = TCG_TARGET_HAS_v64 | TCG_TARGET_HAS_v128 | TCG_TARGET_HAS_v256; +bool has_type; + +switch (type) { +case TCG_TYPE_I32 : + has_type = true; +break ; +case TCG_TYPE_I64 : + has_type =TCG_TARGET_REG_BITS ==64 ; +break ; +case TCG_TYPE_V64 : + has_type = TCG_TARGET_HAS_v64; +break ; +case TCG_TYPE_V128 : + has_type = TCG_TARGET_HAS_v128; +break ; +case TCG_TYPE_V256 : + has_type = TCG_TARGET_HAS_v256; +break ; +default : + has_type = false; +break ; + }switch (op) {case INDEX_op_discard:
@@ -2376,60 +2396,60 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_or_vec:case INDEX_op_xor_vec:case INDEX_op_cmp_vec: -return have_vec; +return has_type;case INDEX_op_dup2_vec: -return have_vec &&TCG_TARGET_REG_BITS ==32 ; +return has_type &&TCG_TARGET_REG_BITS ==32 ;case INDEX_op_not_vec: -return have_vec && TCG_TARGET_HAS_not_vec; +return has_type && TCG_TARGET_HAS_not_vec;case INDEX_op_neg_vec: -return have_vec && TCG_TARGET_HAS_neg_vec; +return has_type && TCG_TARGET_HAS_neg_vec;case INDEX_op_abs_vec: -return have_vec && TCG_TARGET_HAS_abs_vec; +return has_type && TCG_TARGET_HAS_abs_vec;case INDEX_op_andc_vec: -return have_vec && TCG_TARGET_HAS_andc_vec; +return has_type && TCG_TARGET_HAS_andc_vec;case INDEX_op_orc_vec: -return have_vec && TCG_TARGET_HAS_orc_vec; +return has_type && TCG_TARGET_HAS_orc_vec;case INDEX_op_nand_vec: -return have_vec && TCG_TARGET_HAS_nand_vec; +return has_type && TCG_TARGET_HAS_nand_vec;case INDEX_op_nor_vec: -return have_vec && TCG_TARGET_HAS_nor_vec; +return has_type && TCG_TARGET_HAS_nor_vec;case INDEX_op_eqv_vec: -return have_vec && TCG_TARGET_HAS_eqv_vec; +return has_type && TCG_TARGET_HAS_eqv_vec;case INDEX_op_mul_vec: -return have_vec && TCG_TARGET_HAS_mul_vec; +return has_type && TCG_TARGET_HAS_mul_vec;case INDEX_op_shli_vec:case INDEX_op_shri_vec:case INDEX_op_sari_vec: -return have_vec && TCG_TARGET_HAS_shi_vec; +return has_type && TCG_TARGET_HAS_shi_vec;case INDEX_op_shls_vec:case INDEX_op_shrs_vec:case INDEX_op_sars_vec: -return have_vec && TCG_TARGET_HAS_shs_vec; +return has_type && TCG_TARGET_HAS_shs_vec;case INDEX_op_shlv_vec:case INDEX_op_shrv_vec:case INDEX_op_sarv_vec: -return have_vec && TCG_TARGET_HAS_shv_vec; +return has_type && TCG_TARGET_HAS_shv_vec;case INDEX_op_rotli_vec: -return have_vec && TCG_TARGET_HAS_roti_vec; +return has_type && TCG_TARGET_HAS_roti_vec;case INDEX_op_rotls_vec: -return have_vec && TCG_TARGET_HAS_rots_vec; +return has_type && TCG_TARGET_HAS_rots_vec;case INDEX_op_rotlv_vec:case INDEX_op_rotrv_vec: -return have_vec && TCG_TARGET_HAS_rotv_vec; +return has_type && TCG_TARGET_HAS_rotv_vec;case INDEX_op_ssadd_vec:case INDEX_op_usadd_vec:case INDEX_op_sssub_vec:case INDEX_op_ussub_vec: -return have_vec && TCG_TARGET_HAS_sat_vec; +return has_type && TCG_TARGET_HAS_sat_vec;case INDEX_op_smin_vec:case INDEX_op_umin_vec:case INDEX_op_smax_vec:case INDEX_op_umax_vec: -return have_vec && TCG_TARGET_HAS_minmax_vec; +return has_type && TCG_TARGET_HAS_minmax_vec;case INDEX_op_bitsel_vec: -return have_vec && TCG_TARGET_HAS_bitsel_vec; +return has_type && TCG_TARGET_HAS_bitsel_vec;case INDEX_op_cmpsel_vec: -return have_vec && TCG_TARGET_HAS_cmpsel_vec; +return has_type && TCG_TARGET_HAS_cmpsel_vec;default :tcg_debug_assert (op > INDEX_op_last_generic && op <NB_OPS );
Signature · 1 line
2.43.0
PATCH v2 22/81 tcg: Reorg process_op_defs
In reply to Richard HendersonProcess each TCGConstraintSetIndex first. Allocate TCGArgConstraint arrays based on those. Only afterward process the TCGOpcodes and share those TCGArgConstraint arrays.
--- include/tcg/tcg.h | 7 +- tcg/tcg.c | 272 +++++++++++++++++++++++----------------------- 2 files changed, 136 insertions(+), 143 deletions(-)
include/tcg/tcg.h +1 -6
@@ -714,17 +714,12 @@ typedef struct TCGOpDef {const char *name;uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args;uint8_t flags; -TCGArgConstraint *args_ct; +const TCGArgConstraint *args_ct; } TCGOpDef;extern TCGOpDef tcg_op_defs[];extern const size_t tcg_op_defs_max; -typedef struct TCGTargetOpDef { -TCGOpcode op; -const char *args_ct_str[TCG_MAX_OP_ARGS ]; -}TCGTargetOpDef ; -/* * tcg_op_supported: * Query if @op, for @type and @flags, is supported by the host
tcg/tcg.c +135 -137
414 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 22/81] tcg: Reorg process_op_defs
Quoted 9 lines · Richard Henderson
Process each TCGConstraintSetIndex first. Allocate TCGArgConstraint arrays based on those. Only afterward process the TCGOpcodes and share those TCGArgConstraint arrays.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 7 +- tcg/tcg.c | 272 +++++++++++++++++++++++----------------------- 2 files changed, 136 insertions(+), 143 deletions(-)
Nice.
PATCH v2 23/81 tcg: Remove args_ct from TCGOpDef
In reply to Richard HendersonIntroduce a new function, opcode_args_ct, to look up the argument set for an opcode. We lose the ability to assert the correctness of the map from TCGOpcode to constraint sets at startup, but we can still validate at runtime upon lookup.
Rename process_op_defs to process_constraint_sets, as it now does nothing to TCGOpDef.
--- include/tcg/tcg.h | 1 - tcg/tcg-common.c | 2 +- tcg/tcg.c | 82 ++++++++++++++++++++++------------------------- 3 files changed, 40 insertions(+), 45 deletions(-)
include/tcg/tcg.h +0 -1
@@ -714,7 +714,6 @@ typedef struct TCGOpDef {const char *name;uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args;uint8_t flags; -const TCGArgConstraint *args_ct; } TCGOpDef;extern TCGOpDef tcg_op_defs[];
tcg/tcg-common.c +1 -1
@@ -28,7 +28,7 @@ TCGOpDef tcg_op_defs[] = { #define DEF(s, oargs, iargs, cargs, flags) \ - { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags, NULL }, + { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },#include "tcg/tcg-opc.h" #undef DEF };
tcg/tcg.c +39 -43
172 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 23/81] tcg: Remove args_ct from TCGOpDef
Quoted 8 lines · Richard Henderson
Introduce a new function,
opcode_args_ct, to look up the argument set for an opcode. We lose the ability to assert the correctness of the map from TCGOpcode to constraint sets at startup, but we can still validate at runtime upon lookup.Rename
process_op_defstoprocess_constraint_sets, as it now does nothing to TCGOpDef.
Quoted 6 lines
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 1 - tcg/tcg-common.c | 2 +- tcg/tcg.c | 82 ++++++++++++++++++++++------------------------- 3 files changed, 40 insertions(+), 45 deletions(-)
PATCH v2 24/81 tcg: Constify tcg_op_defs
In reply to Richard HendersonNow that we're no longer assigning to TCGOpDef.args_ct, we can make the array constant.
--- include/tcg/tcg.h | 2 +- tcg/tcg-common.c | 2 +- tcg/tcg.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
include/tcg/tcg.h +1 -1
@@ -716,7 +716,7 @@ typedef struct TCGOpDef {uint8_t flags; } TCGOpDef; -extern TCGOpDef tcg_op_defs[]; +extern const TCGOpDef tcg_op_defs[];extern const size_t tcg_op_defs_max;/*
tcg/tcg-common.c +1 -1
@@ -26,7 +26,7 @@#include "tcg/tcg.h" #include "tcg-has.h" -TCGOpDef tcg_op_defs[] = { +const TCGOpDef tcg_op_defs[] = { #define DEF(s, oargs, iargs, cargs, flags) \ { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },#include "tcg/tcg-opc.h"
tcg/tcg.c +1 -1
@@ -3364,7 +3364,7 @@ static void process_constraint_sets(TCGContext *s)static const TCGArgConstraint *opcode_args_ct (const TCGOp *op) { -TCGOpDef *def = &tcg_op_defs[op->opc]; +const TCGOpDef *def = &tcg_op_defs[op->opc];TCGConstraintSetIndex con_set;if (def->nb_iargs + def->nb_oargs ==0 ) {
Signature · 1 line
2.43.0
Re: [PATCH v2 24/81] tcg: Constify tcg_op_defs
Quoted 9 lines · Richard Henderson
Now that we're no longer assigning to TCGOpDef.args_ct, we can make the array constant.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg.h | 2 +- tcg/tcg-common.c | 2 +- tcg/tcg.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
PATCH v2 25/81 tcg: Validate op supported in opcode_args_ct
In reply to Richard HendersonWe should have checked that the op is supported before emitting it. The backend cannot be expected to have a constraint set for unsupported ops.
--- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+)
tcg/tcg.c +4 -0
@@ -3367,6 +3367,10 @@ static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)const TCGOpDef *def = &tcg_op_defs[op->opc];TCGConstraintSetIndex con_set; +#ifdef CONFIG_DEBUG_TCG +assert (tcg_op_supported (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op))); +#endif +if (def->nb_iargs + def->nb_oargs ==0 ) {return NULL ; }
Signature · 1 line
2.43.0
Re: [PATCH v2 25/81] tcg: Validate op supported in opcode_args_ct
Quoted 8 lines · Richard Henderson
We should have checked that the op is supported before emitting it. The backend cannot be expected to have a constraint set for unsupported ops.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+)
PATCH v2 26/81 tcg: Add TCG_OPF_NOT_PRESENT to opcodes without inputs or outputs
In reply to Richard HendersonThe br, mb, goto_tb and exit_tb opcodes do not have register operands, only constants, flags, or labels. Remove the special case in opcode_args_ct by including TCG_OPF_NOT_PRESENT in the flags for these opcodes.
--- include/tcg/tcg-opc.h | 8 ++++---- tcg/tcg.c | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-)
include/tcg/tcg-opc.h +4 -4
@@ -33,7 +33,7 @@ DEF(set_label, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT)/* variable number of parameters */ DEF(call, 0, 0, 3, TCG_OPF_CALL_CLOBBER | TCG_OPF_NOT_PRESENT) -DEF(br, 0, 0, 1, TCG_OPF_BB_END) +DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT)#define IMPL (X ) (__builtin_constant_p(X) && (X) <= 0 ? TCG_OPF_NOT_PRESENT : 0)#if TCG_TARGET_REG_BITS ==32
@@ -42,7 +42,7 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END)# define IMPL64 TCG_OPF_64BIT#endif -DEF(mb, 0, 0, 1, 0) +DEF(mb, 0, 0, 1, TCG_OPF_NOT_PRESENT) DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT)DEF (setcond_i32,1 ,2 ,1 ,0 )
@@ -193,8 +193,8 @@ DEF(mulsh_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_mulsh_i64))/* There are tcg_ctx->insn_start_words here, not just one. */ DEF(insn_start, 0, 0, DATA64_ARGS, TCG_OPF_NOT_PRESENT) -DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) -DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) +DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT) +DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT) DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)DEF (plugin_cb,0 ,0 ,1 ,TCG_OPF_NOT_PRESENT )
tcg/tcg.c +0 -3
@@ -3371,9 +3371,6 @@ static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)assert (tcg_op_supported (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op)));#endif -if (def->nb_iargs + def->nb_oargs ==0 ) { -return NULL ; - }if (def->flags &TCG_OPF_NOT_PRESENT ) {return empty_cts; }
Signature · 1 line
2.43.0
Re: [PATCH v2 26/81] tcg: Add TCG_OPF_NOT_PRESENT to opcodes without inputs or outputs
Quoted 4 lines · Richard Henderson
The br, mb,
goto_tbandexit_tbopcodes do not have register operands, only constants, flags, or labels. Remove the special case inopcode_args_ctby includingTCG_OPF_NOT_PRESENTin the flags for these opcodes.
Hmm this might answer my question about using 0 = TCG_TYPE_I32 for these.
Quoted 5 lines
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg-opc.h | 8 ++++---- tcg/tcg.c | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-)
PATCH v2 27/81 tcg: Pass type and flags to tcg_target_op_def
In reply to Richard HendersonAllow the backend to make constraint choices based on more parameters.
--- tcg/tcg.c | 4 ++-- tcg/aarch64/tcg-target.c.inc | 3 ++- tcg/arm/tcg-target.c.inc | 3 ++- tcg/i386/tcg-target.c.inc | 3 ++- tcg/loongarch64/tcg-target.c.inc | 3 ++- tcg/mips/tcg-target.c.inc | 3 ++- tcg/ppc/tcg-target.c.inc | 3 ++- tcg/riscv/tcg-target.c.inc | 3 ++- tcg/s390x/tcg-target.c.inc | 3 ++- tcg/sparc64/tcg-target.c.inc | 3 ++- tcg/tci/tcg-target.c.inc | 3 ++- 11 files changed, 22 insertions(+), 12 deletions(-)
tcg/tcg.c +2 -2
@@ -866,7 +866,7 @@ typedef enum {#include "tcg-target-con-set.h" } TCGConstraintSetIndex; -static TCGConstraintSetIndex tcg_target_op_def (TCGOpcode ); +static TCGConstraintSetIndex tcg_target_op_def (TCGOpcode ,TCGType ,unsigned );#undef C_O0_I1#undef C_O0_I2
@@ -3375,7 +3375,7 @@ static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)return empty_cts; } - con_set =tcg_target_op_def (op->opc); + con_set =tcg_target_op_def (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op));tcg_debug_assert (con_set >=0 && con_set <ARRAY_SIZE (constraint_sets));/* The constraint arguments must match TCGOpcode arguments. */
tcg/aarch64/tcg-target.c.inc +2 -1
@@ -2962,7 +2962,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/arm/tcg-target.c.inc +2 -1
@@ -2124,7 +2124,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/i386/tcg-target.c.inc +2 -1
@@ -3627,7 +3627,8 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/loongarch64/tcg-target.c.inc +2 -1
@@ -2191,7 +2191,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, g_assert_not_reached(); } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/mips/tcg-target.c.inc +2 -1
@@ -2151,7 +2151,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/ppc/tcg-target.c.inc +2 -1
@@ -4140,7 +4140,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, va_end(va); } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/riscv/tcg-target.c.inc +2 -1
@@ -2583,7 +2583,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/s390x/tcg-target.c.inc +2 -1
@@ -3207,7 +3207,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, va_end(va); } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/sparc64/tcg-target.c.inc +2 -1
@@ -1532,7 +1532,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } } -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
tcg/tci/tcg-target.c.inc +2 -1
@@ -36,7 +36,8 @@ #endif #define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL -static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) +static TCGConstraintSetIndex +tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) { switch (op) { case INDEX_op_goto_ptr:
Signature · 1 line
2.43.0
Re: [PATCH v2 27/81] tcg: Pass type and flags to tcg_target_op_def
Quoted 16 lines · Richard Henderson
Allow the backend to make constraint choices based on more parameters.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 4 ++-- tcg/aarch64/tcg-target.c.inc | 3 ++- tcg/arm/tcg-target.c.inc | 3 ++- tcg/i386/tcg-target.c.inc | 3 ++- tcg/loongarch64/tcg-target.c.inc | 3 ++- tcg/mips/tcg-target.c.inc | 3 ++- tcg/ppc/tcg-target.c.inc | 3 ++- tcg/riscv/tcg-target.c.inc | 3 ++- tcg/s390x/tcg-target.c.inc | 3 ++- tcg/sparc64/tcg-target.c.inc | 3 ++- tcg/tci/tcg-target.c.inc | 3 ++- 11 files changed, 22 insertions(+), 12 deletions(-)
PATCH v2 28/81 tcg: Add TCGType argument to tcg_out_op
In reply to Richard HendersonPass TCGOp.type to the output function.
For aarch64 and tci, use this instead of testing TCG_OPF_64BIT. For s390x, use this instead of testing INDEX_op_deposit_i64. For i386, use this to initialize rexw.
--- tcg/tcg.c | 4 ++-- tcg/aarch64/tcg-target.c.inc | 6 +----- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc | 9 +++++---- tcg/loongarch64/tcg-target.c.inc | 2 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 2 +- tcg/riscv/tcg-target.c.inc | 2 +- tcg/s390x/tcg-target.c.inc | 7 +++---- tcg/sparc64/tcg-target.c.inc | 2 +- tcg/tci/tcg-target.c.inc | 4 ++-- 11 files changed, 19 insertions(+), 23 deletions(-)
tcg/tcg.c +2 -2
@@ -134,7 +134,7 @@ static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);static bool tcg_out_xchg (TCGContext *s,TCGType type,TCGReg r1,TCGReg r2);static void tcg_out_exit_tb (TCGContext *s,uintptr_t arg);static void tcg_out_goto_tb (TCGContext *s,int which); -static void tcg_out_op (TCGContext *s,TCGOpcode opc, +static void tcg_out_op (TCGContext *s,TCGOpcode opc,TCGType type,const TCGArg args[TCG_MAX_OP_ARGS ],const int const_args[TCG_MAX_OP_ARGS ]);#if TCG_TARGET_MAYBE_vec
@@ -5423,7 +5423,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)tcg_out_vec_op (s, op->opc,TCGOP_TYPE (op) -TCG_TYPE_V64 ,TCGOP_VECE (op), new_args, const_args); }else { -tcg_out_op (s, op->opc, new_args, const_args); +tcg_out_op (s, op->opc,TCGOP_TYPE (op), new_args, const_args); }break ; }
tcg/aarch64/tcg-target.c.inc +1 -5
@@ -2115,14 +2115,10 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType ext, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) { - /* 99% of the time, we can signal the use of extension registers - by looking to see if the opcode handles 64-bit data. */ - TCGType ext = (tcg_op_defs[opc].flags & TCG_OPF_64BIT) != 0; - /* Hoist the loads of the most common arguments. */ TCGArg a0 = args[0]; TCGArg a1 = args[1];
tcg/arm/tcg-target.c.inc +1 -1
@@ -1805,7 +1805,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/i386/tcg-target.c.inc +5 -4
@@ -2612,12 +2612,12 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* no need to flush icache explicitly */ } -static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, - const TCGArg args[TCG_MAX_OP_ARGS], - const int const_args[TCG_MAX_OP_ARGS]) +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { TCGArg a0, a1, a2; - int c, const_a2, vexop, rexw = 0; + int c, const_a2, vexop, rexw; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \
@@ -2634,6 +2634,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a1 = args[1]; a2 = args[2]; const_a2 = const_args[2]; + rexw = type == TCG_TYPE_I32 ? 0 : P_REXW; switch (opc) { case INDEX_op_goto_ptr:
tcg/loongarch64/tcg-target.c.inc +1 -1
@@ -1278,7 +1278,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/mips/tcg-target.c.inc +1 -1
@@ -1678,7 +1678,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* Always indirect, nothing to do */ } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/ppc/tcg-target.c.inc +1 -1
@@ -2940,7 +2940,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/riscv/tcg-target.c.inc +1 -1
@@ -1960,7 +1960,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/s390x/tcg-target.c.inc +3 -4
@@ -2117,9 +2117,9 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, case glue(glue(INDEX_op_,x),_i32): \ case glue(glue(INDEX_op_,x),_i64) -static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, - const TCGArg args[TCG_MAX_OP_ARGS], - const int const_args[TCG_MAX_OP_ARGS]) +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { S390Opcode op, op2; TCGArg a0, a1, a2;
@@ -2713,7 +2713,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, /* Since we can't support "0Z" as a constraint, we allow a1 in any register. Fix things up as if a matching constraint. */ if (a0 != a1) { - TCGType type = (opc == INDEX_op_deposit_i64); if (a0 == a2) { tcg_out_mov(s, type, TCG_TMP0, a2); a2 = TCG_TMP0;
tcg/sparc64/tcg-target.c.inc +1 -1
@@ -1288,7 +1288,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, { } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
tcg/tci/tcg-target.c.inc +2 -2
@@ -708,7 +708,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* Always indirect, nothing to do */ } -static void tcg_out_op(TCGContext *s, TCGOpcode opc, +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) {
@@ -790,7 +790,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, CASE_32_64(sextract) /* Optional (TCG_TARGET_HAS_sextract_*). */ { TCGArg pos = args[2], len = args[3]; - TCGArg max = tcg_op_defs[opc].flags & TCG_OPF_64BIT ? 64 : 32; + TCGArg max = type == TCG_TYPE_I32 ? 32 : 64; tcg_debug_assert(pos < max); tcg_debug_assert(pos + len <= max);
Signature · 1 line
2.43.0
Re: [PATCH v2 28/81] tcg: Add TCGType argument to tcg_out_op
Quoted 43 lines · Richard Henderson
Pass TCGOp.type to the output function.
For aarch64 and tci, use this instead of testingTCG_OPF_64BIT. For s390x, use this instead of testingINDEX_op_deposit_i64. For i386, use this to initialize rexw.Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 4 ++-- tcg/aarch64/tcg-target.c.inc | 6 +----- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc | 9 +++++---- tcg/loongarch64/tcg-target.c.inc | 2 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 2 +- tcg/riscv/tcg-target.c.inc | 2 +- tcg/s390x/tcg-target.c.inc | 7 +++---- tcg/sparc64/tcg-target.c.inc | 2 +- tcg/tci/tcg-target.c.inc | 4 ++-- 11 files changed, 19 insertions(+), 23 deletions(-)tcg/i386/tcg-target.c.inc +4
-4@@ -2612,12 +2612,12 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* no need to flush icache explicitly */ } -static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, - const TCGArg args[TCG_MAX_OP_ARGS], - const int const_args[TCG_MAX_OP_ARGS]) +static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { TCGArg a0, a1, a2; - int c, const_a2, vexop, rexw = 0; + int c, const_a2, vexop, rexw; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \
tcg/i386/tcg-target.c.inc static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, · line 2640
Quoted 7 lines
tcg/i386/tcg-target.c.inc +1
-0@@ -2634,6 +2634,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a1 = args[1]; a2 = args[2]; const_a2 = const_args[2]; + rexw = type == TCG_TYPE_I32 ? 0 : P_REXW; switch (opc) { case INDEX_op_goto_ptr:
Please squash:
-- >8 --
tcg/i386/tcg-target.c.inc +0 -1
@@ -2622,7 +2622,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i64): \ - rexw = P_REXW; /* FALLTHRU */ \ case glue(glue(INDEX_op_, x), _i32) #else # define OP_32_64(x) \
---
With that:
PATCH v2 29/81 tcg: Remove TCG_OPF_64BIT
In reply to Richard HendersonThis flag is no longer used.
--- include/tcg/tcg-opc.h | 22 +++++++++++----------- include/tcg/tcg.h | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-)
include/tcg/tcg-opc.h +11 -11
@@ -37,9 +37,9 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT)#define IMPL (X ) (__builtin_constant_p(X) && (X) <= 0 ? TCG_OPF_NOT_PRESENT : 0)#if TCG_TARGET_REG_BITS ==32 -# define IMPL64 TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT +# define IMPL64 TCG_OPF_NOT_PRESENT#else -# define IMPL64 TCG_OPF_64BIT +# define IMPL64 0#endif DEF (mb,0 ,0 ,1 ,TCG_OPF_NOT_PRESENT )
@@ -110,7 +110,7 @@ DEF(clz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_clz_i32)) DEF(ctz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_ctz_i32)) DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) -DEF(mov_i64, 1, 1, 0, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) +DEF(mov_i64, 1, 1, 0, TCG_OPF_NOT_PRESENT) DEF(setcond_i64, 1, 2, 1, IMPL64) DEF(negsetcond_i64, 1, 2, 1, IMPL64 | IMPL(TCG_TARGET_HAS_negsetcond_i64))DEF (movcond_i64,1 ,4 ,1 ,IMPL64 )
@@ -206,18 +206,18 @@ DEF(qemu_ld_a32_i32, 1, 1, 1,DEF (qemu_st_a32_i32,0 ,1 +1 ,1 , TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_ld_a32_i64,DATA64_ARGS ,1 ,1 , - TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS | TCG_OPF_64BIT) + TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_st_a32_i64,0 ,DATA64_ARGS +1 ,1 , - TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS | TCG_OPF_64BIT) + TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_ld_a64_i32,1 ,DATA64_ARGS ,1 , TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_st_a64_i32,0 ,1 +DATA64_ARGS ,1 , TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_ld_a64_i64,DATA64_ARGS ,DATA64_ARGS ,1 , - TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS | TCG_OPF_64BIT) + TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_st_a64_i64,0 ,DATA64_ARGS +DATA64_ARGS ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |TCG_OPF_64BIT ) +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS ) /* Only used by i386 to cope with stupid register constraints. */ DEF(qemu_st8_a32_i32, 0, 1 + 1, 1,
@@ -229,16 +229,16 @@ DEF(qemu_st8_a64_i32, 0, 1 + DATA64_ARGS, 1,/* Only for 64-bit hosts at the moment. */ DEF (qemu_ld_a32_i128,2 ,1 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |TCG_OPF_64BIT | +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | IMPL(TCG_TARGET_HAS_qemu_ldst_i128))DEF (qemu_ld_a64_i128,2 ,1 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |TCG_OPF_64BIT | +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | IMPL(TCG_TARGET_HAS_qemu_ldst_i128))DEF (qemu_st_a32_i128,0 ,3 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |TCG_OPF_64BIT | +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | IMPL(TCG_TARGET_HAS_qemu_ldst_i128))DEF (qemu_st_a64_i128,0 ,3 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |TCG_OPF_64BIT | +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS |IMPL (TCG_TARGET_HAS_qemu_ldst_i128))/* Host vector support. */
include/tcg/tcg.h +0 -2
@@ -699,8 +699,6 @@ enum {/* Instruction has side effects: it cannot be removed if its outputs are not used, and might trigger exceptions. */ TCG_OPF_SIDE_EFFECTS =0x08 , -/* Instruction operands are 64-bits (otherwise 32-bits). */ -TCG_OPF_64BIT =0x10 ,/* Instruction is optional and not implemented by the host, or insn is generic and should not be implemented by the host. */ TCG_OPF_NOT_PRESENT = 0x20,
Signature · 1 line
2.43.0
Re: [PATCH v2 29/81] tcg: Remove TCG_OPF_64BIT
Quoted 7 lines · Richard Henderson
This flag is no longer used.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg-opc.h | 22 +++++++++++----------- include/tcg/tcg.h | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-)
PATCH v2 30/81 tcg: Drop implementation checks from tcg-opc.h
In reply to Richard HendersonNow that we use a functional interface to query whether the opcode is supported, we can drop the TCG_OPF_NOT_PRESENT bit mapping from TCG_TARGET_HAS_foo in tcg-opc.h
--- include/tcg/tcg-opc.h | 306 +++++++++++++++++++----------------------- 1 file changed, 141 insertions(+), 165 deletions(-)
include/tcg/tcg-opc.h +141 -165
@@ -35,18 +35,11 @@ DEF(call, 0, 0, 3, TCG_OPF_CALL_CLOBBER | TCG_OPF_NOT_PRESENT) DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT) -#define IMPL (X ) (__builtin_constant_p(X) && (X) <= 0 ? TCG_OPF_NOT_PRESENT : 0) -#if TCG_TARGET_REG_BITS ==32 -# define IMPL64 TCG_OPF_NOT_PRESENT -#else -# define IMPL64 0 -#endif - DEF(mb, 0, 0, 1, TCG_OPF_NOT_PRESENT) DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) DEF(setcond_i32, 1, 2, 1, 0) -DEF(negsetcond_i32, 1, 2, 1, IMPL(TCG_TARGET_HAS_negsetcond_i32)) +DEF(negsetcond_i32, 1, 2, 1, 0)DEF (movcond_i32,1 ,4 ,1 ,0 ) /* load/store */DEF (ld8u_i32,1 ,1 ,1 ,0 )
@@ -61,12 +54,12 @@ DEF(st_i32, 0, 2, 1, 0) DEF(add_i32, 1, 2, 0, 0) DEF(sub_i32, 1, 2, 0, 0) DEF(mul_i32, 1, 2, 0, 0) -DEF(div_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_div_i32)) -DEF(divu_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_div_i32)) -DEF(rem_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_rem_i32)) -DEF(remu_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_rem_i32)) -DEF(div2_i32, 2, 3, 0, IMPL(TCG_TARGET_HAS_div2_i32)) -DEF(divu2_i32, 2, 3, 0, IMPL(TCG_TARGET_HAS_div2_i32)) +DEF(div_i32, 1, 2, 0, 0) +DEF(divu_i32, 1, 2, 0, 0) +DEF(rem_i32, 1, 2, 0, 0) +DEF(remu_i32, 1, 2, 0, 0) +DEF(div2_i32, 2, 3, 0, 0) +DEF(divu2_i32, 2, 3, 0, 0) DEF(and_i32, 1, 2, 0, 0) DEF(or_i32, 1, 2, 0, 0)DEF (xor_i32,1 ,2 ,0 ,0 )
@@ -74,119 +67,114 @@ DEF(xor_i32, 1, 2, 0, 0) DEF(shl_i32, 1, 2, 0, 0) DEF(shr_i32, 1, 2, 0, 0) DEF(sar_i32, 1, 2, 0, 0) -DEF(rotl_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_rot_i32)) -DEF(rotr_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_rot_i32)) -DEF(deposit_i32, 1, 2, 2, IMPL(TCG_TARGET_HAS_deposit_i32)) -DEF(extract_i32, 1, 1, 2, IMPL(TCG_TARGET_HAS_extract_i32)) -DEF(sextract_i32, 1, 1, 2, IMPL(TCG_TARGET_HAS_sextract_i32)) -DEF(extract2_i32, 1, 2, 1, IMPL(TCG_TARGET_HAS_extract2_i32)) +DEF(rotl_i32, 1, 2, 0, 0) +DEF(rotr_i32, 1, 2, 0, 0) +DEF(deposit_i32, 1, 2, 2, 0) +DEF(extract_i32, 1, 1, 2, 0) +DEF(sextract_i32, 1, 1, 2, 0) +DEF(extract2_i32, 1, 2, 1, 0) DEF(brcond_i32, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH) -DEF(add2_i32, 2, 4, 0, IMPL(TCG_TARGET_HAS_add2_i32)) -DEF(sub2_i32, 2, 4, 0, IMPL(TCG_TARGET_HAS_sub2_i32)) -DEF(mulu2_i32, 2, 2, 0, IMPL(TCG_TARGET_HAS_mulu2_i32)) -DEF(muls2_i32, 2, 2, 0, IMPL(TCG_TARGET_HAS_muls2_i32)) -DEF(muluh_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_muluh_i32)) -DEF(mulsh_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_mulsh_i32)) -DEF (brcond2_i32,0 ,4 ,2 , - TCG_OPF_BB_END | TCG_OPF_COND_BRANCH | IMPL(TCG_TARGET_REG_BITS == 32)) -DEF(setcond2_i32, 1, 4, 1, IMPL(TCG_TARGET_REG_BITS == 32)) +DEF(add2_i32, 2, 4, 0, 0) +DEF(sub2_i32, 2, 4, 0, 0) +DEF(mulu2_i32, 2, 2, 0, 0) +DEF(muls2_i32, 2, 2, 0, 0) +DEF(muluh_i32, 1, 2, 0, 0) +DEF(mulsh_i32, 1, 2, 0, 0) +DEF(brcond2_i32, 0, 4, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH) +DEF(setcond2_i32, 1, 4, 1, 0) -DEF(ext8s_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext8s_i32)) -DEF(ext16s_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext16s_i32)) -DEF(ext8u_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext8u_i32)) -DEF(ext16u_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext16u_i32)) -DEF(bswap16_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap16_i32)) -DEF(bswap32_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap32_i32)) -DEF(not_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_not_i32)) +DEF(ext8s_i32, 1, 1, 0, 0) +DEF(ext16s_i32, 1, 1, 0, 0) +DEF(ext8u_i32, 1, 1, 0, 0) +DEF(ext16u_i32, 1, 1, 0, 0) +DEF(bswap16_i32, 1, 1, 1, 0) +DEF(bswap32_i32, 1, 1, 1, 0) +DEF(not_i32, 1, 1, 0, 0) DEF(neg_i32, 1, 1, 0, 0) -DEF(andc_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_andc_i32)) -DEF(orc_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_orc_i32)) -DEF(eqv_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_eqv_i32)) -DEF(nand_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_nand_i32)) -DEF(nor_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_nor_i32)) -DEF(clz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_clz_i32)) -DEF(ctz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_ctz_i32)) -DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) +DEF(andc_i32, 1, 2, 0, 0) +DEF(orc_i32, 1, 2, 0, 0) +DEF(eqv_i32, 1, 2, 0, 0) +DEF(nand_i32, 1, 2, 0, 0) +DEF(nor_i32, 1, 2, 0, 0) +DEF(clz_i32, 1, 2, 0, 0) +DEF(ctz_i32, 1, 2, 0, 0) +DEF(ctpop_i32, 1, 1, 0, 0) DEF(mov_i64, 1, 1, 0, TCG_OPF_NOT_PRESENT) -DEF(setcond_i64, 1, 2, 1, IMPL64) -DEF(negsetcond_i64, 1, 2, 1, IMPL64 | IMPL(TCG_TARGET_HAS_negsetcond_i64)) -DEF (movcond_i64,1 ,4 ,1 ,IMPL64 ) +DEF(setcond_i64, 1, 2, 1, 0) +DEF(negsetcond_i64, 1, 2, 1, 0) +DEF (movcond_i64,1 ,4 ,1 ,0 ) /* load/store */ -DEF(ld8u_i64, 1, 1, 1, IMPL64) -DEF(ld8s_i64, 1, 1, 1, IMPL64) -DEF(ld16u_i64, 1, 1, 1, IMPL64) -DEF(ld16s_i64, 1, 1, 1, IMPL64) -DEF(ld32u_i64, 1, 1, 1, IMPL64) -DEF(ld32s_i64, 1, 1, 1, IMPL64) -DEF(ld_i64, 1, 1, 1, IMPL64) -DEF(st8_i64, 0, 2, 1, IMPL64) -DEF(st16_i64, 0, 2, 1, IMPL64) -DEF(st32_i64, 0, 2, 1, IMPL64) -DEF (st_i64,0 ,2 ,1 ,IMPL64 ) +DEF(ld8u_i64, 1, 1, 1, 0) +DEF(ld8s_i64, 1, 1, 1, 0) +DEF(ld16u_i64, 1, 1, 1, 0) +DEF(ld16s_i64, 1, 1, 1, 0) +DEF(ld32u_i64, 1, 1, 1, 0) +DEF(ld32s_i64, 1, 1, 1, 0) +DEF(ld_i64, 1, 1, 1, 0) +DEF(st8_i64, 0, 2, 1, 0) +DEF(st16_i64, 0, 2, 1, 0) +DEF(st32_i64, 0, 2, 1, 0) +DEF (st_i64,0 ,2 ,1 ,0 ) /* arith */ -DEF(add_i64, 1, 2, 0, IMPL64) -DEF(sub_i64, 1, 2, 0, IMPL64) -DEF(mul_i64, 1, 2, 0, IMPL64) -DEF(div_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_div_i64)) -DEF(divu_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_div_i64)) -DEF(rem_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_rem_i64)) -DEF(remu_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_rem_i64)) -DEF(div2_i64, 2, 3, 0, IMPL64 | IMPL(TCG_TARGET_HAS_div2_i64)) -DEF(divu2_i64, 2, 3, 0, IMPL64 | IMPL(TCG_TARGET_HAS_div2_i64)) -DEF(and_i64, 1, 2, 0, IMPL64) -DEF(or_i64, 1, 2, 0, IMPL64) -DEF (xor_i64,1 ,2 ,0 ,IMPL64 ) +DEF(add_i64, 1, 2, 0, 0) +DEF(sub_i64, 1, 2, 0, 0) +DEF(mul_i64, 1, 2, 0, 0) +DEF(div_i64, 1, 2, 0, 0) +DEF(divu_i64, 1, 2, 0, 0) +DEF(rem_i64, 1, 2, 0, 0) +DEF(remu_i64, 1, 2, 0, 0) +DEF(div2_i64, 2, 3, 0, 0) +DEF(divu2_i64, 2, 3, 0, 0) +DEF(and_i64, 1, 2, 0, 0) +DEF(or_i64, 1, 2, 0, 0) +DEF (xor_i64,1 ,2 ,0 ,0 ) /* shifts/rotates */ -DEF(shl_i64, 1, 2, 0, IMPL64) -DEF(shr_i64, 1, 2, 0, IMPL64) -DEF(sar_i64, 1, 2, 0, IMPL64) -DEF(rotl_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_rot_i64)) -DEF(rotr_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_rot_i64)) -DEF(deposit_i64, 1, 2, 2, IMPL64 | IMPL(TCG_TARGET_HAS_deposit_i64)) -DEF(extract_i64, 1, 1, 2, IMPL64 | IMPL(TCG_TARGET_HAS_extract_i64)) -DEF(sextract_i64, 1, 1, 2, IMPL64 | IMPL(TCG_TARGET_HAS_sextract_i64)) -DEF (extract2_i64,1 ,2 ,1 ,IMPL64 |IMPL (TCG_TARGET_HAS_extract2_i64)) +DEF(shl_i64, 1, 2, 0, 0) +DEF(shr_i64, 1, 2, 0, 0) +DEF(sar_i64, 1, 2, 0, 0) +DEF(rotl_i64, 1, 2, 0, 0) +DEF(rotr_i64, 1, 2, 0, 0) +DEF(deposit_i64, 1, 2, 2, 0) +DEF(extract_i64, 1, 1, 2, 0) +DEF(sextract_i64, 1, 1, 2, 0) +DEF (extract2_i64,1 ,2 ,1 ,0 ) /* size changing ops */ -DEF(ext_i32_i64, 1, 1, 0, IMPL64) -DEF(extu_i32_i64, 1, 1, 0, IMPL64) -DEF (extrl_i64_i32,1 ,1 ,0 , -IMPL (TCG_TARGET_HAS_extr_i64_i32) - | (TCG_TARGET_REG_BITS == 32 ? TCG_OPF_NOT_PRESENT : 0)) -DEF (extrh_i64_i32,1 ,1 ,0 , -IMPL (TCG_TARGET_HAS_extr_i64_i32) - | (TCG_TARGET_REG_BITS == 32 ? TCG_OPF_NOT_PRESENT : 0)) +DEF(ext_i32_i64, 1, 1, 0, 0) +DEF(extu_i32_i64, 1, 1, 0, 0) +DEF(extrl_i64_i32, 1, 1, 0, 0) +DEF(extrh_i64_i32, 1, 1, 0, 0) -DEF(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH | IMPL64) -DEF(ext8s_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext8s_i64)) -DEF(ext16s_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext16s_i64)) -DEF(ext32s_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext32s_i64)) -DEF(ext8u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext8u_i64)) -DEF(ext16u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext16u_i64)) -DEF(ext32u_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ext32u_i64)) -DEF(bswap16_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap16_i64)) -DEF(bswap32_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap32_i64)) -DEF(bswap64_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap64_i64)) -DEF(not_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_not_i64)) -DEF(neg_i64, 1, 1, 0, IMPL64) -DEF(andc_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_andc_i64)) -DEF(orc_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_orc_i64)) -DEF(eqv_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_eqv_i64)) -DEF(nand_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_nand_i64)) -DEF(nor_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_nor_i64)) -DEF(clz_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_clz_i64)) -DEF(ctz_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ctz_i64)) -DEF(ctpop_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_ctpop_i64)) +DEF(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH) +DEF(ext8s_i64, 1, 1, 0, 0) +DEF(ext16s_i64, 1, 1, 0, 0) +DEF(ext32s_i64, 1, 1, 0, 0) +DEF(ext8u_i64, 1, 1, 0, 0) +DEF(ext16u_i64, 1, 1, 0, 0) +DEF(ext32u_i64, 1, 1, 0, 0) +DEF(bswap16_i64, 1, 1, 1, 0) +DEF(bswap32_i64, 1, 1, 1, 0) +DEF(bswap64_i64, 1, 1, 1, 0) +DEF(not_i64, 1, 1, 0, 0) +DEF(neg_i64, 1, 1, 0, 0) +DEF(andc_i64, 1, 2, 0, 0) +DEF(orc_i64, 1, 2, 0, 0) +DEF(eqv_i64, 1, 2, 0, 0) +DEF(nand_i64, 1, 2, 0, 0) +DEF(nor_i64, 1, 2, 0, 0) +DEF(clz_i64, 1, 2, 0, 0) +DEF(ctz_i64, 1, 2, 0, 0) +DEF(ctpop_i64, 1, 1, 0, 0) -DEF(add2_i64, 2, 4, 0, IMPL64 | IMPL(TCG_TARGET_HAS_add2_i64)) -DEF(sub2_i64, 2, 4, 0, IMPL64 | IMPL(TCG_TARGET_HAS_sub2_i64)) -DEF(mulu2_i64, 2, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_mulu2_i64)) -DEF(muls2_i64, 2, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_muls2_i64)) -DEF(muluh_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_muluh_i64)) -DEF(mulsh_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_mulsh_i64)) +DEF(add2_i64, 2, 4, 0, 0) +DEF(sub2_i64, 2, 4, 0, 0) +DEF(mulu2_i64, 2, 2, 0, 0) +DEF(muls2_i64, 2, 2, 0, 0) +DEF(muluh_i64, 1, 2, 0, 0) +DEF(mulsh_i64, 1, 2, 0, 0)#define DATA64_ARGS (TCG_TARGET_REG_BITS == 64 ? 1 : 2)
@@ -221,34 +209,24 @@ DEF(qemu_st_a64_i64, 0, DATA64_ARGS + DATA64_ARGS, 1,/* Only used by i386 to cope with stupid register constraints. */ DEF (qemu_st8_a32_i32,0 ,1 +1 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | - IMPL(TCG_TARGET_HAS_qemu_st8_i32)) + TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF (qemu_st8_a64_i32,0 ,1 +DATA64_ARGS ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | -IMPL (TCG_TARGET_HAS_qemu_st8_i32)) +TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS ) /* Only for 64-bit hosts at the moment. */ -DEF (qemu_ld_a32_i128,2 ,1 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | - IMPL(TCG_TARGET_HAS_qemu_ldst_i128)) -DEF (qemu_ld_a64_i128,2 ,1 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | - IMPL(TCG_TARGET_HAS_qemu_ldst_i128)) -DEF (qemu_st_a32_i128,0 ,3 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | - IMPL(TCG_TARGET_HAS_qemu_ldst_i128)) -DEF (qemu_st_a64_i128,0 ,3 ,1 , -TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS | -IMPL (TCG_TARGET_HAS_qemu_ldst_i128)) +DEF(qemu_ld_a32_i128, 2, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF(qemu_ld_a64_i128, 2, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF(qemu_st_a32_i128, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF (qemu_st_a64_i128,0 ,3 ,1 ,TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS ) /* Host vector support. */ -#define IMPLVEC TCG_OPF_VECTOR | IMPL(TCG_TARGET_MAYBE_vec) +#define IMPLVEC TCG_OPF_VECTOR DEF(mov_vec, 1, 1, 0, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) DEF(dup_vec, 1, 1, 0, IMPLVEC) -DEF(dup2_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_REG_BITS == 32)) +DEF(dup2_vec, 1, 2, 0, IMPLVEC) DEF(ld_vec, 1, 1, 1, IMPLVEC)DEF (st_vec,0 ,2 ,1 ,IMPLVEC )
@@ -256,55 +234,53 @@ DEF(dupm_vec, 1, 1, 1, IMPLVEC) DEF(add_vec, 1, 2, 0, IMPLVEC) DEF(sub_vec, 1, 2, 0, IMPLVEC) -DEF(mul_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_mul_vec)) -DEF(neg_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_neg_vec)) -DEF(abs_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_abs_vec)) -DEF(ssadd_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_sat_vec)) -DEF(usadd_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_sat_vec)) -DEF(sssub_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_sat_vec)) -DEF(ussub_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_sat_vec)) -DEF(smin_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_minmax_vec)) -DEF(umin_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_minmax_vec)) -DEF(smax_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_minmax_vec)) -DEF(umax_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_minmax_vec)) +DEF(mul_vec, 1, 2, 0, IMPLVEC) +DEF(neg_vec, 1, 1, 0, IMPLVEC) +DEF(abs_vec, 1, 1, 0, IMPLVEC) +DEF(ssadd_vec, 1, 2, 0, IMPLVEC) +DEF(usadd_vec, 1, 2, 0, IMPLVEC) +DEF(sssub_vec, 1, 2, 0, IMPLVEC) +DEF(ussub_vec, 1, 2, 0, IMPLVEC) +DEF(smin_vec, 1, 2, 0, IMPLVEC) +DEF(umin_vec, 1, 2, 0, IMPLVEC) +DEF(smax_vec, 1, 2, 0, IMPLVEC) +DEF(umax_vec, 1, 2, 0, IMPLVEC) DEF(and_vec, 1, 2, 0, IMPLVEC) DEF(or_vec, 1, 2, 0, IMPLVEC) DEF(xor_vec, 1, 2, 0, IMPLVEC) -DEF(andc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_andc_vec)) -DEF(orc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_orc_vec)) -DEF(nand_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_nand_vec)) -DEF(nor_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_nor_vec)) -DEF(eqv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_eqv_vec)) -DEF(not_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_not_vec)) +DEF(andc_vec, 1, 2, 0, IMPLVEC) +DEF(orc_vec, 1, 2, 0, IMPLVEC) +DEF(nand_vec, 1, 2, 0, IMPLVEC) +DEF(nor_vec, 1, 2, 0, IMPLVEC) +DEF(eqv_vec, 1, 2, 0, IMPLVEC) +DEF(not_vec, 1, 1, 0, IMPLVEC) -DEF(shli_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) -DEF(shri_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) -DEF(sari_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_shi_vec)) -DEF(rotli_vec, 1, 1, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_roti_vec)) +DEF(shli_vec, 1, 1, 1, IMPLVEC) +DEF(shri_vec, 1, 1, 1, IMPLVEC) +DEF(sari_vec, 1, 1, 1, IMPLVEC) +DEF(rotli_vec, 1, 1, 1, IMPLVEC) -DEF(shls_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) -DEF(shrs_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) -DEF(sars_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shs_vec)) -DEF(rotls_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rots_vec)) +DEF(shls_vec, 1, 2, 0, IMPLVEC) +DEF(shrs_vec, 1, 2, 0, IMPLVEC) +DEF(sars_vec, 1, 2, 0, IMPLVEC) +DEF(rotls_vec, 1, 2, 0, IMPLVEC) -DEF(shlv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) -DEF(shrv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) -DEF(sarv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_shv_vec)) -DEF(rotlv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rotv_vec)) -DEF(rotrv_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_rotv_vec)) +DEF(shlv_vec, 1, 2, 0, IMPLVEC) +DEF(shrv_vec, 1, 2, 0, IMPLVEC) +DEF(sarv_vec, 1, 2, 0, IMPLVEC) +DEF(rotlv_vec, 1, 2, 0, IMPLVEC) +DEF(rotrv_vec, 1, 2, 0, IMPLVEC) DEF(cmp_vec, 1, 2, 1, IMPLVEC) -DEF(bitsel_vec, 1, 3, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_bitsel_vec)) -DEF(cmpsel_vec, 1, 4, 1, IMPLVEC | IMPL(TCG_TARGET_HAS_cmpsel_vec)) +DEF(bitsel_vec, 1, 3, 0, IMPLVEC) +DEF(cmpsel_vec, 1, 4, 1, IMPLVEC) DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)#include "tcg-target-opc.h.inc" #undef DATA64_ARGS -#undef IMPL -#undef IMPL64#undef IMPLVEC#undef DEF
Signature · 1 line
2.43.0
Re: [PATCH v2 30/81] tcg: Drop implementation checks from tcg-opc.h
Quoted 8 lines · Richard Henderson
Now that we use a functional interface to query whether the opcode is supported, we can drop the
TCG_OPF_NOT_PRESENTbit mapping fromTCG_TARGET_HAS_foointcg-opc.hSigned-off-by Richard Henderson <[email protected]>--- include/tcg/tcg-opc.h | 306 +++++++++++++++++++----------------------- 1 file changed, 141 insertions(+), 165 deletions(-)
PATCH v2 31/81 tcg: Replace IMPLVEC with TCG_OPF_VECTOR
In reply to Richard HendersonThis is now a direct replacement.
--- include/tcg/tcg-opc.h | 89 +++++++++++++++----------------- tcg/aarch64/tcg-target-opc.h.inc | 4 +- tcg/arm/tcg-target-opc.h.inc | 6 +-- tcg/i386/tcg-target-opc.h.inc | 22 ++++---- tcg/ppc/tcg-target-opc.h.inc | 12 ++--- tcg/s390x/tcg-target-opc.h.inc | 6 +-- 6 files changed, 68 insertions(+), 71 deletions(-)
include/tcg/tcg-opc.h +43 -46
@@ -221,66 +221,63 @@ DEF(qemu_st_a64_i128, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)/* Host vector support. */ -#define IMPLVEC TCG_OPF_VECTOR - DEF(mov_vec, 1, 1, 0, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) -DEF(dup_vec, 1, 1, 0, IMPLVEC) -DEF(dup2_vec, 1, 2, 0, IMPLVEC) +DEF(dup_vec, 1, 1, 0, TCG_OPF_VECTOR) +DEF(dup2_vec, 1, 2, 0, TCG_OPF_VECTOR) -DEF(ld_vec, 1, 1, 1, IMPLVEC) -DEF(st_vec, 0, 2, 1, IMPLVEC) -DEF(dupm_vec, 1, 1, 1, IMPLVEC) +DEF(ld_vec, 1, 1, 1, TCG_OPF_VECTOR) +DEF(st_vec, 0, 2, 1, TCG_OPF_VECTOR) +DEF(dupm_vec, 1, 1, 1, TCG_OPF_VECTOR) -DEF(add_vec, 1, 2, 0, IMPLVEC) -DEF(sub_vec, 1, 2, 0, IMPLVEC) -DEF(mul_vec, 1, 2, 0, IMPLVEC) -DEF(neg_vec, 1, 1, 0, IMPLVEC) -DEF(abs_vec, 1, 1, 0, IMPLVEC) -DEF(ssadd_vec, 1, 2, 0, IMPLVEC) -DEF(usadd_vec, 1, 2, 0, IMPLVEC) -DEF(sssub_vec, 1, 2, 0, IMPLVEC) -DEF(ussub_vec, 1, 2, 0, IMPLVEC) -DEF(smin_vec, 1, 2, 0, IMPLVEC) -DEF(umin_vec, 1, 2, 0, IMPLVEC) -DEF(smax_vec, 1, 2, 0, IMPLVEC) -DEF(umax_vec, 1, 2, 0, IMPLVEC) +DEF(add_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(sub_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(mul_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(neg_vec, 1, 1, 0, TCG_OPF_VECTOR) +DEF(abs_vec, 1, 1, 0, TCG_OPF_VECTOR) +DEF(ssadd_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(usadd_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(sssub_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(ussub_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(smin_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(umin_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(smax_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(umax_vec, 1, 2, 0, TCG_OPF_VECTOR) -DEF(and_vec, 1, 2, 0, IMPLVEC) -DEF(or_vec, 1, 2, 0, IMPLVEC) -DEF(xor_vec, 1, 2, 0, IMPLVEC) -DEF(andc_vec, 1, 2, 0, IMPLVEC) -DEF(orc_vec, 1, 2, 0, IMPLVEC) -DEF(nand_vec, 1, 2, 0, IMPLVEC) -DEF(nor_vec, 1, 2, 0, IMPLVEC) -DEF(eqv_vec, 1, 2, 0, IMPLVEC) -DEF(not_vec, 1, 1, 0, IMPLVEC) +DEF(and_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(or_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(xor_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(andc_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(orc_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(nand_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(nor_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(eqv_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(not_vec, 1, 1, 0, TCG_OPF_VECTOR) -DEF(shli_vec, 1, 1, 1, IMPLVEC) -DEF(shri_vec, 1, 1, 1, IMPLVEC) -DEF(sari_vec, 1, 1, 1, IMPLVEC) -DEF(rotli_vec, 1, 1, 1, IMPLVEC) +DEF(shli_vec, 1, 1, 1, TCG_OPF_VECTOR) +DEF(shri_vec, 1, 1, 1, TCG_OPF_VECTOR) +DEF(sari_vec, 1, 1, 1, TCG_OPF_VECTOR) +DEF(rotli_vec, 1, 1, 1, TCG_OPF_VECTOR) -DEF(shls_vec, 1, 2, 0, IMPLVEC) -DEF(shrs_vec, 1, 2, 0, IMPLVEC) -DEF(sars_vec, 1, 2, 0, IMPLVEC) -DEF(rotls_vec, 1, 2, 0, IMPLVEC) +DEF(shls_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(shrs_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(sars_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(rotls_vec, 1, 2, 0, TCG_OPF_VECTOR) -DEF(shlv_vec, 1, 2, 0, IMPLVEC) -DEF(shrv_vec, 1, 2, 0, IMPLVEC) -DEF(sarv_vec, 1, 2, 0, IMPLVEC) -DEF(rotlv_vec, 1, 2, 0, IMPLVEC) -DEF(rotrv_vec, 1, 2, 0, IMPLVEC) +DEF(shlv_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(shrv_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(sarv_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(rotlv_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(rotrv_vec, 1, 2, 0, TCG_OPF_VECTOR) -DEF(cmp_vec, 1, 2, 1, IMPLVEC) +DEF(cmp_vec, 1, 2, 1, TCG_OPF_VECTOR) -DEF(bitsel_vec, 1, 3, 0, IMPLVEC) -DEF(cmpsel_vec, 1, 4, 1, IMPLVEC) +DEF(bitsel_vec, 1, 3, 0, TCG_OPF_VECTOR) +DEF(cmpsel_vec, 1, 4, 1, TCG_OPF_VECTOR) DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)#include "tcg-target-opc.h.inc" #undef DATA64_ARGS -#undef IMPLVEC#undef DEF
tcg/aarch64/tcg-target-opc.h.inc +2 -2
@@ -11,5 +11,5 @@ * consider these to be UNSPEC with names. */ -DEF(aa64_sshl_vec, 1, 2, 0, IMPLVEC) -DEF(aa64_sli_vec, 1, 2, 1, IMPLVEC) +DEF(aa64_sshl_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(aa64_sli_vec, 1, 2, 1, TCG_OPF_VECTOR)
tcg/arm/tcg-target-opc.h.inc +3 -3
@@ -11,6 +11,6 @@ * consider these to be UNSPEC with names. */ -DEF(arm_sli_vec, 1, 2, 1, IMPLVEC) -DEF(arm_sshl_vec, 1, 2, 0, IMPLVEC) -DEF(arm_ushl_vec, 1, 2, 0, IMPLVEC) +DEF(arm_sli_vec, 1, 2, 1, TCG_OPF_VECTOR) +DEF(arm_sshl_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(arm_ushl_vec, 1, 2, 0, TCG_OPF_VECTOR)
tcg/i386/tcg-target-opc.h.inc +11 -11
@@ -24,14 +24,14 @@ * consider these to be UNSPEC with names. */ -DEF(x86_shufps_vec, 1, 2, 1, IMPLVEC) -DEF(x86_blend_vec, 1, 2, 1, IMPLVEC) -DEF(x86_packss_vec, 1, 2, 0, IMPLVEC) -DEF(x86_packus_vec, 1, 2, 0, IMPLVEC) -DEF(x86_psrldq_vec, 1, 1, 1, IMPLVEC) -DEF(x86_vperm2i128_vec, 1, 2, 1, IMPLVEC) -DEF(x86_punpckl_vec, 1, 2, 0, IMPLVEC) -DEF(x86_punpckh_vec, 1, 2, 0, IMPLVEC) -DEF(x86_vpshldi_vec, 1, 2, 1, IMPLVEC) -DEF(x86_vpshldv_vec, 1, 3, 0, IMPLVEC) -DEF(x86_vpshrdv_vec, 1, 3, 0, IMPLVEC) +DEF(x86_shufps_vec, 1, 2, 1, TCG_OPF_VECTOR) +DEF(x86_blend_vec, 1, 2, 1, TCG_OPF_VECTOR) +DEF(x86_packss_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(x86_packus_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(x86_psrldq_vec, 1, 1, 1, TCG_OPF_VECTOR) +DEF(x86_vperm2i128_vec, 1, 2, 1, TCG_OPF_VECTOR) +DEF(x86_punpckl_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(x86_punpckh_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(x86_vpshldi_vec, 1, 2, 1, TCG_OPF_VECTOR) +DEF(x86_vpshldv_vec, 1, 3, 0, TCG_OPF_VECTOR) +DEF(x86_vpshrdv_vec, 1, 3, 0, TCG_OPF_VECTOR)
tcg/ppc/tcg-target-opc.h.inc +6 -6
@@ -24,9 +24,9 @@ * consider these to be UNSPEC with names. */ -DEF(ppc_mrgh_vec, 1, 2, 0, IMPLVEC) -DEF(ppc_mrgl_vec, 1, 2, 0, IMPLVEC) -DEF(ppc_msum_vec, 1, 3, 0, IMPLVEC) -DEF(ppc_muleu_vec, 1, 2, 0, IMPLVEC) -DEF(ppc_mulou_vec, 1, 2, 0, IMPLVEC) -DEF(ppc_pkum_vec, 1, 2, 0, IMPLVEC) +DEF(ppc_mrgh_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(ppc_mrgl_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(ppc_msum_vec, 1, 3, 0, TCG_OPF_VECTOR) +DEF(ppc_muleu_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(ppc_mulou_vec, 1, 2, 0, TCG_OPF_VECTOR) +DEF(ppc_pkum_vec, 1, 2, 0, TCG_OPF_VECTOR)
tcg/s390x/tcg-target-opc.h.inc +3 -3
@@ -10,6 +10,6 @@ * emitted by tcg_expand_vec_op. For those familiar with GCC internals, * consider these to be UNSPEC with names. */ -DEF(s390_vuph_vec, 1, 1, 0, IMPLVEC) -DEF(s390_vupl_vec, 1, 1, 0, IMPLVEC) -DEF(s390_vpks_vec, 1, 2, 0, IMPLVEC) +DEF(s390_vuph_vec, 1, 1, 0, TCG_OPF_VECTOR) +DEF(s390_vupl_vec, 1, 1, 0, TCG_OPF_VECTOR) +DEF(s390_vpks_vec, 1, 2, 0, TCG_OPF_VECTOR)
Signature · 1 line
2.43.0
Re: [PATCH v2 31/81] tcg: Replace IMPLVEC with TCG_OPF_VECTOR
Quoted 11 lines · Richard Henderson
This is now a direct replacement.
Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg-opc.h | 89 +++++++++++++++----------------- tcg/aarch64/tcg-target-opc.h.inc | 4 +- tcg/arm/tcg-target-opc.h.inc | 6 +-- tcg/i386/tcg-target-opc.h.inc | 22 ++++---- tcg/ppc/tcg-target-opc.h.inc | 12 ++--- tcg/s390x/tcg-target-opc.h.inc | 6 +-- 6 files changed, 68 insertions(+), 71 deletions(-)
PATCH v2 32/81 tcg/mips: Expand bswap unconditionally
In reply to Richard HendersonWhile only mips32r2 has explicit instructions for bswap, we have built subroutines for bswap for use by qemu_ld/st. There's no reason not to expose those subroutines for general purpose use.
--- tcg/mips/tcg-target-has.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tcg/mips/tcg-target-has.h +4 -4
@@ -51,6 +51,7 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_muls2_i32 (!use_mips32r6_instructions)#define TCG_TARGET_HAS_muluh_i32 1#define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_negsetcond_i32 0
@@ -78,7 +79,6 @@ extern bool use_mips32r2_instructions;#endif /* optional instructions detected at runtime */ -#define TCG_TARGET_HAS_bswap16_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_sextract_i32 0
@@ -92,9 +92,9 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_qemu_st8_i32 0#if TCG_TARGET_REG_BITS ==64 -#define TCG_TARGET_HAS_bswap16_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_bswap32_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_bswap64_i64 use_mips32r2_instructions +#define TCG_TARGET_HAS_bswap16_i64 1 +#define TCG_TARGET_HAS_bswap32_i64 1 +#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_deposit_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_extract_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_sextract_i64 0
Signature · 1 line
2.43.0
Re: [PATCH v2 32/81] tcg/mips: Expand bswap unconditionally
Quoted 4 lines · Richard Henderson
While only mips32r2 has explicit instructions for bswap, we have built subroutines for bswap for use by qemu_ld/st. There's no reason not to expose those subroutines for general purpose use.
Something in the line of this sound simpler to understand to me:
"We always provide bswap subroutines, whether they are optimized using mips32r2 when available or not."
Quoted 5 lines
Signed-off-by Richard Henderson <[email protected]>--- tcg/mips/tcg-target-has.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
PATCH v2 33/81 tcg/i386: Handle all 8-bit extensions for i686
In reply to Richard HendersonWhen we generalize {s}extract_i32, we'll lose the specific register constraints on ext8u and ext8s. It's just as easy to emit a couple of insns instead.
--- tcg/i386/tcg-target.c.inc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
tcg/i386/tcg-target.c.inc +19 -4
@@ -1329,16 +1329,31 @@ static inline void tcg_out_rolw_8(TCGContext *s, int reg) static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src) { - /* movzbl */ - tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64); + if (TCG_TARGET_REG_BITS == 32 && src >= 4) { + tcg_out_mov(s, TCG_TYPE_I32, dest, src); + if (dest >= 4) { + tcg_out_modrm(s, OPC_ARITH_EvIz, ARITH_AND, dest); + tcg_out32(s, 0xff); + return; + } + src = dest; + } tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src); } static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW; - /* movsbl */ - tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64); + + if (TCG_TARGET_REG_BITS == 32 && src >= 4) { + tcg_out_mov(s, TCG_TYPE_I32, dest, src); + if (dest >= 4) { + tcg_out_shifti(s, SHIFT_SHL, dest, 24); + tcg_out_shifti(s, SHIFT_SAR, dest, 24); + return; + } + src = dest; + } tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src); }
Signature · 1 line
2.43.0
Re: [PATCH v2 33/81] tcg/i386: Handle all 8-bit extensions for i686
Quoted 39 lines · Richard Henderson
When we generalize {s}extract_i32, we'll lose the specific register constraints on ext8u and ext8s. It's just as easy to emit a couple of insns instead.
Signed-off-by Richard Henderson <[email protected]>--- tcg/i386/tcg-target.c.inc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)tcg/i386/tcg-target.c.inc +12
-4@@ -1329,16 +1329,31 @@ static inline void tcg_out_rolw_8(TCGContext *s, int reg) static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src) { - /* movzbl */ - tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64); + if (TCG_TARGET_REG_BITS == 32 && src >= 4) { + tcg_out_mov(s, TCG_TYPE_I32, dest, src); + if (dest >= 4) { + tcg_out_modrm(s, OPC_ARITH_EvIz, ARITH_AND, dest); + tcg_out32(s, 0xff); + return; + } + src = dest; + } tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src); } static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW; - /* movsbl */ - tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64); + + if (TCG_TARGET_REG_BITS == 32 && src >= 4) { + tcg_out_mov(s, TCG_TYPE_I32, dest, src);
tcg/i386/tcg-target.c.inc static inline void tcg_out_rolw_8(TCGContext *s, int reg) · line 1359
Quoted 10 lines
tcg/i386/tcg-target.c.inc +7
-0+ if (dest >= 4) { + tcg_out_shifti(s, SHIFT_SHL, dest, 24); + tcg_out_shifti(s, SHIFT_SAR, dest, 24); + return; + } + src = dest; + } tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src); }
PATCH v2 34/81 tcg/i386: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/i386/tcg-target-has.h | 49 +++++++++++++++++++++++++++---- tcg/tcg-has.h | 12 +++++--- tcg/optimize.c | 8 +++-- tcg/tcg-op.c | 12 +++----- tcg/i386/tcg-target.c.inc | 62 +++++++++++++++++++++++++++++---------- 5 files changed, 107 insertions(+), 36 deletions(-)
tcg/i386/tcg-target-has.h +43 -6
@@ -80,7 +80,7 @@#define TCG_TARGET_HAS_ctpop_i64 have_popcnt#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -130,10 +130,47 @@ (TCG_TARGET_REG_BITS == 32 && (ofs) == 8 && (len) == 8))#define TCG_TARGET_deposit_i64_valid TCG_TARGET_deposit_i32_valid -/* Check for the possibility of high-byte extraction and, for 64-bit, -zero-extending 32-bit right-shift. */ -#define TCG_TARGET_extract_i32_valid (ofs, len) ((ofs) == 8 && (len) == 8) -#define TCG_TARGET_extract_i64_valid (ofs, len) \ - (((ofs) == 8 && (len) == 8) || ((ofs) + (len)) == 32) +/* +* Check for the possibility of low byte/word extraction, high-byte extraction +* and zero-extending 32-bit right-shift. +* +* We cannot sign-extend from high byte to 64-bits without using the +* REX prefix that explicitly excludes access to the high-byte registers. +*/ +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +switch (ofs) { +case 0 : +switch (len) { +case 8 : +case 16 : +return true; +case 32 : +return type ==TCG_TYPE_I64 ; + } +return false; +case 8 : +return len ==8 && type ==TCG_TYPE_I32 ; + } +return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid + +static inline bool +tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +return true; + } +switch (ofs) { +case 0 : +return len ==8 || len ==16 ; +case 8 : +return len ==8 ; + } +return false; +} +#define TCG_TARGET_extract_valid tcg_target_extract_valid#endif
tcg/tcg-has.h +8 -4
@@ -56,11 +56,15 @@#ifndef TCG_TARGET_deposit_i64_valid#define TCG_TARGET_deposit_i64_valid (ofs, len) 1#endif -#ifndef TCG_TARGET_extract_i32_valid -#define TCG_TARGET_extract_i32_valid (ofs, len) 1 +#ifndef TCG_TARGET_extract_valid +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_extract_i32 \ + : TCG_TARGET_HAS_extract_i64)#endif -#ifndef TCG_TARGET_extract_i64_valid -#define TCG_TARGET_extract_i64_valid (ofs, len) 1 +#ifndef TCG_TARGET_sextract_valid +#define TCG_TARGET_sextract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_sextract_i32 \ + : TCG_TARGET_HAS_sextract_i64)#endif /* Only one of DIV or DIV2 should be defined. */
tcg/optimize.c +6 -2
@@ -2362,8 +2362,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) xor_opc = INDEX_op_xor_i32; shr_opc = INDEX_op_shr_i32; neg_opc = INDEX_op_neg_i32; -if (TCG_TARGET_extract_i32_valid (sh,1 )) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I32 , sh,1 )) { uext_opc = TCG_TARGET_HAS_extract_i32 ? INDEX_op_extract_i32 :0 ; + } +if (TCG_TARGET_sextract_valid (TCG_TYPE_I32 , sh,1 )) { sext_opc = TCG_TARGET_HAS_sextract_i32 ? INDEX_op_sextract_i32 :0 ; }break ;
@@ -2373,8 +2375,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) xor_opc = INDEX_op_xor_i64; shr_opc = INDEX_op_shr_i64; neg_opc = INDEX_op_neg_i64; -if (TCG_TARGET_extract_i64_valid (sh,1 )) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I64 , sh,1 )) { uext_opc = TCG_TARGET_HAS_extract_i64 ? INDEX_op_extract_i64 :0 ; + } +if (TCG_TARGET_sextract_valid (TCG_TYPE_I64 , sh,1 )) { sext_opc = TCG_TARGET_HAS_sextract_i64 ? INDEX_op_sextract_i64 :0 ; }break ;
tcg/tcg-op.c +4 -8
@@ -1014,8 +1014,7 @@ void tcg_gen_extract_i32(TCGv_i32 ret, TCGv_i32 arg,return ; } -if (TCG_TARGET_HAS_extract_i32 - &&TCG_TARGET_extract_i32_valid (ofs, len)) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I32 , ofs, len)) {tcg_gen_op4ii_i32 (INDEX_op_extract_i32, ret, arg, ofs, len);return ; }
@@ -1077,8 +1076,7 @@ void tcg_gen_sextract_i32(TCGv_i32 ret, TCGv_i32 arg, } } -if (TCG_TARGET_HAS_sextract_i32 - &&TCG_TARGET_extract_i32_valid (ofs, len)) { +if (TCG_TARGET_sextract_valid (TCG_TYPE_I32 , ofs, len)) {tcg_gen_op4ii_i32 (INDEX_op_sextract_i32, ret, arg, ofs, len);return ; }
@@ -2811,8 +2809,7 @@ void tcg_gen_extract_i64(TCGv_i64 ret, TCGv_i64 arg, goto do_shift_and; } -if (TCG_TARGET_HAS_extract_i64 - &&TCG_TARGET_extract_i64_valid (ofs, len)) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I64 , ofs, len)) {tcg_gen_op4ii_i64 (INDEX_op_extract_i64, ret, arg, ofs, len);return ; }
@@ -2917,8 +2914,7 @@ void tcg_gen_sextract_i64(TCGv_i64 ret, TCGv_i64 arg,return ; } -if (TCG_TARGET_HAS_sextract_i64 - &&TCG_TARGET_extract_i64_valid (ofs, len)) { +if (TCG_TARGET_sextract_valid (TCG_TYPE_I64 , ofs, len)) {tcg_gen_op4ii_i64 (INDEX_op_sextract_i64, ret, arg, ofs, len);return ; }
tcg/i386/tcg-target.c.inc +46 -16
86 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 34/81] tcg/i386: Fold the ext{8,16,32}[us] cases into {s}extract
Quoted 260 lines · Richard Henderson
Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/i386/tcg-target-has.h | 49 +++++++++++++++++++++++++++---- tcg/tcg-has.h | 12 +++++--- tcg/optimize.c | 8 +++-- tcg/tcg-op.c | 12 +++----- tcg/i386/tcg-target.c.inc | 62 +++++++++++++++++++++++++++++---------- 5 files changed, 107 insertions(+), 36 deletions(-)tcg/i386/tcg-target-has.h +43
-6@@ -80,7 +80,7 @@#define TCG_TARGET_HAS_ctpop_i64 have_popcnt#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1@@ -130,10 +130,47 @@ (TCG_TARGET_REG_BITS == 32 && (ofs) == 8 && (len) == 8))#define TCG_TARGET_deposit_i64_valid TCG_TARGET_deposit_i32_valid -/* Check for the possibility of high-byte extraction and, for 64-bit, -zero-extending 32-bit right-shift. */ -#define TCG_TARGET_extract_i32_valid (ofs, len) ((ofs) == 8 && (len) == 8) -#define TCG_TARGET_extract_i64_valid (ofs, len) \ - (((ofs) == 8 && (len) == 8) || ((ofs) + (len)) == 32) +/* +* Check for the possibility of low byte/word extraction, high-byte extraction +* and zero-extending 32-bit right-shift. +* +* We cannot sign-extend from high byte to 64-bits without using the +* REX prefix that explicitly excludes access to the high-byte registers. +*/ +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +switch (ofs) { +case 0 : +switch (len) { +case 8 : +case 16 : +return true; +case 32 : +return type ==TCG_TYPE_I64 ; + } +return false; +case 8 : +return len ==8 && type ==TCG_TYPE_I32 ; + } +return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid + +static inline bool +tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +return true; + } +switch (ofs) { +case 0 : +return len ==8 || len ==16 ; +case 8 : +return len ==8 ; + } +return false; +} +#define TCG_TARGET_extract_valid tcg_target_extract_valid#endif tcg/tcg-has.h +8
-4@@ -56,11 +56,15 @@#ifndef TCG_TARGET_deposit_i64_valid#define TCG_TARGET_deposit_i64_valid (ofs, len) 1#endif -#ifndef TCG_TARGET_extract_i32_valid -#define TCG_TARGET_extract_i32_valid (ofs, len) 1 +#ifndef TCG_TARGET_extract_valid +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_extract_i32 \ + : TCG_TARGET_HAS_extract_i64)#endif -#ifndef TCG_TARGET_extract_i64_valid -#define TCG_TARGET_extract_i64_valid (ofs, len) 1 +#ifndef TCG_TARGET_sextract_valid +#define TCG_TARGET_sextract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_sextract_i32 \ + : TCG_TARGET_HAS_sextract_i64)#endif /* Only one of DIV or DIV2 should be defined. */ tcg/optimize.c +6
-2@@ -2362,8 +2362,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) xor_opc = INDEX_op_xor_i32; shr_opc = INDEX_op_shr_i32; neg_opc = INDEX_op_neg_i32; -if (TCG_TARGET_extract_i32_valid (sh,1 )) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I32 , sh,1 )) { uext_opc = TCG_TARGET_HAS_extract_i32 ? INDEX_op_extract_i32 :0 ; + } +if (TCG_TARGET_sextract_valid (TCG_TYPE_I32 , sh,1 )) { sext_opc = TCG_TARGET_HAS_sextract_i32 ? INDEX_op_sextract_i32 :0 ; }break ;@@ -2373,8 +2375,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) xor_opc = INDEX_op_xor_i64; shr_opc = INDEX_op_shr_i64; neg_opc = INDEX_op_neg_i64; -if (TCG_TARGET_extract_i64_valid (sh,1 )) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I64 , sh,1 )) { uext_opc = TCG_TARGET_HAS_extract_i64 ? INDEX_op_extract_i64 :0 ; + } +if (TCG_TARGET_sextract_valid (TCG_TYPE_I64 , sh,1 )) { sext_opc = TCG_TARGET_HAS_sextract_i64 ? INDEX_op_sextract_i64 :0 ; }break ;tcg/tcg-op.c +4
-8@@ -1014,8 +1014,7 @@ void tcg_gen_extract_i32(TCGv_i32 ret, TCGv_i32 arg,return ; } -if (TCG_TARGET_HAS_extract_i32 - &&TCG_TARGET_extract_i32_valid (ofs, len)) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I32 , ofs, len)) {tcg_gen_op4ii_i32 (INDEX_op_extract_i32, ret, arg, ofs, len);return ; }@@ -1077,8 +1076,7 @@ void tcg_gen_sextract_i32(TCGv_i32 ret, TCGv_i32 arg, } } -if (TCG_TARGET_HAS_sextract_i32 - &&TCG_TARGET_extract_i32_valid (ofs, len)) { +if (TCG_TARGET_sextract_valid (TCG_TYPE_I32 , ofs, len)) {tcg_gen_op4ii_i32 (INDEX_op_sextract_i32, ret, arg, ofs, len);return ; }@@ -2811,8 +2809,7 @@ void tcg_gen_extract_i64(TCGv_i64 ret, TCGv_i64 arg, goto do_shift_and; } -if (TCG_TARGET_HAS_extract_i64 - &&TCG_TARGET_extract_i64_valid (ofs, len)) { +if (TCG_TARGET_extract_valid (TCG_TYPE_I64 , ofs, len)) {tcg_gen_op4ii_i64 (INDEX_op_extract_i64, ret, arg, ofs, len);return ; }@@ -2917,8 +2914,7 @@ void tcg_gen_sextract_i64(TCGv_i64 ret, TCGv_i64 arg,return ; } -if (TCG_TARGET_HAS_sextract_i64 - &&TCG_TARGET_extract_i64_valid (ofs, len)) { +if (TCG_TARGET_sextract_valid (TCG_TYPE_I64 , ofs, len)) {tcg_gen_op4ii_i64 (INDEX_op_sextract_i64, ret, arg, ofs, len);return ; }tcg/i386/tcg-target.c.inc +45
-16@@ -3036,6 +3036,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_extract_i64: if (a2 + args[3] == 32) { + if (a2 == 0) { + tcg_out_ext32u(s, a0, a1); + break; + } /* This is a 32-bit zero-extending right shift. */ tcg_out_mov(s, TCG_TYPE_I32, a0, a1); tcg_out_shifti(s, SHIFT_SHR, a0, a2);@@ -3043,28 +3047,53 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, } /* FALLTHRU */ case INDEX_op_extract_i32: - /* On the off-chance that we can use the high-byte registers. - Otherwise we emit the same ext16 + shift pattern that we - would have gotten from the normal tcg-op.c expansion. */ - tcg_debug_assert(a2 == 8 && args[3] == 8); - if (a1 < 4 && a0 < 8) { - tcg_out_modrm(s, OPC_MOVZBL, a0, a1 + 4); - } else { + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8u(s, a0, a1); + } else if (a2 == 0 && args[3] == 16) { tcg_out_ext16u(s, a0, a1); - tcg_out_shifti(s, SHIFT_SHR, a0, 8); + } else if (a2 == 8 && args[3] == 8) { + /* + * On the off-chance that we can use the high-byte registers. + * Otherwise we emit the same ext16 + shift pattern that we + * would have gotten from the normal tcg-op.c expansion. + */ + if (a1 < 4 && a0 < 8) { + tcg_out_modrm(s, OPC_MOVZBL, a0, a1 + 4); + } else { + tcg_out_ext16u(s, a0, a1); + tcg_out_shifti(s, SHIFT_SHR, a0, 8); + } + } else { + g_assert_not_reached(); + } + break; + + case INDEX_op_sextract_i64: + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_I64, a0, a1); + } else if (a2 == 0 && args[3] == 16) { + tcg_out_ext16s(s, TCG_TYPE_I64, a0, a1); + } else if (a2 == 0 && args[3] == 32) { + tcg_out_ext32s(s, a0, a1); + } else { + g_assert_not_reached(); } break; case INDEX_op_sextract_i32: - /* We don't implement sextract_i64, as we cannot sign-extend to - 64-bits without using the REX prefix that explicitly excludes - access to the high-byte registers. */ - tcg_debug_assert(a2 == 8 && args[3] == 8); - if (a1 < 4 && a0 < 8) { - tcg_out_modrm(s, OPC_MOVSBL, a0, a1 + 4); - } else { + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_I32, a0, a1); + } else if (a2 == 0 && args[3] == 16) { tcg_out_ext16s(s, TCG_TYPE_I32, a0, a1); - tcg_out_shifti(s, SHIFT_SAR, a0, 8); + } else if (a2 == 8 && args[3] == 8) { + if (a1 < 4 && a0 < 8) { + tcg_out_modrm(s, OPC_MOVSBL, a0, a1 + 4); + } else { + tcg_out_ext16s(s, TCG_TYPE_I32, a0, a1); + tcg_out_shifti(s, SHIFT_SAR, a0, 8); + } + } else { + g_assert_not_reached(); } break;
tcg/i386/tcg-target.c.inc tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) · line 3782
Quoted 7 lines
tcg/i386/tcg-target.c.inc +1
-0@@ -3747,6 +3776,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_extract_i32: case INDEX_op_extract_i64: case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: case INDEX_op_ctpop_i32: case INDEX_op_ctpop_i64: return C_O1_I1(r, r);
To the best of my knowledge,
PATCH v2 35/81 tcg/aarch64: Provide TCG_TARGET_{s}extract_valid
In reply to Richard HendersonTrivially mirrors TCG_TARGET_HAS_{s}extract_*.
--- tcg/aarch64/tcg-target-has.h | 3 +++ 1 file changed, 3 insertions(+)
tcg/aarch64/tcg-target-has.h +3 -0
@@ -116,4 +116,7 @@#define TCG_TARGET_HAS_cmpsel_vec 0#define TCG_TARGET_HAS_tst_vec 1 +#define TCG_TARGET_extract_valid (type, ofs, len) 1 +#define TCG_TARGET_sextract_valid (type, ofs, len) 1 +#endif
Signature · 1 line
2.43.0
Re: [PATCH v2 35/81] tcg/aarch64: Provide TCG_TARGET_{s}extract_valid
Quoted 6 lines · Richard Henderson
Trivially mirrors TCG_TARGET_HAS_{s}extract_*.
Signed-off-by Richard Henderson <[email protected]>--- tcg/aarch64/tcg-target-has.h | 3 +++ 1 file changed, 3 insertions(+)
PATCH v2 36/81 tcg/aarch64: Expand extract with offset 0 with andi
In reply to Richard HendersonWe're about to change canonicalization of masks as extract instead of and. Retain the andi expansion here.
--- tcg/aarch64/tcg-target.c.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tcg/aarch64/tcg-target.c.inc +6 -1
@@ -2450,7 +2450,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType ext, case INDEX_op_extract_i64: case INDEX_op_extract_i32: - tcg_out_ubfm(s, ext, a0, a1, a2, a2 + args[3] - 1); + if (a2 == 0) { + uint64_t mask = MAKE_64BIT_MASK(0, args[3]); + tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, mask); + } else { + tcg_out_ubfm(s, ext, a0, a1, a2, a2 + args[3] - 1); + } break; case INDEX_op_sextract_i64:
Signature · 1 line
2.43.0
Re: [PATCH v2 36/81] tcg/aarch64: Expand extract with offset 0 with andi
Quoted 7 lines · Richard Henderson
We're about to change canonicalization of masks as extract instead of and. Retain the andi expansion here.
Signed-off-by Richard Henderson <[email protected]>--- tcg/aarch64/tcg-target.c.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
PATCH v2 37/81 tcg/arm: Add full [US]XT[BH] into {s}extract
In reply to Richard HendersonThe armv6 uxt and sxt opcodes have a 2-bit rotate field which supports extractions from ofs = {0,8,16,24}. Special case ofs = 0, len <= 8 as AND.
--- tcg/arm/tcg-target-has.h | 17 +++++++++++++ tcg/arm/tcg-target.c.inc | 54 +++++++++++++++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 6 deletions(-)
tcg/arm/tcg-target-has.h +17 -0
@@ -82,4 +82,21 @@ extern bool use_neon_instructions;#define TCG_TARGET_HAS_cmpsel_vec 0#define TCG_TARGET_HAS_tst_vec 1 +static inline bool +tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (use_armv7_instructions) { +return true;/* SBFX or UBFX */ + } +switch (len) { +case 8 :/* SXTB or UXTB */ +case 16 :/* SXTH or UXTH */ +return (ofs %8 ) ==0 ; + } +return false; +} + +#define TCG_TARGET_extract_valid tcg_target_extract_valid +#define TCG_TARGET_sextract_valid tcg_target_extract_valid +#endif
tcg/arm/tcg-target.c.inc +48 -6
67 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 37/81] tcg/arm: Add full [US]XT[BH] into {s}extract
tcg/arm/tcg-target-has.h
Quoted 12 lines · Richard Henderson
The armv6 uxt and sxt opcodes have a 2-bit rotate field which supports extractions from ofs = {0,8,16,24}. Special case ofs = 0, len <= 8 as AND.
Signed-off-by Richard Henderson <[email protected]>--- tcg/arm/tcg-target-has.h | 17 +++++++++++++ tcg/arm/tcg-target.c.inc | 54 +++++++++++++++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 6 deletions(-)tcg/arm/tcg-target-has.h +0
-0
Missing:
-- >8 --
@@ -41,8 +41,8 @@ extern bool use_neon_instructions;
#define TCG_TARGET_HAS_ctz_i32 use_armv7_instructions #define TCG_TARGET_HAS_ctpop_i32 0 #define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions -#define TCG_TARGET_HAS_extract_i32 use_armv7_instructions -#define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_mulu2_i32 1
---
Quoted 24 lines
tcg/arm/tcg-target-has.h +17
-0@@ -82,4 +82,21 @@ extern bool use_neon_instructions;#define TCG_TARGET_HAS_cmpsel_vec 0#define TCG_TARGET_HAS_tst_vec 1 +static inline bool +tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (use_armv7_instructions) { +return true;/* SBFX or UBFX */ + } +switch (len) { +case 8 :/* SXTB or UXTB */ +case 16 :/* SXTH or UXTH */ +return (ofs %8 ) ==0 ; + } +return false; +} + +#define TCG_TARGET_extract_valid tcg_target_extract_valid +#define TCG_TARGET_sextract_valid tcg_target_extract_valid +#endif
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v2 37/81] tcg/arm: Add full [US]XT[BH] into {s}extract
Quoted 19 lines · Philippe Mathieu-Daudé
tcg/arm/tcg-target-has.h
Quoted 12 lines · Richard Henderson
The armv6 uxt and sxt opcodes have a 2-bit rotate field which supports extractions from ofs = {0,8,16,24}. Special case ofs = 0, len <= 8 as AND.
Signed-off-by Richard Henderson <[email protected]>---
tcg/arm/tcg-target-has.h| 17 +++++++++++++ tcg/arm/tcg-target.c.inc | 54 +++++++++++++++++++++++++++++++++++-----2 files changed, 65 insertions(+), 6 deletions(-)tcg/arm/tcg-target-has.h +0
-0Missing:
-- >8 --
(quoted diff) +0
-0@@ -41,8 +41,8 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_ctz_i32 use_armv7_instructions
Review extern bool use_neon_instructions;
Quoted 10 lines
(quoted diff) +2
-3#define TCG_TARGET_HAS_ctpop_i32 0 #define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions -#define TCG_TARGET_HAS_extract_i32 use_armv7_instructions -#define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_mulu2_i32 1 ---
With that chunk squashed:
PATCH v2 38/81 tcg/loongarch64: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/loongarch64/tcg-target-has.h | 15 ++++++++++++-- tcg/loongarch64/tcg-target.c.inc | 34 ++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-)
tcg/loongarch64/tcg-target-has.h +13 -2
@@ -17,7 +17,7 @@#define TCG_TARGET_HAS_rot_i32 1#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 0#define TCG_TARGET_HAS_sub2_i32 0
@@ -52,7 +52,7 @@#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
@@ -109,5 +109,16 @@#define TCG_TARGET_HAS_cmpsel_vec 0#define TCG_TARGET_HAS_tst_vec 0 +#define TCG_TARGET_extract_valid (type, ofs, len) 1 + +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +return true; + } +return ofs ==0 && (len ==8 || len ==16 ); +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid#endif
tcg/loongarch64/tcg-target.c.inc +32 -2
@@ -1375,10 +1375,38 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, break; case INDEX_op_extract_i32: - tcg_out_opc_bstrpick_w(s, a0, a1, a2, a2 + args[3] - 1); + if (a2 == 0 && args[3] <= 12) { + tcg_out_opc_andi(s, a0, a1, (1 << args[3]) - 1); + } else { + tcg_out_opc_bstrpick_w(s, a0, a1, a2, a2 + args[3] - 1); + } break; case INDEX_op_extract_i64: - tcg_out_opc_bstrpick_d(s, a0, a1, a2, a2 + args[3] - 1); + if (a2 == 0 && args[3] <= 12) { + tcg_out_opc_andi(s, a0, a1, (1 << args[3]) - 1); + } else { + tcg_out_opc_bstrpick_d(s, a0, a1, a2, a2 + args[3] - 1); + } + break; + + case INDEX_op_sextract_i64: + if (a2 + args[3] == 32) { + if (a2 == 0) { + tcg_out_ext32s(s, a0, a1); + } else { + tcg_out_opc_srai_w(s, a0, a1, a2); + } + break; + } + /* FALLTHRU */ + case INDEX_op_sextract_i32: + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_REG, a0, a1); + } else if (a2 == 0 && args[3] == 16) { + tcg_out_ext16s(s, TCG_TYPE_REG, a0, a1); + } else { + g_assert_not_reached(); + } break; case INDEX_op_deposit_i32:
@@ -2243,6 +2271,8 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_not_i64: case INDEX_op_extract_i32: case INDEX_op_extract_i64: + case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: case INDEX_op_bswap32_i32:
Signature · 1 line
2.43.0
Re: [PATCH v2 38/81] tcg/loongarch64: Fold the ext{8, 16, 32}[us] cases into {s}extract
Quoted 8 lines · Richard Henderson
Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/loongarch64/tcg-target-has.h | 15 ++++++++++++-- tcg/loongarch64/tcg-target.c.inc | 34 ++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-)
PATCH v2 39/81 tcg/mips: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept AND, ext32u, ext32s extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/mips/tcg-target-has.h | 26 ++++++++++++++++++++++---- tcg/mips/tcg-target.c.inc | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 7 deletions(-)
tcg/mips/tcg-target-has.h +22 -4
@@ -80,8 +80,8 @@ extern bool use_mips32r2_instructions;/* optional instructions detected at runtime */ #define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions -#define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_ext8s_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i32 use_mips32r2_instructions
@@ -96,8 +96,8 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_deposit_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_extract_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_ext8s_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i64 use_mips32r2_instructions
@@ -119,4 +119,22 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_qemu_ldst_i128 0#define TCG_TARGET_HAS_tst 0 +#define TCG_TARGET_extract_valid (type, ofs, len) use_mips32r2_instructions + +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (ofs ==0 ) { +switch (len) { +case 8 : +case 16 : +return use_mips32r2_instructions; +case 32 : +return type ==TCG_TYPE_I64 ; + } + } +return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid +#endif
tcg/mips/tcg-target.c.inc +30 -3
@@ -2041,12 +2041,37 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_opc_bf64(s, OPC_DINS, OPC_DINSM, OPC_DINSU, a0, a2, args[3] + args[4] - 1, args[3]); break; + case INDEX_op_extract_i32: - tcg_out_opc_bf(s, OPC_EXT, a0, a1, args[3] - 1, a2); + if (a2 == 0 && args[3] <= 16) { + tcg_out_opc_imm(s, OPC_ANDI, a0, a1, (1 << args[3]) - 1); + } else { + tcg_out_opc_bf(s, OPC_EXT, a0, a1, args[3] - 1, a2); + } break; case INDEX_op_extract_i64: - tcg_out_opc_bf64(s, OPC_DEXT, OPC_DEXTM, OPC_DEXTU, a0, a1, - args[3] - 1, a2); + if (a2 == 0 && args[3] <= 16) { + tcg_out_opc_imm(s, OPC_ANDI, a0, a1, (1 << args[3]) - 1); + } else { + tcg_out_opc_bf64(s, OPC_DEXT, OPC_DEXTM, OPC_DEXTU, + a0, a1, args[3] - 1, a2); + } + break; + + case INDEX_op_sextract_i64: + if (a2 == 0 && args[3] == 32) { + tcg_out_ext32s(s, a0, a1); + break; + } + /* FALLTHRU */ + case INDEX_op_sextract_i32: + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_REG, a0, a1); + } else if (a2 == 0 && args[3] == 16) { + tcg_out_ext16s(s, TCG_TYPE_REG, a0, a1); + } else { + g_assert_not_reached(); + } break; case INDEX_op_brcond_i32:
@@ -2170,6 +2195,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_ext8s_i32: case INDEX_op_ext16s_i32: case INDEX_op_extract_i32: + case INDEX_op_sextract_i32: case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64:
@@ -2191,6 +2217,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32: case INDEX_op_extract_i64: + case INDEX_op_sextract_i64: return C_O1_I1(r, r); case INDEX_op_st8_i32:
Signature · 1 line
2.43.0
Re: [PATCH v2 39/81] tcg/mips: Fold the ext{8,16,32}[us] cases into {s}extract
Quoted 8 lines · Richard Henderson
Accept AND, ext32u, ext32s extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/mips/tcg-target-has.h | 26 ++++++++++++++++++++++---- tcg/mips/tcg-target.c.inc | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 7 deletions(-)
PATCH v2 40/81 tcg/ppc: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/ppc/tcg-target-has.h | 16 ++++++++++++++-- tcg/ppc/tcg-target.c.inc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)
tcg/ppc/tcg-target-has.h +14 -2
@@ -39,7 +39,7 @@#define TCG_TARGET_HAS_ctpop_i32 have_isa_2_06#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_mulu2_i32 0
@@ -75,7 +75,7 @@#define TCG_TARGET_HAS_ctpop_i64 have_isa_2_06#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -121,4 +121,16 @@#define TCG_TARGET_HAS_cmpsel_vec 1#define TCG_TARGET_HAS_tst_vec 0 +#define TCG_TARGET_extract_valid (type, ofs, len) 1 + +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +return true; + } +return ofs ==0 && (len ==8 || len ==16 ); +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid +#endif
tcg/ppc/tcg-target.c.inc +30 -0
@@ -3430,13 +3430,41 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, break; case INDEX_op_extract_i32: + if (args[2] == 0 && args[3] <= 16) { + tcg_out32(s, ANDI | SAI(args[1], args[0], (1 << args[3]) - 1)); + break; + } tcg_out_rlw(s, RLWINM, args[0], args[1], 32 - args[2], 32 - args[3], 31); break; case INDEX_op_extract_i64: + if (args[2] == 0 && args[3] <= 16) { + tcg_out32(s, ANDI | SAI(args[1], args[0], (1 << args[3]) - 1)); + break; + } tcg_out_rld(s, RLDICL, args[0], args[1], 64 - args[2], 64 - args[3]); break; + case INDEX_op_sextract_i64: + if (args[2] + args[3] == 32) { + if (args[2] == 0) { + tcg_out_ext32s(s, args[0], args[1]); + } else { + tcg_out_sari32(s, args[0], args[1], args[2]); + } + break; + } + /* FALLTHRU */ + case INDEX_op_sextract_i32: + if (args[2] == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_I32, args[0], args[1]); + } else if (args[2] == 0 && args[3] == 16) { + tcg_out_ext16s(s, TCG_TYPE_I32, args[0], args[1]); + } else { + g_assert_not_reached(); + } + break; + case INDEX_op_movcond_i32: tcg_out_movcond(s, TCG_TYPE_I32, args[5], args[0], args[1], args[2], args[3], args[4], const_args[2]);
@@ -4160,6 +4188,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: case INDEX_op_extract_i32: + case INDEX_op_sextract_i32: case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64:
@@ -4179,6 +4208,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_bswap32_i64: case INDEX_op_bswap64_i64: case INDEX_op_extract_i64: + case INDEX_op_sextract_i64: return C_O1_I1(r, r); case INDEX_op_st8_i32:
Signature · 1 line
2.43.0
Re: [PATCH v2 40/81] tcg/ppc: Fold the ext{8,16,32}[us] cases into {s}extract
Quoted 8 lines · Richard Henderson
Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/ppc/tcg-target-has.h | 16 ++++++++++++++-- tcg/ppc/tcg-target.c.inc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)
PATCH v2 41/81 tcg/riscv64: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/riscv/tcg-target-has.h | 39 ++++++++++++++++++++++++++++++++++---- tcg/riscv/tcg-target.c.inc | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-)
tcg/riscv/tcg-target-has.h +35 -4
@@ -16,8 +16,8 @@#define TCG_TARGET_HAS_div2_i32 0#define TCG_TARGET_HAS_rot_i32 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 1#define TCG_TARGET_HAS_sub2_i32 1
@@ -50,8 +50,8 @@#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
@@ -109,4 +109,35 @@#define TCG_TARGET_HAS_tst_vec 0 +static inline bool +tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (ofs ==0 ) { +switch (len) { +case 16 : +return cpuinfo &CPUINFO_ZBB ; +case 32 : +return (cpuinfo &CPUINFO_ZBA ) && type ==TCG_TYPE_I64 ; + } + } +return false; +} +#define TCG_TARGET_extract_valid tcg_target_extract_valid + +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (ofs ==0 ) { +switch (len) { +case 8 : +case 16 : +return cpuinfo &CPUINFO_ZBB ; +case 32 : +return type ==TCG_TYPE_I64 ; + } + } +return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid +#endif
tcg/riscv/tcg-target.c.inc +34 -0
@@ -2343,6 +2343,36 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_mb(s, a0); break; + case INDEX_op_extract_i64: + if (a2 == 0 && args[3] == 32) { + tcg_out_ext32u(s, a0, a1); + break; + } + /* FALLTHRU */ + case INDEX_op_extract_i32: + if (a2 == 0 && args[3] == 16) { + tcg_out_ext16u(s, a0, a1); + } else { + g_assert_not_reached(); + } + break; + + case INDEX_op_sextract_i64: + if (a2 == 0 && args[3] == 32) { + tcg_out_ext32s(s, a0, a1); + break; + } + /* FALLTHRU */ + case INDEX_op_sextract_i32: + if (a2 == 0 && args[3] == 8) { + tcg_out_ext8s(s, TCG_TYPE_REG, a0, a1); + } else if (a2 == 0 && args[3] == 16) { + tcg_out_ext16s(s, TCG_TYPE_REG, a0, a1); + } else { + g_assert_not_reached(); + } + break; + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */
@@ -2620,6 +2650,10 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32: case INDEX_op_ext_i32_i64: + case INDEX_op_extract_i32: + case INDEX_op_extract_i64: + case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: case INDEX_op_bswap16_i64:
Signature · 1 line
2.43.0
Re: [PATCH v2 41/81] tcg/riscv64: Fold the ext{8,16,32}[us] cases into {s}extract
Quoted 8 lines · Richard Henderson
Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/riscv/tcg-target-has.h | 39 ++++++++++++++++++++++++++++++++++---- tcg/riscv/tcg-target.c.inc | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-)
PATCH v2 42/81 tcg/riscv: Use SRAIW, SRLIW for {s}extract_i64
In reply to Richard HendersonExtracts which abut bit 32 may use 32-bit shifts.
--- tcg/riscv/tcg-target-has.h | 24 +++++++----------------- tcg/riscv/tcg-target.c.inc | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 21 deletions(-)
tcg/riscv/tcg-target-has.h +7 -17
@@ -112,31 +112,21 @@static inline bool tcg_target_extract_valid (TCGType type,unsigned ofs,unsigned len) { -if (ofs ==0 ) { -switch (len) { -case 16 : -return cpuinfo &CPUINFO_ZBB ; -case 32 : -return (cpuinfo &CPUINFO_ZBA ) && type ==TCG_TYPE_I64 ; - } +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +/* ofs > 0 uses SRLIW; ofs == 0 uses add.uw. */ +return ofs || (cpuinfo &CPUINFO_ZBA ); } -return false; +return (cpuinfo &CPUINFO_ZBB ) && ofs ==0 && len ==16 ; }#define TCG_TARGET_extract_valid tcg_target_extract_validstatic inline bool tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) { -if (ofs ==0 ) { -switch (len) { -case 8 : -case 16 : -return cpuinfo &CPUINFO_ZBB ; -case 32 : -return type ==TCG_TYPE_I64 ; - } +if (type ==TCG_TYPE_I64 && ofs + len ==32 ) { +return true; } -return false; +return (cpuinfo &CPUINFO_ZBB ) && ofs ==0 && (len ==8 || len ==16 ); }#define TCG_TARGET_sextract_valid tcg_target_sextract_valid
tcg/riscv/tcg-target.c.inc +12 -4
@@ -2344,8 +2344,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, break; case INDEX_op_extract_i64: - if (a2 == 0 && args[3] == 32) { - tcg_out_ext32u(s, a0, a1); + if (a2 + args[3] == 32) { + if (a2 == 0) { + tcg_out_ext32u(s, a0, a1); + } else { + tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2); + } break; } /* FALLTHRU */
@@ -2358,8 +2362,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, break; case INDEX_op_sextract_i64: - if (a2 == 0 && args[3] == 32) { - tcg_out_ext32s(s, a0, a1); + if (a2 + args[3] == 32) { + if (a2 == 0) { + tcg_out_ext32s(s, a0, a1); + } else { + tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2); + } break; } /* FALLTHRU */
Signature · 1 line
2.43.0
Re: [PATCH v2 42/81] tcg/riscv: Use SRAIW, SRLIW for {s}extract_i64
Quoted 7 lines · Richard Henderson
Extracts which abut bit 32 may use 32-bit shifts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/riscv/tcg-target-has.h | 24 +++++++----------------- tcg/riscv/tcg-target.c.inc | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 21 deletions(-)
PATCH v2 43/81 tcg/s390x: Fold the ext{8, 16, 32}[us] cases into {s}extract
In reply to Richard HendersonAccept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
--- tcg/s390x/tcg-target-has.h | 22 ++++++++++++++++++++-- tcg/s390x/tcg-target.c.inc | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-)
tcg/s390x/tcg-target-has.h +20 -2
@@ -48,7 +48,7 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_ctpop_i32 1#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -82,7 +82,7 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_ctpop_i64 1#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -121,4 +121,22 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_cmpsel_vec 1#define TCG_TARGET_HAS_tst_vec 0 +#define TCG_TARGET_extract_valid (type, ofs, len) 1 + +static inline bool +tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len) +{ +if (ofs ==0 ) { +switch (len) { +case 8 : +case 16 : +return true; +case 32 : +return type ==TCG_TYPE_I64 ; + } + } +return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid +#endif
tcg/s390x/tcg-target.c.inc +37 -0
@@ -1572,9 +1572,41 @@ static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, static void tgen_extract(TCGContext *s, TCGReg dest, TCGReg src, int ofs, int len) { + if (ofs == 0) { + switch (len) { + case 8: + tcg_out_ext8u(s, dest, src); + return; + case 16: + tcg_out_ext16u(s, dest, src); + return; + case 32: + tcg_out_ext32u(s, dest, src); + return; + } + } tcg_out_risbg(s, dest, src, 64 - len, 63, 64 - ofs, 1); } +static void tgen_sextract(TCGContext *s, TCGReg dest, TCGReg src, + int ofs, int len) +{ + if (ofs == 0) { + switch (len) { + case 8: + tcg_out_ext8s(s, TCG_TYPE_REG, dest, src); + return; + case 16: + tcg_out_ext16s(s, TCG_TYPE_REG, dest, src); + return; + case 32: + tcg_out_ext32s(s, dest, src); + return; + } + } + g_assert_not_reached(); +} + static void tgen_gotoi(TCGContext *s, int cc, const tcg_insn_unit *dest) { ptrdiff_t off = tcg_pcrel_diff(s, dest) >> 1;
@@ -2726,6 +2758,9 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, OP_32_64(extract): tgen_extract(s, args[0], args[1], args[2], args[3]); break; + OP_32_64(sextract): + tgen_sextract(s, args[0], args[1], args[2], args[3]); + break; case INDEX_op_clz_i64: tgen_clz(s, args[0], args[1], args[2], const_args[2]);
@@ -3325,6 +3360,8 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_extu_i32_i64: case INDEX_op_extract_i32: case INDEX_op_extract_i64: + case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: case INDEX_op_ctpop_i32: case INDEX_op_ctpop_i64: return C_O1_I1(r, r);
Signature · 1 line
2.43.0
Re: [PATCH v2 43/81] tcg/s390x: Fold the ext{8, 16, 32}[us] cases into {s}extract
Quoted 8 lines · Richard Henderson
Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/s390x/tcg-target-has.h | 22 ++++++++++++++++++++-- tcg/s390x/tcg-target.c.inc | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-)
PATCH v2 44/81 tcg/sparc64: Use SRA, SRL for {s}extract_i64
In reply to Richard HendersonExtracts which abut bit 32 may use 32-bit shifts.
--- tcg/sparc64/tcg-target-has.h | 9 +++++++-- tcg/sparc64/tcg-target.c.inc | 11 +++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-)
tcg/sparc64/tcg-target-has.h +7 -2
@@ -68,8 +68,8 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -83,4 +83,9 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_tst 1 +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I64 && (ofs) + (len) == 32) + +#define TCG_TARGET_sextract_valid TCG_TARGET_extract_valid +#endif
tcg/sparc64/tcg-target.c.inc +11 -0
@@ -1510,6 +1510,15 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_mb(s, a0); break; + case INDEX_op_extract_i64: + tcg_debug_assert(a2 + args[3] == 32); + tcg_out_arithi(s, a0, a1, a2, SHIFT_SRL); + break; + case INDEX_op_sextract_i64: + tcg_debug_assert(a2 + args[3] == 32); + tcg_out_arithi(s, a0, a1, a2, SHIFT_SRA); + break; + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */
@@ -1559,6 +1568,8 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: + case INDEX_op_extract_i64: + case INDEX_op_sextract_i64: case INDEX_op_qemu_ld_a32_i32: case INDEX_op_qemu_ld_a64_i32: case INDEX_op_qemu_ld_a32_i64:
Signature · 1 line
2.43.0
Re: [PATCH v2 44/81] tcg/sparc64: Use SRA, SRL for {s}extract_i64
tcg/sparc64/tcg-target-has.h
Quoted 12 lines · Richard Henderson
Extracts which abut bit 32 may use 32-bit shifts.
Signed-off-by Richard Henderson <[email protected]>--- tcg/sparc64/tcg-target-has.h | 9 +++++++-- tcg/sparc64/tcg-target.c.inc | 11 +++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-)tcg/sparc64/tcg-target-has.h +0
-0
Missing:
-- >8 --
@@ -33,8 +33,8 @@ extern bool use_vis3_instructions;
#define TCG_TARGET_HAS_ctz_i32 0 #define TCG_TARGET_HAS_ctpop_i32 0 #define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1
---
Quoted 21 lines
tcg/sparc64/tcg-target-has.h +7
-2@@ -68,8 +68,8 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1@@ -83,4 +83,9 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_tst 1 +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I64 && (ofs) + (len) == 32) + +#define TCG_TARGET_sextract_valid TCG_TARGET_extract_valid +#endif
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v2 44/81] tcg/sparc64: Use SRA, SRL for {s}extract_i64
Quoted 19 lines · Philippe Mathieu-Daudé
tcg/sparc64/tcg-target-has.h
Quoted 12 lines · Richard Henderson
Extracts which abut bit 32 may use 32-bit shifts.
Signed-off-by Richard Henderson <[email protected]>---
tcg/sparc64/tcg-target-has.h| 9 +++++++--
tcg/sparc64/tcg-target.c.inc | 11 +++++++++++2 files changed, 18 insertions(+), 2 deletions(-)tcg/sparc64/tcg-target-has.h +0
-0Missing:
-- >8 --
(quoted diff) +0
-0@@ -33,8 +33,8 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_ctz_i32 0
Review extern bool use_vis3_instructions;
Quoted 10 lines
(quoted diff) +2
-3#define TCG_TARGET_HAS_ctpop_i32 0 #define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 ---
Otherwise patch LGTM, so with that squashed:
Quoted 21 lines
Quoted 20 lines
tcg/sparc64/tcg-target-has.h +7
-2@@ -68,8 +68,8 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 #define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1 #define TCG_TARGET_HAS_extract2_i64 0 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1@@ -83,4 +83,9 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_tst 1 +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I64 && (ofs) + (len) == 32) + +#define TCG_TARGET_sextract_valid TCG_TARGET_extract_valid + #endif
Re: [PATCH v2 44/81] tcg/sparc64: Use SRA, SRL for {s}extract_i64
Quoted 3 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé
Quoted 1 line · Richard Henderson
Extracts which abut bit 32 may use 32-bit shifts.
(Fix typos?)
Quoted 53 lines
Quoted 17 lines
tcg/sparc64/tcg-target-has.h
Quoted 11 lines
Signed-off-by Richard Henderson <[email protected]>---
tcg/sparc64/tcg-target-has.h| 9 +++++++--
tcg/sparc64/tcg-target.c.inc | 11 +++++++++++2 files changed, 18 insertions(+), 2 deletions(-)tcg/sparc64/tcg-target-has.h +0
-0Missing:
-- >8 --
(quoted diff) +0
-0@@ -33,8 +33,8 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_ctz_i32 0Review extern bool use_vis3_instructions;
Quoted 10 lines
(quoted diff) +2
-3#define TCG_TARGET_HAS_ctpop_i32 0 #define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 ---Otherwise patch LGTM, so with that squashed:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 21 lines
Quoted 20 lines
tcg/sparc64/tcg-target-has.h +7
-2@@ -68,8 +68,8 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 #define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1 #define TCG_TARGET_HAS_extract2_i64 0 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1@@ -83,4 +83,9 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_tst 1 +#define TCG_TARGET_extract_valid (type, ofs, len) \ + ((type) == TCG_TYPE_I64 && (ofs) + (len) == 32) + +#define TCG_TARGET_sextract_valid TCG_TARGET_extract_valid + #endif
PATCH v2 45/81 tcg/tci: Provide TCG_TARGET_{s}extract_valid
In reply to Richard HendersonTrivially mirrors TCG_TARGET_HAS_{s}extract_*.
--- tcg/tci/tcg-target-has.h | 3 +++ 1 file changed, 3 insertions(+)
tcg/tci/tcg-target-has.h +3 -0
@@ -80,4 +80,7 @@#define TCG_TARGET_HAS_tst 1 +#define TCG_TARGET_extract_valid (type, ofs, len) 1 +#define TCG_TARGET_sextract_valid (type, ofs, len) 1 +#endif
Signature · 1 line
2.43.0
Re: [PATCH v2 45/81] tcg/tci: Provide TCG_TARGET_{s}extract_valid
Quoted 6 lines · Richard Henderson
Trivially mirrors TCG_TARGET_HAS_{s}extract_*.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci/tcg-target-has.h | 3 +++ 1 file changed, 3 insertions(+)
PATCH v2 46/81 tcg/tci: Remove assertions for deposit and extract
In reply to Richard HendersonWe already have these assertions during opcode creation.
--- tcg/tci/tcg-target.c.inc | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
tcg/tci/tcg-target.c.inc +2 -18
@@ -775,28 +775,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, break; CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ - { - TCGArg pos = args[3], len = args[4]; - TCGArg max = opc == INDEX_op_deposit_i32 ? 32 : 64; - - tcg_debug_assert(pos < max); - tcg_debug_assert(pos + len <= max); - - tcg_out_op_rrrbb(s, opc, args[0], args[1], args[2], pos, len); - } + tcg_out_op_rrrbb(s, opc, args[0], args[1], args[2], args[3], args[4]); break; CASE_32_64(extract) /* Optional (TCG_TARGET_HAS_extract_*). */ CASE_32_64(sextract) /* Optional (TCG_TARGET_HAS_sextract_*). */ - { - TCGArg pos = args[2], len = args[3]; - TCGArg max = type == TCG_TYPE_I32 ? 32 : 64; - - tcg_debug_assert(pos < max); - tcg_debug_assert(pos + len <= max); - - tcg_out_op_rrbb(s, opc, args[0], args[1], pos, len); - } + tcg_out_op_rrbb(s, opc, args[0], args[1], args[2], args[3]); break; CASE_32_64(brcond)
Signature · 1 line
2.43.0
Re: [PATCH v2 46/81] tcg/tci: Remove assertions for deposit and extract
Quoted 6 lines · Richard Henderson
We already have these assertions during opcode creation.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci/tcg-target.c.inc | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
PATCH v2 47/81 tcg: Remove TCG_TARGET_HAS_{s}extract_{i32,i64}
In reply to Richard HendersonMake extract and sextract "unconditional" in the sense that the opcodes are always present. Rely instead on TCG_TARGET_HAS_{s}extract_valid, now always defined.
--- tcg/aarch64/tcg-target-has.h | 4 ---- tcg/arm/tcg-target-has.h | 2 -- tcg/i386/tcg-target-has.h | 4 ---- tcg/loongarch64/tcg-target-has.h | 4 ---- tcg/mips/tcg-target-has.h | 4 ---- tcg/ppc/tcg-target-has.h | 4 ---- tcg/riscv/tcg-target-has.h | 4 ---- tcg/s390x/tcg-target-has.h | 4 ---- tcg/sparc64/tcg-target-has.h | 4 ---- tcg/tcg-has.h | 12 ------------ tcg/tci/tcg-target-has.h | 4 ---- tcg/optimize.c | 8 ++++---- tcg/tcg.c | 12 ++++-------- tcg/tci.c | 8 -------- 14 files changed, 8 insertions(+), 70 deletions(-)
tcg/aarch64/tcg-target-has.h +0 -4
@@ -32,8 +32,6 @@#define TCG_TARGET_HAS_ctz_i32 1#define TCG_TARGET_HAS_ctpop_i32 0#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -67,8 +65,6 @@#define TCG_TARGET_HAS_ctz_i64 1#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
tcg/arm/tcg-target-has.h +0 -2
@@ -41,8 +41,6 @@ extern bool use_neon_instructions;#define TCG_TARGET_HAS_ctz_i32 use_armv7_instructions#define TCG_TARGET_HAS_ctpop_i32 0#define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions -#define TCG_TARGET_HAS_extract_i32 use_armv7_instructions -#define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_mulu2_i32 1
tcg/i386/tcg-target-has.h +0 -4
@@ -44,8 +44,6 @@#define TCG_TARGET_HAS_ctz_i32 1#define TCG_TARGET_HAS_ctpop_i32 have_popcnt#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -79,8 +77,6 @@#define TCG_TARGET_HAS_ctz_i64 1#define TCG_TARGET_HAS_ctpop_i64 have_popcnt#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
tcg/loongarch64/tcg-target-has.h +0 -4
@@ -16,8 +16,6 @@#define TCG_TARGET_HAS_div2_i32 0#define TCG_TARGET_HAS_rot_i32 1#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 0#define TCG_TARGET_HAS_sub2_i32 0
@@ -51,8 +49,6 @@#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
tcg/mips/tcg-target-has.h +0 -4
@@ -80,8 +80,6 @@ extern bool use_mips32r2_instructions;/* optional instructions detected at runtime */ #define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_ext8s_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i32 use_mips32r2_instructions
@@ -96,8 +94,6 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_deposit_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_ext8s_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i64 use_mips32r2_instructions
tcg/ppc/tcg-target-has.h +0 -4
@@ -38,8 +38,6 @@#define TCG_TARGET_HAS_ctz_i32 have_isa_3_00#define TCG_TARGET_HAS_ctpop_i32 have_isa_2_06#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_mulu2_i32 0
@@ -74,8 +72,6 @@#define TCG_TARGET_HAS_ctz_i64 have_isa_3_00#define TCG_TARGET_HAS_ctpop_i64 have_isa_2_06#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
tcg/riscv/tcg-target-has.h +0 -4
@@ -16,8 +16,6 @@#define TCG_TARGET_HAS_div2_i32 0#define TCG_TARGET_HAS_rot_i32 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 1#define TCG_TARGET_HAS_sub2_i32 1
@@ -50,8 +48,6 @@#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
tcg/s390x/tcg-target-has.h +0 -4
@@ -47,8 +47,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_ctz_i32 0#define TCG_TARGET_HAS_ctpop_i32 1#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -81,8 +79,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 1#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
tcg/sparc64/tcg-target-has.h +0 -4
@@ -33,8 +33,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_ctz_i32 0#define TCG_TARGET_HAS_ctpop_i32 0#define TCG_TARGET_HAS_deposit_i32 0 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -68,8 +66,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
tcg/tcg-has.h +0 -12
@@ -35,8 +35,6 @@#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_deposit_i64 0 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 0#define TCG_TARGET_HAS_add2_i64 0
@@ -56,16 +54,6 @@#ifndef TCG_TARGET_deposit_i64_valid#define TCG_TARGET_deposit_i64_valid (ofs, len) 1#endif -#ifndef TCG_TARGET_extract_valid -#define TCG_TARGET_extract_valid (type, ofs, len) \ - ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_extract_i32 \ - : TCG_TARGET_HAS_extract_i64) -#endif -#ifndef TCG_TARGET_sextract_valid -#define TCG_TARGET_sextract_valid (type, ofs, len) \ - ((type) == TCG_TYPE_I32 ? TCG_TARGET_HAS_sextract_i32 \ - : TCG_TARGET_HAS_sextract_i64) -#endif /* Only one of DIV or DIV2 should be defined. */ #if defined(TCG_TARGET_HAS_div_i32)
tcg/tci/tcg-target-has.h +0 -4
@@ -17,8 +17,6 @@#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_andc_i32 1#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_eqv_i32 1#define TCG_TARGET_HAS_nand_i32 1
@@ -41,8 +39,6 @@#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 1
tcg/optimize.c +4 -4
@@ -2363,10 +2363,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) shr_opc = INDEX_op_shr_i32; neg_opc = INDEX_op_neg_i32;if (TCG_TARGET_extract_valid (TCG_TYPE_I32 , sh,1 )) { - uext_opc = TCG_TARGET_HAS_extract_i32 ? INDEX_op_extract_i32 :0 ; + uext_opc = INDEX_op_extract_i32; }if (TCG_TARGET_sextract_valid (TCG_TYPE_I32 , sh,1 )) { - sext_opc = TCG_TARGET_HAS_sextract_i32 ? INDEX_op_sextract_i32 :0 ; + sext_opc = INDEX_op_sextract_i32; }break ;case TCG_TYPE_I64 :
@@ -2376,10 +2376,10 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) shr_opc = INDEX_op_shr_i64; neg_opc = INDEX_op_neg_i64;if (TCG_TARGET_extract_valid (TCG_TYPE_I64 , sh,1 )) { - uext_opc = TCG_TARGET_HAS_extract_i64 ? INDEX_op_extract_i64 :0 ; + uext_opc = INDEX_op_extract_i64; }if (TCG_TARGET_sextract_valid (TCG_TYPE_I64 , sh,1 )) { - sext_opc = TCG_TARGET_HAS_sextract_i64 ? INDEX_op_sextract_i64 :0 ; + sext_opc = INDEX_op_sextract_i64; }break ;default :
tcg/tcg.c +4 -8
@@ -2195,6 +2195,8 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_shl_i32:case INDEX_op_shr_i32:case INDEX_op_sar_i32: +case INDEX_op_extract_i32: +case INDEX_op_sextract_i32:return true;case INDEX_op_negsetcond_i32:
@@ -2213,10 +2215,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)return TCG_TARGET_HAS_rot_i32;case INDEX_op_deposit_i32:return TCG_TARGET_HAS_deposit_i32; -case INDEX_op_extract_i32: -return TCG_TARGET_HAS_extract_i32; -case INDEX_op_sextract_i32: -return TCG_TARGET_HAS_sextract_i32;case INDEX_op_extract2_i32:return TCG_TARGET_HAS_extract2_i32;case INDEX_op_add2_i32:
@@ -2293,6 +2291,8 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_sar_i64:case INDEX_op_ext_i32_i64:case INDEX_op_extu_i32_i64: +case INDEX_op_extract_i64: +case INDEX_op_sextract_i64:return TCG_TARGET_REG_BITS ==64 ;case INDEX_op_negsetcond_i64:
@@ -2311,10 +2311,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)return TCG_TARGET_HAS_rot_i64;case INDEX_op_deposit_i64:return TCG_TARGET_HAS_deposit_i64; -case INDEX_op_extract_i64: -return TCG_TARGET_HAS_extract_i64; -case INDEX_op_sextract_i64: -return TCG_TARGET_HAS_sextract_i64;case INDEX_op_extract2_i64:return TCG_TARGET_HAS_extract2_i64;case INDEX_op_extrl_i64_i32:
tcg/tci.c +0 -8
@@ -657,18 +657,14 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] =deposit32 (regs[r1], pos, len, regs[r2]);break ;#endif -#if TCG_TARGET_HAS_extract_i32case INDEX_op_extract_i32:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =extract32 (regs[r1], pos, len);break ; -#endif -#if TCG_TARGET_HAS_sextract_i32case INDEX_op_sextract_i32:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =sextract32 (regs[r1], pos, len);break ; -#endif case INDEX_op_brcond_i32:tci_args_rl (insn, tb_ptr, &r0, &ptr);if ((uint32_t )regs[r0]) {
@@ -868,18 +864,14 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] =deposit64 (regs[r1], pos, len, regs[r2]);break ;#endif -#if TCG_TARGET_HAS_extract_i64case INDEX_op_extract_i64:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =extract64 (regs[r1], pos, len);break ; -#endif -#if TCG_TARGET_HAS_sextract_i64case INDEX_op_sextract_i64:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =sextract64 (regs[r1], pos, len);break ; -#endif case INDEX_op_brcond_i64:tci_args_rl (insn, tb_ptr, &r0, &ptr);if (regs[r0]) {
Signature · 1 line
2.43.0
Re: [PATCH v2 47/81] tcg: Remove TCG_TARGET_HAS_{s}extract_{i32,i64}
Quoted 5 lines · Richard Henderson
Make extract and sextract "unconditional" in the sense that the opcodes are always present. Rely instead on TCG_TARGET_HAS_{s}extract_valid, now always defined.
Signed-off-by Richard Henderson <[email protected]>
Quoted 16 lines
--- tcg/aarch64/tcg-target-has.h | 4 ---- tcg/arm/tcg-target-has.h | 2 -- tcg/i386/tcg-target-has.h | 4 ---- tcg/loongarch64/tcg-target-has.h | 4 ---- tcg/mips/tcg-target-has.h | 4 ---- tcg/ppc/tcg-target-has.h | 4 ---- tcg/riscv/tcg-target-has.h | 4 ---- tcg/s390x/tcg-target-has.h | 4 ---- tcg/sparc64/tcg-target-has.h | 4 ---- tcg/tcg-has.h | 12 ------------ tcg/tci/tcg-target-has.h | 4 ---- tcg/optimize.c | 8 ++++---- tcg/tcg.c | 12 ++++-------- tcg/tci.c | 8 -------- 14 files changed, 8 insertions(+), 70 deletions(-)
PATCH v2 48/81 tcg: Remove TCG_TARGET_HAS_deposit_{i32,i64}
In reply to Richard HendersonMake extract and sextract "unconditional" in the sense that the opcodes are always present. Rely instead on TCG_TARGET_deposit_valid, now always defined.
--- tcg/aarch64/tcg-target-has.h | 3 +-- tcg/arm/tcg-target-has.h | 2 +- tcg/i386/tcg-target-has.h | 5 +---- tcg/loongarch64/tcg-target-has.h | 3 +-- tcg/mips/tcg-target-has.h | 3 +-- tcg/ppc/tcg-target-has.h | 3 +-- tcg/riscv/tcg-target-has.h | 4 ++-- tcg/s390x/tcg-target-has.h | 3 +-- tcg/sparc64/tcg-target-has.h | 4 ++-- tcg/tcg-has.h | 8 -------- tcg/tci/tcg-target-has.h | 3 +-- tcg/tcg-op.c | 22 +++++++++++----------- tcg/tcg.c | 31 +++++++++++-------------------- tcg/tci.c | 4 ---- tcg/tci/tcg-target.c.inc | 2 +- 15 files changed, 35 insertions(+), 65 deletions(-)
tcg/aarch64/tcg-target-has.h +1 -2
@@ -31,7 +31,6 @@#define TCG_TARGET_HAS_clz_i32 1#define TCG_TARGET_HAS_ctz_i32 1#define TCG_TARGET_HAS_ctpop_i32 0 -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -64,7 +63,6 @@#define TCG_TARGET_HAS_clz_i64 1#define TCG_TARGET_HAS_ctz_i64 1#define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -114,5 +112,6 @@#define TCG_TARGET_extract_valid (type, ofs, len) 1#define TCG_TARGET_sextract_valid (type, ofs, len) 1 +#define TCG_TARGET_deposit_valid (type, ofs, len) 1#endif
tcg/arm/tcg-target-has.h +1 -1
@@ -40,7 +40,6 @@ extern bool use_neon_instructions;#define TCG_TARGET_HAS_clz_i32 1#define TCG_TARGET_HAS_ctz_i32 use_armv7_instructions#define TCG_TARGET_HAS_ctpop_i32 0 -#define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_mulu2_i32 1
@@ -96,5 +95,6 @@ tcg_target_extract_valid(TCGType type, unsigned ofs, unsigned len)#define TCG_TARGET_extract_valid tcg_target_extract_valid#define TCG_TARGET_sextract_valid tcg_target_extract_valid +#define TCG_TARGET_deposit_valid (type, ofs, len) use_armv7_instructions#endif
tcg/i386/tcg-target-has.h +1 -4
@@ -43,7 +43,6 @@#define TCG_TARGET_HAS_clz_i32 1#define TCG_TARGET_HAS_ctz_i32 1#define TCG_TARGET_HAS_ctpop_i32 have_popcnt -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 1#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -76,7 +75,6 @@#define TCG_TARGET_HAS_clz_i64 1#define TCG_TARGET_HAS_ctz_i64 1#define TCG_TARGET_HAS_ctpop_i64 have_popcnt -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 1#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -121,10 +119,9 @@#define TCG_TARGET_HAS_cmpsel_vec 1#define TCG_TARGET_HAS_tst_vec have_avx512bw -#define TCG_TARGET_deposit_i32_valid (ofs, len) \ +#define TCG_TARGET_deposit_valid (type, ofs, len) \ (((ofs) == 0 && ((len) == 8 || (len) == 16)) || \ (TCG_TARGET_REG_BITS == 32 && (ofs) == 8 && (len) == 8)) -#define TCG_TARGET_deposit_i64_valid TCG_TARGET_deposit_i32_valid/* * Check for the possibility of low byte/word extraction, high-byte extraction
tcg/loongarch64/tcg-target-has.h +1 -2
@@ -15,7 +15,6 @@#define TCG_TARGET_HAS_rem_i32 1#define TCG_TARGET_HAS_div2_i32 0#define TCG_TARGET_HAS_rot_i32 1 -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 0#define TCG_TARGET_HAS_sub2_i32 0
@@ -48,7 +47,6 @@#define TCG_TARGET_HAS_rem_i64 1#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 1 -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
@@ -106,6 +104,7 @@#define TCG_TARGET_HAS_tst_vec 0#define TCG_TARGET_extract_valid (type, ofs, len) 1 +#define TCG_TARGET_deposit_valid (type, ofs, len) 1static inline bool tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len)
tcg/mips/tcg-target-has.h +1 -2
@@ -79,7 +79,6 @@ extern bool use_mips32r2_instructions;#endif /* optional instructions detected at runtime */ -#define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_ext8s_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i32 use_mips32r2_instructions
@@ -93,7 +92,6 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1 -#define TCG_TARGET_HAS_deposit_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_ext8s_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_ext16s_i64 use_mips32r2_instructions
@@ -116,6 +114,7 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_tst 0#define TCG_TARGET_extract_valid (type, ofs, len) use_mips32r2_instructions +#define TCG_TARGET_deposit_valid (type, ofs, len) use_mips32r2_instructionsstatic inline bool tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len)
tcg/ppc/tcg-target-has.h +1 -2
@@ -37,7 +37,6 @@#define TCG_TARGET_HAS_clz_i32 1#define TCG_TARGET_HAS_ctz_i32 have_isa_3_00#define TCG_TARGET_HAS_ctpop_i32 have_isa_2_06 -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_mulu2_i32 0
@@ -71,7 +70,6 @@#define TCG_TARGET_HAS_clz_i64 1#define TCG_TARGET_HAS_ctz_i64 have_isa_3_00#define TCG_TARGET_HAS_ctpop_i64 have_isa_2_06 -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -118,6 +116,7 @@#define TCG_TARGET_HAS_tst_vec 0#define TCG_TARGET_extract_valid (type, ofs, len) 1 +#define TCG_TARGET_deposit_valid (type, ofs, len) 1static inline bool tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len)
tcg/riscv/tcg-target-has.h +2 -2
@@ -15,7 +15,6 @@#define TCG_TARGET_HAS_rem_i32 1#define TCG_TARGET_HAS_div2_i32 0#define TCG_TARGET_HAS_rot_i32 (cpuinfo & CPUINFO_ZBB) -#define TCG_TARGET_HAS_deposit_i32 0#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_add2_i32 1#define TCG_TARGET_HAS_sub2_i32 1
@@ -47,7 +46,6 @@#define TCG_TARGET_HAS_rem_i64 1#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 (cpuinfo & CPUINFO_ZBB) -#define TCG_TARGET_HAS_deposit_i64 0#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_ext8s_i64 1
@@ -126,4 +124,6 @@ tcg_target_sextract_valid(TCGType type, unsigned ofs, unsigned len) }#define TCG_TARGET_sextract_valid tcg_target_sextract_valid +#define TCG_TARGET_deposit_valid (type, ofs, len) 0 +#endif
tcg/s390x/tcg-target-has.h +1 -2
@@ -46,7 +46,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_clz_i32 0#define TCG_TARGET_HAS_ctz_i32 0#define TCG_TARGET_HAS_ctpop_i32 1 -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -78,7 +77,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_clz_i64 1#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 1 -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -118,6 +116,7 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_tst_vec 0#define TCG_TARGET_extract_valid (type, ofs, len) 1 +#define TCG_TARGET_deposit_valid (type, ofs, len) 1static inline bool tcg_target_sextract_valid (TCGType type,unsigned ofs,unsigned len)
tcg/sparc64/tcg-target-has.h +2 -2
@@ -32,7 +32,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_clz_i32 0#define TCG_TARGET_HAS_ctz_i32 0#define TCG_TARGET_HAS_ctpop_i32 0 -#define TCG_TARGET_HAS_deposit_i32 0#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_negsetcond_i32 1#define TCG_TARGET_HAS_add2_i32 1
@@ -65,7 +64,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_clz_i64 0#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 0#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 1#define TCG_TARGET_HAS_add2_i64 1
@@ -84,4 +82,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_sextract_valid TCG_TARGET_extract_valid +#define TCG_TARGET_deposit_valid (type, ofs, len) 0 +#endif
tcg/tcg-has.h +0 -8
@@ -34,7 +34,6 @@#define TCG_TARGET_HAS_clz_i64 0#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 0#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_negsetcond_i64 0#define TCG_TARGET_HAS_add2_i64 0
@@ -48,13 +47,6 @@#define TCG_TARGET_HAS_sub2_i32 1#endif -#ifndef TCG_TARGET_deposit_i32_valid -#define TCG_TARGET_deposit_i32_valid (ofs, len) 1 -#endif -#ifndef TCG_TARGET_deposit_i64_valid -#define TCG_TARGET_deposit_i64_valid (ofs, len) 1 -#endif -/* Only one of DIV or DIV2 should be defined. */ #if defined(TCG_TARGET_HAS_div_i32)#define TCG_TARGET_HAS_div2_i32 0
tcg/tci/tcg-target-has.h +1 -2
@@ -16,7 +16,6 @@#define TCG_TARGET_HAS_ext8u_i32 1#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_andc_i32 1 -#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_eqv_i32 1#define TCG_TARGET_HAS_nand_i32 1
@@ -38,7 +37,6 @@#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1 -#define TCG_TARGET_HAS_deposit_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 1
@@ -78,5 +76,6 @@#define TCG_TARGET_extract_valid (type, ofs, len) 1#define TCG_TARGET_sextract_valid (type, ofs, len) 1 +#define TCG_TARGET_deposit_valid (type, ofs, len) 1#endif
tcg/tcg-op.c +11 -11
@@ -906,7 +906,7 @@ void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,tcg_gen_mov_i32 (ret, arg2);return ; } -if (TCG_TARGET_HAS_deposit_i32 &&TCG_TARGET_deposit_i32_valid (ofs, len)) { +if (TCG_TARGET_deposit_valid (TCG_TYPE_I32 , ofs, len)) {tcg_gen_op5ii_i32 (INDEX_op_deposit_i32, ret, arg1, arg2, ofs, len);return ; }
@@ -951,8 +951,7 @@ void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg,tcg_gen_shli_i32 (ret, arg, ofs); }else if (ofs ==0 ) {tcg_gen_andi_i32 (ret, arg, (1u << len) -1 ); - }else if (TCG_TARGET_HAS_deposit_i32 - &&TCG_TARGET_deposit_i32_valid (ofs, len)) { + }else if (TCG_TARGET_deposit_valid (TCG_TYPE_I32 , ofs, len)) {TCGv_i32 zero =tcg_constant_i32 (0 );tcg_gen_op5ii_i32 (INDEX_op_deposit_i32, ret, zero, arg, ofs, len); }else {
@@ -2642,12 +2641,13 @@ void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,tcg_gen_mov_i64 (ret, arg2);return ; } -if (TCG_TARGET_HAS_deposit_i64 &&TCG_TARGET_deposit_i64_valid (ofs, len)) { -tcg_gen_op5ii_i64 (INDEX_op_deposit_i64, ret, arg1, arg2, ofs, len); -return ; - } -if (TCG_TARGET_REG_BITS ==32 ) { +if (TCG_TARGET_REG_BITS ==64 ) { +if (TCG_TARGET_deposit_valid (TCG_TYPE_I64 , ofs, len)) { +tcg_gen_op5ii_i64 (INDEX_op_deposit_i64, ret, arg1, arg2, ofs, len); +return ; + } + }else {if (ofs >=32 ) {tcg_gen_deposit_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg1),TCGV_LOW (arg2), ofs -32 , len);
@@ -2702,8 +2702,8 @@ void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg,tcg_gen_shli_i64 (ret, arg, ofs); }else if (ofs ==0 ) {tcg_gen_andi_i64 (ret, arg, (1ull << len) -1 ); - }else if (TCG_TARGET_HAS_deposit_i64 - &&TCG_TARGET_deposit_i64_valid (ofs, len)) { + }else if (TCG_TARGET_REG_BITS ==64 && +TCG_TARGET_deposit_valid (TCG_TYPE_I64 , ofs, len)) {TCGv_i64 zero =tcg_constant_i64 (0 );tcg_gen_op5ii_i64 (INDEX_op_deposit_i64, ret, zero, arg, ofs, len); }else {
@@ -3226,7 +3226,7 @@ void tcg_gen_concat_i32_i64(TCGv_i64 dest, TCGv_i32 low, TCGv_i32 high)tcg_gen_extu_i32_i64 (dest, low);/* If deposit is available, use it. Otherwise use the extra knowledge that we have of the zero-extensions above. */ -if (TCG_TARGET_HAS_deposit_i64 &&TCG_TARGET_deposit_i64_valid (32 ,32 )) { +if (TCG_TARGET_deposit_valid (TCG_TYPE_I64 ,32 ,32 )) {tcg_gen_deposit_i64 (dest, dest, tmp,32 ,32 ); }else {tcg_gen_shli_i64 (tmp, tmp,32 );
tcg/tcg.c +11 -20
@@ -2197,6 +2197,7 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_sar_i32:case INDEX_op_extract_i32:case INDEX_op_sextract_i32: +case INDEX_op_deposit_i32:return true;case INDEX_op_negsetcond_i32:
@@ -2213,8 +2214,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_rotl_i32:case INDEX_op_rotr_i32:return TCG_TARGET_HAS_rot_i32; -case INDEX_op_deposit_i32: -return TCG_TARGET_HAS_deposit_i32;case INDEX_op_extract2_i32:return TCG_TARGET_HAS_extract2_i32;case INDEX_op_add2_i32:
@@ -2293,6 +2292,7 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_extu_i32_i64:case INDEX_op_extract_i64:case INDEX_op_sextract_i64: +case INDEX_op_deposit_i64:return TCG_TARGET_REG_BITS ==64 ;case INDEX_op_negsetcond_i64:
@@ -2309,8 +2309,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_rotl_i64:case INDEX_op_rotr_i64:return TCG_TARGET_HAS_rot_i64; -case INDEX_op_deposit_i64: -return TCG_TARGET_HAS_deposit_i64;case INDEX_op_extract2_i64:return TCG_TARGET_HAS_extract2_i64;case INDEX_op_extrl_i64_i32:
@@ -2439,23 +2437,16 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)bool tcg_op_deposit_valid (TCGType type,unsigned ofs,unsigned len) { +unsigned width; + +tcg_debug_assert (type ==TCG_TYPE_I32 || type ==TCG_TYPE_I64 ); + width = (type ==TCG_TYPE_I32 ?32 :64 ); + +tcg_debug_assert (ofs < width);tcg_debug_assert (len >0 ); -switch (type) { -case TCG_TYPE_I32 : -tcg_debug_assert (ofs <32 ); -tcg_debug_assert (len <=32 ); -tcg_debug_assert (ofs + len <=32 ); -return TCG_TARGET_HAS_deposit_i32 && -TCG_TARGET_deposit_i32_valid (ofs, len); -case TCG_TYPE_I64 : -tcg_debug_assert (ofs <64 ); -tcg_debug_assert (len <=64 ); -tcg_debug_assert (ofs + len <=64 ); -return TCG_TARGET_HAS_deposit_i64 && -TCG_TARGET_deposit_i64_valid (ofs, len); -default : -g_assert_not_reached (); - } +tcg_debug_assert (len <= width - ofs); + +return TCG_TARGET_deposit_valid (type, ofs, len); }static TCGOp *tcg_op_alloc (TCGOpcode opc,unsigned nargs);
tcg/tci.c +0 -4
@@ -651,12 +651,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] =ror32 (regs[r1], regs[r2] &31 );break ;#endif -#if TCG_TARGET_HAS_deposit_i32case INDEX_op_deposit_i32:tci_args_rrrbb (insn, &r0, &r1, &r2, &pos, &len); regs[r0] =deposit32 (regs[r1], pos, len, regs[r2]);break ; -#endif case INDEX_op_extract_i32:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =extract32 (regs[r1], pos, len);
@@ -858,12 +856,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] =ror64 (regs[r1], regs[r2] &63 );break ;#endif -#if TCG_TARGET_HAS_deposit_i64case INDEX_op_deposit_i64:tci_args_rrrbb (insn, &r0, &r1, &r2, &pos, &len); regs[r0] =deposit64 (regs[r1], pos, len, regs[r2]);break ; -#endif case INDEX_op_extract_i64:tci_args_rrbb (insn, &r0, &r1, &pos, &len); regs[r0] =extract64 (regs[r1], pos, len);
tcg/tci/tcg-target.c.inc +1 -1
@@ -774,7 +774,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_op_rrr(s, opc, args[0], args[1], args[2]); break; - CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ + CASE_32_64(deposit) tcg_out_op_rrrbb(s, opc, args[0], args[1], args[2], args[3], args[4]); break;
Signature · 1 line
2.43.0
Re: [PATCH v2 48/81] tcg: Remove TCG_TARGET_HAS_deposit_{i32,i64}
Quoted 1 line · Richard Henderson
Make extract and sextract "unconditional" in the sense
Typo "Make deposit ..."
Quoted 21 lines
that the opcodes are always present. Rely instead on
TCG_TARGET_deposit_valid, now always defined.Signed-off-by Richard Henderson <[email protected]>--- tcg/aarch64/tcg-target-has.h | 3 +-- tcg/arm/tcg-target-has.h | 2 +- tcg/i386/tcg-target-has.h | 5 +---- tcg/loongarch64/tcg-target-has.h | 3 +-- tcg/mips/tcg-target-has.h | 3 +-- tcg/ppc/tcg-target-has.h | 3 +-- tcg/riscv/tcg-target-has.h | 4 ++-- tcg/s390x/tcg-target-has.h | 3 +-- tcg/sparc64/tcg-target-has.h | 4 ++-- tcg/tcg-has.h | 8 -------- tcg/tci/tcg-target-has.h | 3 +-- tcg/tcg-op.c | 22 +++++++++++----------- tcg/tcg.c | 31 +++++++++++-------------------- tcg/tci.c | 4 ---- tcg/tci/tcg-target.c.inc | 2 +- 15 files changed, 35 insertions(+), 65 deletions(-)
PATCH v2 49/81 tcg: Remove INDEX_op_ext{8,16,32}*
In reply to Richard HendersonUse the fully general extract opcodes instead.
--- include/tcg/tcg-opc.h | 10 - tcg/aarch64/tcg-target-has.h | 10 - tcg/arm/tcg-target-has.h | 4 - tcg/i386/tcg-target-has.h | 10 - tcg/loongarch64/tcg-target-has.h | 10 - tcg/mips/tcg-target-has.h | 13 - tcg/ppc/tcg-target-has.h | 12 - tcg/riscv/tcg-target-has.h | 10 - tcg/s390x/tcg-target-has.h | 10 - tcg/sparc64/tcg-target-has.h | 10 - tcg/tcg-has.h | 6 - tcg/tci/tcg-target-has.h | 10 - tcg/optimize.c | 61 +---- tcg/tcg-op.c | 430 ++++++++----------------------- tcg/tcg.c | 46 ---- tcg/tci.c | 36 --- docs/devel/tcg-ops.rst | 14 - tcg/aarch64/tcg-target.c.inc | 22 +- tcg/arm/tcg-target.c.inc | 7 - tcg/i386/tcg-target.c.inc | 24 +- tcg/loongarch64/tcg-target.c.inc | 22 +- tcg/mips/tcg-target.c.inc | 20 +- tcg/ppc/tcg-target.c.inc | 17 +- tcg/riscv/tcg-target.c.inc | 22 +- tcg/s390x/tcg-target.c.inc | 22 +- tcg/sparc64/tcg-target.c.inc | 14 +- tcg/tci/tcg-target.c.inc | 102 +++----- 27 files changed, 147 insertions(+), 827 deletions(-)
include/tcg/tcg-opc.h +0 -10
@@ -85,10 +85,6 @@ DEF(mulsh_i32, 1, 2, 0, 0) DEF(brcond2_i32, 0, 4, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH) DEF(setcond2_i32, 1, 4, 1, 0) -DEF(ext8s_i32, 1, 1, 0, 0) -DEF(ext16s_i32, 1, 1, 0, 0) -DEF(ext8u_i32, 1, 1, 0, 0) -DEF(ext16u_i32, 1, 1, 0, 0) DEF(bswap16_i32, 1, 1, 1, 0) DEF(bswap32_i32, 1, 1, 1, 0)DEF (not_i32,1 ,1 ,0 ,0 )
@@ -149,12 +145,6 @@ DEF(extrl_i64_i32, 1, 1, 0, 0) DEF(extrh_i64_i32, 1, 1, 0, 0) DEF(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH) -DEF(ext8s_i64, 1, 1, 0, 0) -DEF(ext16s_i64, 1, 1, 0, 0) -DEF(ext32s_i64, 1, 1, 0, 0) -DEF(ext8u_i64, 1, 1, 0, 0) -DEF(ext16u_i64, 1, 1, 0, 0) -DEF(ext32u_i64, 1, 1, 0, 0) DEF(bswap16_i64, 1, 1, 1, 0) DEF(bswap32_i64, 1, 1, 1, 0)DEF (bswap64_i64,1 ,1 ,1 ,0 )
tcg/aarch64/tcg-target-has.h +0 -10
@@ -15,10 +15,6 @@/* optional instructions */ #define TCG_TARGET_HAS_div_i32 1#define TCG_TARGET_HAS_rem_i32 1 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 1
@@ -44,12 +40,6 @@#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1
tcg/arm/tcg-target-has.h +0 -4
@@ -24,10 +24,6 @@ extern bool use_neon_instructions;#endif /* optional instructions */ -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 0/* and r0, r1, #0xff */ -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 1
tcg/i386/tcg-target-has.h +0 -10
@@ -28,10 +28,6 @@/* optional instructions */ #define TCG_TARGET_HAS_div2_i32 1#define TCG_TARGET_HAS_rot_i32 1 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 1
@@ -57,12 +53,6 @@#define TCG_TARGET_HAS_extr_i64_i32 1#define TCG_TARGET_HAS_div2_i64 1#define TCG_TARGET_HAS_rot_i64 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1
tcg/loongarch64/tcg-target-has.h +0 -10
@@ -22,10 +22,6 @@#define TCG_TARGET_HAS_muls2_i32 0#define TCG_TARGET_HAS_muluh_i32 1#define TCG_TARGET_HAS_mulsh_i32 1 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 1
@@ -49,12 +45,6 @@#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1
tcg/mips/tcg-target-has.h +0 -13
@@ -80,8 +80,6 @@ extern bool use_mips32r2_instructions;/* optional instructions detected at runtime */ #define TCG_TARGET_HAS_extract2_i32 0 -#define TCG_TARGET_HAS_ext8s_i32 use_mips32r2_instructions -#define TCG_TARGET_HAS_ext16s_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_rot_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_clz_i32 use_mips32r2_instructions#define TCG_TARGET_HAS_ctz_i32 0
@@ -93,23 +91,12 @@ extern bool use_mips32r2_instructions;#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_ext8s_i64 use_mips32r2_instructions -#define TCG_TARGET_HAS_ext16s_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_rot_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_clz_i64 use_mips32r2_instructions#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#endif -/* optional instructions automatically implemented */ -#define TCG_TARGET_HAS_ext8u_i32 0/* andi rt, rs, 0xff */ -#define TCG_TARGET_HAS_ext16u_i32 0/* andi rt, rs, 0xffff */ - -#if TCG_TARGET_REG_BITS ==64 -#define TCG_TARGET_HAS_ext8u_i64 0/* andi rt, rs, 0xff */ -#define TCG_TARGET_HAS_ext16u_i64 0/* andi rt, rs, 0xffff */ -#endif -#define TCG_TARGET_HAS_qemu_ldst_i128 0#define TCG_TARGET_HAS_tst 0
tcg/ppc/tcg-target-has.h +0 -12
@@ -16,16 +16,10 @@#define have_altivec (cpuinfo & CPUINFO_ALTIVEC)#define have_vsx (cpuinfo & CPUINFO_VSX) -/* optional instructions automatically implemented */ -#define TCG_TARGET_HAS_ext8u_i32 0/* andi */ -#define TCG_TARGET_HAS_ext16u_i32 0 -/* 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_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 1
@@ -52,12 +46,6 @@#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_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 0 -#define TCG_TARGET_HAS_ext16u_i64 0 -#define TCG_TARGET_HAS_ext32u_i64 0#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1
tcg/riscv/tcg-target-has.h +0 -10
@@ -22,10 +22,6 @@#define TCG_TARGET_HAS_muls2_i32 0#define TCG_TARGET_HAS_muluh_i32 0#define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_bswap32_i32 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_not_i32 1
@@ -48,12 +44,6 @@#define TCG_TARGET_HAS_rot_i64 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_extr_i64_i32 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_bswap32_i64 (cpuinfo & CPUINFO_ZBB)#define TCG_TARGET_HAS_bswap64_i64 (cpuinfo & CPUINFO_ZBB)
tcg/s390x/tcg-target-has.h +0 -10
@@ -31,10 +31,6 @@ extern uint64_t s390_facilities[3];/* optional instructions */ #define TCG_TARGET_HAS_div2_i32 1#define TCG_TARGET_HAS_rot_i32 1 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_bswap16_i32 1#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_not_i32 HAVE_FACILITY(MISC_INSN_EXT3)
@@ -59,12 +55,6 @@ extern uint64_t s390_facilities[3];#define TCG_TARGET_HAS_div2_i64 1#define TCG_TARGET_HAS_rot_i64 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 1#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1
tcg/sparc64/tcg-target-has.h +0 -10
@@ -17,10 +17,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_div_i32 1#define TCG_TARGET_HAS_rem_i32 0#define TCG_TARGET_HAS_rot_i32 0 -#define TCG_TARGET_HAS_ext8s_i32 0 -#define TCG_TARGET_HAS_ext16s_i32 0 -#define TCG_TARGET_HAS_ext8u_i32 0 -#define TCG_TARGET_HAS_ext16u_i32 0#define TCG_TARGET_HAS_bswap16_i32 0#define TCG_TARGET_HAS_bswap32_i32 0#define TCG_TARGET_HAS_not_i32 1
@@ -46,12 +42,6 @@ extern bool use_vis3_instructions;#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 0#define TCG_TARGET_HAS_rot_i64 0 -#define TCG_TARGET_HAS_ext8s_i64 0 -#define TCG_TARGET_HAS_ext16s_i64 0 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 0 -#define TCG_TARGET_HAS_ext16u_i64 0 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_bswap16_i64 0#define TCG_TARGET_HAS_bswap32_i64 0#define TCG_TARGET_HAS_bswap64_i64 0
tcg/tcg-has.h +0 -6
@@ -16,12 +16,6 @@#define TCG_TARGET_HAS_rem_i64 0#define TCG_TARGET_HAS_div2_i64 0#define TCG_TARGET_HAS_rot_i64 0 -#define TCG_TARGET_HAS_ext8s_i64 0 -#define TCG_TARGET_HAS_ext16s_i64 0 -#define TCG_TARGET_HAS_ext32s_i64 0 -#define TCG_TARGET_HAS_ext8u_i64 0 -#define TCG_TARGET_HAS_ext16u_i64 0 -#define TCG_TARGET_HAS_ext32u_i64 0#define TCG_TARGET_HAS_bswap16_i64 0#define TCG_TARGET_HAS_bswap32_i64 0#define TCG_TARGET_HAS_bswap64_i64 0
tcg/tci/tcg-target-has.h +0 -10
@@ -11,10 +11,6 @@#define TCG_TARGET_HAS_bswap32_i32 1#define TCG_TARGET_HAS_div_i32 1#define TCG_TARGET_HAS_rem_i32 1 -#define TCG_TARGET_HAS_ext8s_i32 1 -#define TCG_TARGET_HAS_ext16s_i32 1 -#define TCG_TARGET_HAS_ext8u_i32 1 -#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_andc_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_eqv_i32 1
@@ -40,12 +36,6 @@#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 1 -#define TCG_TARGET_HAS_ext8s_i64 1 -#define TCG_TARGET_HAS_ext16s_i64 1 -#define TCG_TARGET_HAS_ext32s_i64 1 -#define TCG_TARGET_HAS_ext8u_i64 1 -#define TCG_TARGET_HAS_ext16u_i64 1 -#define TCG_TARGET_HAS_ext32u_i64 1#define TCG_TARGET_HAS_andc_i64 1#define TCG_TARGET_HAS_eqv_i64 1#define TCG_TARGET_HAS_nand_i64 1
tcg/optimize.c +3 -58
128 lines not on this page · raw message
tcg/tcg-op.c +105 -325
568 lines not on this page · raw message
tcg/tcg.c +0 -46
64 lines not on this page · raw message
tcg/tci.c +0 -36
@@ -699,31 +699,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg64 (regs, r1, r0, tmp64);break ;#endif -#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 - CASE_32_64(ext8s) - tci_args_rr(insn, &r0, &r1); - regs[r0] = (int8_t )regs[r1]; -break ; -#endif -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 || \ - TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64 - CASE_32_64(ext16s) - tci_args_rr(insn, &r0, &r1); - regs[r0] = (int16_t )regs[r1]; -break ; -#endif -#if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64 - CASE_32_64(ext8u) - tci_args_rr(insn, &r0, &r1); - regs[r0] = (uint8_t )regs[r1]; -break ; -#endif -#if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64 - CASE_32_64(ext16u) - tci_args_rr(insn, &r0, &r1); - regs[r0] = (uint16_t )regs[r1]; -break ; -#endif #if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64 CASE_32_64(bswap16) tci_args_rr(insn, &r0, &r1);
@@ -874,12 +849,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, tb_ptr = ptr; }break ; -case INDEX_op_ext32s_i64:case INDEX_op_ext_i32_i64:tci_args_rr (insn, &r0, &r1); regs[r0] = (int32_t )regs[r1];break ; -case INDEX_op_ext32u_i64:case INDEX_op_extu_i32_i64:tci_args_rr (insn, &r0, &r1); regs[r0] = (uint32_t )regs[r1];
@@ -1148,15 +1121,6 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)case INDEX_op_mov_i32:case INDEX_op_mov_i64: -case INDEX_op_ext8s_i32: -case INDEX_op_ext8s_i64: -case INDEX_op_ext8u_i32: -case INDEX_op_ext8u_i64: -case INDEX_op_ext16s_i32: -case INDEX_op_ext16s_i64: -case INDEX_op_ext16u_i32: -case INDEX_op_ext32s_i64: -case INDEX_op_ext32u_i64:case INDEX_op_ext_i32_i64:case INDEX_op_extu_i32_i64:case INDEX_op_bswap16_i32:
docs/devel/tcg-ops.rst +0 -14
@@ -396,20 +396,6 @@ Misc - | *t0* = *t1* | Move *t1* to *t0* (both operands must have the same type). - * - ext8s_i32/i64 *t0*, *t1* - - ext8u_i32/i64 *t0*, *t1* - - ext16s_i32/i64 *t0*, *t1* - - ext16u_i32/i64 *t0*, *t1* - - ext32s_i64 *t0*, *t1* - - ext32u_i64 *t0*, *t1* - - - | 8, 16 or 32 bit sign/zero extension (both operands must have the same type) - * - bswap16_i32/i64 *t0*, *t1*, *flags* - | 16 bit byte swap on the low bits of a 32/64 bit input.
tcg/aarch64/tcg-target.c.inc +1 -21
@@ -2503,17 +2503,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType ext, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -2991,16 +2981,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_bswap16_i64: case INDEX_op_bswap32_i64: case INDEX_op_bswap64_i64: - case INDEX_op_ext8s_i32: - case INDEX_op_ext16s_i32: - case INDEX_op_ext8u_i32: - case INDEX_op_ext16u_i32: - case INDEX_op_ext8s_i64: - case INDEX_op_ext16s_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extract_i32:
tcg/arm/tcg-target.c.inc +0 -7
@@ -2157,10 +2157,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8u_i32: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16u_i32: default: g_assert_not_reached(); }
@@ -2182,9 +2178,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_not_i32: case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: - case INDEX_op_ext8s_i32: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16u_i32: case INDEX_op_extract_i32: case INDEX_op_sextract_i32: return C_O1_I1(r, r);
tcg/i386/tcg-target.c.inc +1 -23
@@ -3111,17 +3111,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -3758,18 +3748,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_extrh_i64_i32: return C_O1_I1(r, 0); - case INDEX_op_ext8s_i32: - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - return C_O1_I1(r, q); - - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32:
tcg/loongarch64/tcg-target.c.inc +1 -21
@@ -1705,17 +1705,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -2251,16 +2241,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_brcond_i64: return C_O0_I2(rZ, rZ); - case INDEX_op_ext8s_i32: - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32:
tcg/mips/tcg-target.c.inc +3 -17
@@ -650,7 +650,7 @@ static void tcg_out_movi(TCGContext *s, TCGType type, static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs) { - tcg_debug_assert(TCG_TARGET_HAS_ext8s_i32); + tcg_debug_assert(use_mips32r2_instructions); tcg_out_opc_reg(s, OPC_SEB, rd, TCG_REG_ZERO, rs); }
@@ -661,7 +661,7 @@ static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs) static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs) { - tcg_debug_assert(TCG_TARGET_HAS_ext16s_i32); + tcg_debug_assert(use_mips32r2_instructions); tcg_out_opc_reg(s, OPC_SEH, rd, TCG_REG_ZERO, rs); }
@@ -2160,15 +2160,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -2192,8 +2184,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_not_i32: case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: - case INDEX_op_ext8s_i32: - case INDEX_op_ext16s_i32: case INDEX_op_extract_i32: case INDEX_op_sextract_i32: case INDEX_op_ld8u_i64:
@@ -2208,10 +2198,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_bswap16_i64: case INDEX_op_bswap32_i64: case INDEX_op_bswap64_i64: - case INDEX_op_ext8s_i64: - case INDEX_op_ext16s_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32:
tcg/ppc/tcg-target.c.inc +1 -16
@@ -3547,17 +3547,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -4183,8 +4173,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_ctpop_i32: case INDEX_op_neg_i32: case INDEX_op_not_i32: - case INDEX_op_ext8s_i32: - case INDEX_op_ext16s_i32: case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: case INDEX_op_extract_i32:
@@ -4199,9 +4187,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_ctpop_i64: case INDEX_op_neg_i64: case INDEX_op_not_i64: - case INDEX_op_ext8s_i64: - case INDEX_op_ext16s_i64: - case INDEX_op_ext32s_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_bswap16_i64:
tcg/riscv/tcg-target.c.inc +1 -21
@@ -2386,17 +2386,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -2644,17 +2634,7 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_ld_i64: case INDEX_op_not_i64: case INDEX_op_neg_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32u_i64: case INDEX_op_extu_i32_i64: - case INDEX_op_ext8s_i32: - case INDEX_op_ext8s_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext32s_i64: case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32: case INDEX_op_ext_i32_i64:
tcg/s390x/tcg-target.c.inc +1 -21
@@ -2787,17 +2787,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: default:
@@ -3346,16 +3336,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_neg_i64: case INDEX_op_not_i32: case INDEX_op_not_i64: - case INDEX_op_ext8s_i32: - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extract_i32:
tcg/sparc64/tcg-target.c.inc +1 -13
@@ -1524,17 +1524,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */ - case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */ - case INDEX_op_ext8s_i64: - case INDEX_op_ext8u_i32: - case INDEX_op_ext8u_i64: - case INDEX_op_ext16s_i32: - case INDEX_op_ext16s_i64: - case INDEX_op_ext16u_i32: - case INDEX_op_ext16u_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: - case INDEX_op_ext_i32_i64: + case INDEX_op_ext_i32_i64: /* Always emitted via tcg_reg_alloc_op. */ case INDEX_op_extu_i32_i64: default: g_assert_not_reached();
@@ -1564,8 +1554,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_neg_i64: case INDEX_op_not_i32: case INDEX_op_not_i64: - case INDEX_op_ext32s_i64: - case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extract_i64:
tcg/tci/tcg-target.c.inc +29 -73
163 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 50/81 tcg: Add all_outop[]
In reply to Richard HendersonAdd infrastructure for more consolidated output of opcodes. The base structure allows for constraints to be either static or dynamic, and for the existence of those constraints to replace TCG_TARGET_HAS_* and the bulk of tcg_op_supported.
--- tcg/tcg.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 7 deletions(-)
tcg/tcg.c +53 -7
@@ -862,6 +862,8 @@ static int tcg_out_pool_finalize(TCGContext *s)#define C_N1_O1_I4 (O1 ,O2 ,I1 ,I2 ,I3 ,I4 ) C_PFX6(c_n1_o1_i4_, O1, O2, I1, I2, I3, I4),typedef enum { + C_NotReached =-3 , + C_Dynamic =-2 , C_NotImplemented =-1 ,#include "tcg-target-con-set.h" }TCGConstraintSetIndex ;
@@ -955,6 +957,11 @@ static const TCGConstraintSet constraint_sets[] = {#define C_O2_I4 (O1 ,O2 ,I1 ,I2 ,I3 ,I4 ) C_PFX6(c_o2_i4_, O1, O2, I1, I2, I3, I4)#define C_N1_O1_I4 (O1 ,O2 ,I1 ,I2 ,I3 ,I4 ) C_PFX6(c_n1_o1_i4_, O1, O2, I1, I2, I3, I4) +typedef struct TCGOutOp { +TCGConstraintSetIndex static_constraint; +TCGConstraintSetIndex (*dynamic_constraint)(TCGType type,unsigned flags); +}TCGOutOp ; +#include "tcg-target.c.inc" #ifndef CONFIG_TCG_INTERPRETER
@@ -964,6 +971,14 @@ QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetState, tlb.f[0]) - < MIN_TLB_MASK_TABLE_OFS);#endif +static const TCGOutOp outop_notreached = { + .static_constraint = C_NotReached, +}; + +static const TCGOutOp *const all_outop[NB_OPS ] = { + [0 ...NB_OPS -1 ] = &outop_notreached, +}; +/* * All TCG threads except the parent (i.e. the one that called tcg_context_init * and registered the target's TCG globals) must register with this function
@@ -2410,8 +2425,32 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)return has_type && TCG_TARGET_HAS_cmpsel_vec;default : -tcg_debug_assert (op > INDEX_op_last_generic && op <NB_OPS ); +if (op < INDEX_op_last_generic) { +const TCGOutOp *outop; +TCGConstraintSetIndex con_set; + +if (!has_type) { +return false; + } + + outop = all_outop[op]; +tcg_debug_assert (outop !=NULL ); + + con_set = outop->static_constraint; +if (con_set == C_Dynamic) { + con_set = outop->dynamic_constraint (type, flags); + } +if (con_set >=0 ) { +return true; + } +tcg_debug_assert (con_set == C_NotImplemented); +return false; + } +tcg_debug_assert (op <NB_OPS );return true; + +case INDEX_op_last_generic: +g_assert_not_reached (); } }
@@ -3331,18 +3370,25 @@ static void process_constraint_sets(TCGContext *s)static const TCGArgConstraint *opcode_args_ct (const TCGOp *op) { -const TCGOpDef *def = &tcg_op_defs[op->opc]; +TCGOpcode opc = op->opc; +TCGType type =TCGOP_TYPE (op); +unsigned flags =TCGOP_FLAGS (op); +const TCGOpDef *def = &tcg_op_defs[opc]; +const TCGOutOp *outop = all_outop[opc];TCGConstraintSetIndex con_set; -#ifdef CONFIG_DEBUG_TCG -assert (tcg_op_supported (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op))); -#endif -if (def->flags &TCG_OPF_NOT_PRESENT ) {return empty_cts; } - con_set =tcg_target_op_def (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op)); +if (outop) { + con_set = outop->static_constraint; +if (con_set == C_Dynamic) { + con_set = outop->dynamic_constraint (type, flags); + } + }else { + con_set =tcg_target_op_def (opc, type, flags); + }tcg_debug_assert (con_set >=0 && con_set <ARRAY_SIZE (constraint_sets));/* The constraint arguments must match TCGOpcode arguments. */
Signature · 1 line
2.43.0
Re: [PATCH v2 50/81] tcg: Add all_outop[]
Quoted 32 lines · Richard Henderson
Add infrastructure for more consolidated output of opcodes. The base structure allows for constraints to be either static or dynamic, and for the existence of those constraints to replace TCG_TARGET_HAS_* and the bulk of
tcg_op_supported.Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 7 deletions(-)tcg/tcg.c +12
-1+static const TCGOutOp outop_notreached = { + .static_constraint = C_NotReached, +}; + +static const TCGOutOp *const all_outop[NB_OPS ] = { + [0 ...NB_OPS -1 ] = &outop_notreached, +};@@ -3331,18 +3370,25 @@ static void process_constraint_sets(TCGContext *s)static const TCGArgConstraint *opcode_args_ct (const TCGOp *op) { -const TCGOpDef *def = &tcg_op_defs[op->opc]; +TCGOpcode opc = op->opc; +TCGType type =TCGOP_TYPE (op); +unsigned flags =TCGOP_FLAGS (op); +const TCGOpDef *def = &tcg_op_defs[opc]; +const TCGOutOp *outop = all_outop[opc];TCGConstraintSetIndex con_set;
tcg/tcg.c static void process_constraint_sets(TCGContext *s) · line 3384
Quoted 10 lines
tcg/tcg.c +1
-5-#ifdef CONFIG_DEBUG_TCG -assert (tcg_op_supported (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op))); -#endif -if (def->flags &TCG_OPF_NOT_PRESENT ) {return empty_cts; } - con_set =tcg_target_op_def (op->opc,TCGOP_TYPE (op),TCGOP_FLAGS (op)); +if (outop) {
Always true,
tcg/tcg.c static void process_constraint_sets(TCGContext *s) · line 3390
Quoted 6 lines
tcg/tcg.c +6
-0+ con_set = outop->static_constraint; +if (con_set == C_Dynamic) { + con_set = outop->dynamic_constraint (type, flags); + } + }else { + con_set =tcg_target_op_def (opc, type, flags);
so unreachable. Gremlins?
Quoted 1 line
(quoted diff) +1
-0+ }
Re: [PATCH v2 50/81] tcg: Add all_outop[]
Quoted 43 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Richard Henderson
Add infrastructure for more consolidated output of opcodes. The base structure allows for constraints to be either static or dynamic, and for the existence of those constraints to replace TCG_TARGET_HAS_* and the bulk of
tcg_op_supported.Signed-off-by Richard Henderson <[email protected]>---
tcg/tcg.c| 60 ++++++++++++++++++++++++++++++++++++++++++++++++-------1 file changed, 53 insertions(+), 7 deletions(-)tcg/tcg.c +12
-1+static const TCGOutOp outop_notreached = { + .static_constraint = C_NotReached, +}; + +static const TCGOutOp *const all_outop[NB_OPS ] = { + [0 ... NB_OPS - 1] = &outop_notreached, +};@@ -3331,18 +3370,25 @@ static void process_constraint_sets(TCGContext *s) static const TCGArgConstraint *opcode_args_ct(const TCGOp *op) { - const TCGOpDef *def = &tcg_op_defs[op->opc]; + TCGOpcode opc = op->opc; + TCGType type = TCGOP_TYPE(op); + unsigned flags = TCGOP_FLAGS(op); + const TCGOpDef *def = &tcg_op_defs[opc]; + const TCGOutOp *outop = all_outop[opc];tcg/tcg.c static void process_constraint_sets(TCGContext *s) · line 3381
Quoted 10 lines
tcg/tcg.c +1
-5TCGConstraintSetIndex con_set; -#ifdef CONFIG_DEBUG_TCG - assert(tcg_op_supported(op->opc, TCGOP_TYPE(op), TCGOP_FLAGS(op))); -#endif - if (def->flags & TCG_OPF_NOT_PRESENT) { return empty_cts; } - con_set = tcg_target_op_def(op->opc, TCGOP_TYPE(op), TCGOP_FLAGS(op)); + if (outop) {Always true,
Quoted 8 lines
tcg/tcg.c static void process_constraint_sets(TCGContext *s) · line 3390
Quoted 6 lines
tcg/tcg.c +6
-0+ con_set = outop->static_constraint; + if (con_set == C_Dynamic) { + con_set = outop->dynamic_constraint(type, flags); + } + } else { + con_set = tcg_target_op_def(opc, type, flags);so unreachable. Gremlins?
Yes, this was the midnight gremlin of which we spoke.
The outop_unreached thing has to wait until the end of the conversion.
r~
PATCH v2 51/81 tcg: Merge INDEX_op_mov_{i32,i64}
In reply to Richard HendersonBegin to rely on TCGOp.type to discriminate operations, rather than two different opcodes. Convert mov first. Introduce TCG_OPF_INT in order to keep opcode dumps the same.
--- include/tcg/tcg-opc.h | 4 ++-- include/tcg/tcg.h | 2 ++ tcg/optimize.c | 7 +++---- tcg/tcg-op.c | 4 ++-- tcg/tcg.c | 32 ++++++++++++++++++-------------- tcg/tci.c | 5 ++--- tcg/aarch64/tcg-target.c.inc | 2 -- tcg/arm/tcg-target.c.inc | 1 - tcg/i386/tcg-target.c.inc | 2 -- tcg/loongarch64/tcg-target.c.inc | 2 -- tcg/mips/tcg-target.c.inc | 2 -- tcg/ppc/tcg-target.c.inc | 2 -- tcg/riscv/tcg-target.c.inc | 2 -- tcg/s390x/tcg-target.c.inc | 2 -- tcg/sparc64/tcg-target.c.inc | 2 -- tcg/tci/tcg-target.c.inc | 15 +-------------- 16 files changed, 30 insertions(+), 56 deletions(-)
include/tcg/tcg-opc.h +2 -2
@@ -37,7 +37,8 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_NOT_PRESENT) DEF(mb, 0, 0, 1, TCG_OPF_NOT_PRESENT) -DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) +DEF(mov, 1, 1, 0, TCG_OPF_INT | TCG_OPF_NOT_PRESENT) + DEF(setcond_i32, 1, 2, 1, 0) DEF(negsetcond_i32, 1, 2, 1, 0)DEF (movcond_i32,1 ,4 ,1 ,0 )
@@ -98,7 +99,6 @@ DEF(clz_i32, 1, 2, 0, 0) DEF(ctz_i32, 1, 2, 0, 0) DEF(ctpop_i32, 1, 1, 0, 0) -DEF(mov_i64, 1, 1, 0, TCG_OPF_NOT_PRESENT) DEF(setcond_i64, 1, 2, 1, 0) DEF(negsetcond_i64, 1, 2, 1, 0)DEF (movcond_i64,1 ,4 ,1 ,0 )
include/tcg/tcg.h +2 -0
@@ -699,6 +699,8 @@ enum {/* Instruction has side effects: it cannot be removed if its outputs are not used, and might trigger exceptions. */ TCG_OPF_SIDE_EFFECTS =0x08 , +/* Instruction operands may be I32 or I64 */ +TCG_OPF_INT =0x10 ,/* Instruction is optional and not implemented by the host, or insn is generic and should not be implemented by the host. */ TCG_OPF_NOT_PRESENT = 0x20,
tcg/optimize.c +3 -4
@@ -363,10 +363,8 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src)switch (ctx->type) {case TCG_TYPE_I32 : - new_op = INDEX_op_mov_i32; -break ;case TCG_TYPE_I64 : - new_op = INDEX_op_mov_i64; + new_op = INDEX_op_mov;break ;case TCG_TYPE_V64 :case TCG_TYPE_V128 :
@@ -2918,7 +2916,8 @@ void tcg_optimize(TCGContext *s)case INDEX_op_mb: done =fold_mb (&ctx, op);break ; - CASE_OP_32_64_VEC(mov): +case INDEX_op_mov: +case INDEX_op_mov_vec: done =fold_mov (&ctx, op);break ; CASE_OP_32_64(movcond):
tcg/tcg-op.c +2 -2
@@ -351,7 +351,7 @@ void tcg_gen_discard_i32(TCGv_i32 arg)void tcg_gen_mov_i32 (TCGv_i32 ret,TCGv_i32 arg) {if (ret != arg) { -tcg_gen_op2_i32 (INDEX_op_mov_i32, ret, arg); +tcg_gen_op2_i32 (INDEX_op_mov, ret, arg); } }
@@ -1411,7 +1411,7 @@ void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg)return ; }if (TCG_TARGET_REG_BITS ==64 ) { -tcg_gen_op2_i64 (INDEX_op_mov_i64, ret, arg); +tcg_gen_op2_i64 (INDEX_op_mov, ret, arg); }else {TCGTemp *ts =tcgv_i64_temp (arg);
tcg/tcg.c +18 -14
@@ -2188,7 +2188,9 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_qemu_st_a64_i128:return TCG_TARGET_HAS_qemu_ldst_i128; -case INDEX_op_mov_i32: +case INDEX_op_mov: +return has_type; +case INDEX_op_setcond_i32:case INDEX_op_brcond_i32:case INDEX_op_movcond_i32:
@@ -2270,7 +2272,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_setcond2_i32:return TCG_TARGET_REG_BITS ==32 ; -case INDEX_op_mov_i64:case INDEX_op_setcond_i64:case INDEX_op_brcond_i64:case INDEX_op_movcond_i64:
@@ -2841,18 +2842,23 @@ void tcg_dump_ops(TCGContext *s, FILE *f, bool have_prefs) col +=ne_fprintf (f,",%s" , t); } }else { - col +=ne_fprintf (f," %s " , def->name); +if (def->flags &TCG_OPF_INT ) { + col +=ne_fprintf (f," %s_i%d " , + def->name, +8 *tcg_type_size (TCGOP_TYPE (op))); + }else if (def->flags &TCG_OPF_VECTOR ) { + col +=ne_fprintf (f,"%s v%d,e%d," , + def->name, +8 *tcg_type_size (TCGOP_TYPE (op)), +8 <<TCGOP_VECE (op)); + }else { + col +=ne_fprintf (f," %s " , def->name); + } nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; nb_cargs = def->nb_cargs; -if (def->flags &TCG_OPF_VECTOR ) { - col +=ne_fprintf (f,"v%d,e%d," , -8 *tcg_type_size (TCGOP_TYPE (op)), -8 <<TCGOP_VECE (op)); - } - k =0 ;for (i =0 ; i < nb_oargs; i++) {const char *sep = k ?"," :"" ;
@@ -4146,8 +4152,7 @@ liveness_pass_1(TCGContext *s)/* Incorporate constraints for this operand. */ switch (opc) { -case INDEX_op_mov_i32: -case INDEX_op_mov_i64: +case INDEX_op_mov:/* Note that these are TCG_OPF_NOT_PRESENT and do not have proper constraints. That said, special case moves to propagate preferences backward. */
@@ -4305,7 +4310,7 @@ liveness_pass_2(TCGContext *s) }/* Outputs become available. */ -if (opc == INDEX_op_mov_i32 || opc == INDEX_op_mov_i64) { +if (opc == INDEX_op_mov) { arg_ts =arg_temp (op->args[0 ]); dir_ts = arg_ts->state_ptr;if (dir_ts) {
@@ -6420,8 +6425,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start)TCGOpcode opc = op->opc;switch (opc) { -case INDEX_op_mov_i32: -case INDEX_op_mov_i64: +case INDEX_op_mov:case INDEX_op_mov_vec:tcg_reg_alloc_mov (s, op);break ;
tcg/tci.c +2 -3
@@ -473,7 +473,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] = regs[tmp32 ? r3 : r4];break ;#endif - CASE_32_64(mov) +case INDEX_op_mov:tci_args_rr (insn, &r0, &r1); regs[r0] = regs[r1];break ;
@@ -1119,8 +1119,7 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) op_name, str_r(r0), str_r(r1), s2);break ; -case INDEX_op_mov_i32: -case INDEX_op_mov_i64: +case INDEX_op_mov:case INDEX_op_ext_i32_i64:case INDEX_op_extu_i32_i64:case INDEX_op_bswap16_i32:
tcg/aarch64/tcg-target.c.inc +0 -2
@@ -2498,8 +2498,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType ext, tcg_out_mb(s, a0); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/arm/tcg-target.c.inc +0 -1
@@ -2153,7 +2153,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_mb(s, args[0]); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/i386/tcg-target.c.inc +0 -2
@@ -3106,8 +3106,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_mb: tcg_out_mb(s, a0); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/loongarch64/tcg-target.c.inc +0 -2
@@ -1700,8 +1700,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_qemu_ldst_i128(s, a0, a1, a2, a3, false); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/mips/tcg-target.c.inc +0 -2
@@ -2155,8 +2155,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_mb: tcg_out_mb(s, a0); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/ppc/tcg-target.c.inc +0 -2
@@ -3542,8 +3542,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_mb(s, args[0]); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/riscv/tcg-target.c.inc +0 -2
@@ -2381,8 +2381,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, } break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/s390x/tcg-target.c.inc +0 -2
@@ -2782,8 +2782,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, } break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/sparc64/tcg-target.c.inc +0 -2
@@ -1519,8 +1519,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_arithi(s, a0, a1, a2, SHIFT_SRA); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
tcg/tci/tcg-target.c.inc +1 -14
@@ -505,18 +505,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { - switch (type) { - case TCG_TYPE_I32: - tcg_out_op_rr(s, INDEX_op_mov_i32, ret, arg); - break; -#if TCG_TARGET_REG_BITS == 64 - case TCG_TYPE_I64: - tcg_out_op_rr(s, INDEX_op_mov_i64, ret, arg); - break; -#endif - default: - g_assert_not_reached(); - } + tcg_out_op_rr(s, INDEX_op_mov, ret, arg); return true; }
@@ -829,8 +818,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_op_v(s, opc); break; - case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */ case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
Signature · 1 line
2.43.0
PATCH v2 52/81 tcg: Convert add to TCGOutOpBinary
In reply to Richard Henderson--- tcg/sparc64/tcg-target-con-set.h | 1 + tcg/tcg.c | 39 ++++++++++- tcg/aarch64/tcg-target.c.inc | 51 +++++++------- tcg/arm/tcg-target.c.inc | 43 ++++++++---- tcg/i386/tcg-target.c.inc | 56 +++++++++------- tcg/loongarch64/tcg-target.c.inc | 38 +++++------ tcg/mips/tcg-target.c.inc | 31 ++++++--- tcg/ppc/tcg-target.c.inc | 47 +++++++------ tcg/riscv/tcg-target.c.inc | 39 ++++++----- tcg/s390x/tcg-target.c.inc | 110 +++++++++++++++---------------- tcg/sparc64/tcg-target.c.inc | 25 +++++-- tcg/tci/tcg-target.c.inc | 15 ++++- 12 files changed, 300 insertions(+), 195 deletions(-)
tcg/sparc64/tcg-target-con-set.h +1 -0
@@ -14,6 +14,7 @@ C_O0_I2(rZ, r) C_O0_I2(rZ, rJ) C_O1_I1(r, r) C_O1_I2(r, r, r) +C_O1_I2(r, r, rJ) C_O1_I2(r, rZ, rJ) C_O1_I4(r, rZ, rJ, rI, 0)C_O2_I2 (r, r, rZ, rJ)
tcg/tcg.c +37 -2
@@ -962,6 +962,14 @@ typedef struct TCGOutOp {TCGConstraintSetIndex (*dynamic_constraint)(TCGType type,unsigned flags); } TCGOutOp; +typedef struct TCGOutOpBinary { +TCGOutOp base; +void (*out_rrr)(TCGContext *s,TCGType type, +TCGReg a0,TCGReg a1,TCGReg a2); +void (*out_rri)(TCGContext *s,TCGType type, +TCGReg a0,TCGReg a1,tcg_target_long a2); +}TCGOutOpBinary ; +#include "tcg-target.c.inc" #ifndef CONFIG_TCG_INTERPRETER
@@ -975,10 +983,20 @@ static const TCGOutOp outop_notreached = { .static_constraint = C_NotReached, }; +/* +* Register V as the TCGOutOp for O. +* Validate that V has subclass T. +*/ +#define OUTOP (O ,T ,V ) [O] = _Generic(V, T: &V.base) +static const TCGOutOp *const all_outop[NB_OPS ] = { [0 ...NB_OPS -1 ] = &outop_notreached, +OUTOP (INDEX_op_add_i32, TCGOutOpBinary, outop_add), +OUTOP (INDEX_op_add_i64, TCGOutOpBinary, outop_add), }; +#undef OUTOP +/* * All TCG threads except the parent (i.e. the one that called tcg_context_init * and registered the target's TCG globals) must register with this function
@@ -5400,6 +5418,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) }/* emit instruction */ +TCGType type =TCGOP_TYPE (op);switch (op->opc) {case INDEX_op_ext_i32_i64:tcg_out_exts_i32_i64 (s, new_args[0 ], new_args[1 ]);
@@ -5410,12 +5429,28 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)case INDEX_op_extrl_i64_i32:tcg_out_extrl_i64_i32 (s, new_args[0 ], new_args[1 ]);break ; + +case INDEX_op_add_i32: +case INDEX_op_add_i64: + { +const TCGOutOpBinary *out = +container_of (all_outop[op->opc], TCGOutOpBinary, base); + +tcg_debug_assert (!const_args[1 ]); +if (const_args[2 ]) { + out->out_rri (s, type, new_args[0 ], new_args[1 ], new_args[2 ]); + }else { + out->out_rrr (s, type, new_args[0 ], new_args[1 ], new_args[2 ]); + } + } +break ; +default :if (def->flags &TCG_OPF_VECTOR ) { -tcg_out_vec_op (s, op->opc,TCGOP_TYPE (op) -TCG_TYPE_V64 , +tcg_out_vec_op (s, op->opc, type -TCG_TYPE_V64 ,TCGOP_VECE (op), new_args, const_args); }else { -tcg_out_op (s, op->opc,TCGOP_TYPE (op), new_args, const_args); +tcg_out_op (s, op->opc, type, new_args, const_args); }break ; }
tcg/aarch64/tcg-target.c.inc +25 -26
78 lines not on this page · raw message
tcg/arm/tcg-target.c.inc +32 -11
73 lines not on this page · raw message
tcg/i386/tcg-target.c.inc +34 -22
74 lines not on this page · raw message
tcg/loongarch64/tcg-target.c.inc +18 -20
@@ -1278,6 +1278,24 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } + +static void tgen_add(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, TCGReg a2) +{ + if (type == TCG_TYPE_I32) { + tcg_out_opc_add_w(s, a0, a1, a2); + } else { + tcg_out_opc_add_d(s, a0, a1, a2); + } +} + +static const TCGOutOpBinary outop_add = { + .base.static_constraint = C_O1_I2(r, r, rJ), + .out_rrr = tgen_add, + .out_rri = tcg_out_addi, +}; + + static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS])
@@ -1536,21 +1554,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, } break; - case INDEX_op_add_i32: - if (c2) { - tcg_out_addi(s, TCG_TYPE_I32, a0, a1, a2); - } else { - tcg_out_opc_add_w(s, a0, a1, a2); - } - break; - case INDEX_op_add_i64: - if (c2) { - tcg_out_addi(s, TCG_TYPE_I64, a0, a1, a2); - } else { - tcg_out_opc_add_d(s, a0, a1, a2); - } - break; - case INDEX_op_sub_i32: if (c2) { tcg_out_addi(s, TCG_TYPE_I32, a0, a1, -a2);
@@ -2297,11 +2300,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_rotr_i64: return C_O1_I2(r, r, ri); - case INDEX_op_add_i32: - return C_O1_I2(r, r, ri); - case INDEX_op_add_i64: - return C_O1_I2(r, r, rJ); - case INDEX_op_and_i32: case INDEX_op_and_i64: case INDEX_op_nor_i32:
tcg/mips/tcg-target.c.inc +22 -9
@@ -1678,6 +1678,28 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* Always indirect, nothing to do */ } + +static void tgen_add(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, TCGReg a2) +{ + MIPSInsn insn = type == TCG_TYPE_I32 ? OPC_ADDU : OPC_DADDU; + tcg_out_opc_reg(s, insn, a0, a1, a2); +} + +static void tgen_addi(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, tcg_target_long a2) +{ + MIPSInsn insn = type == TCG_TYPE_I32 ? OPC_ADDIU : OPC_DADDIU; + tcg_out_opc_imm(s, insn, a0, a1, a2); +} + +static const TCGOutOpBinary outop_add = { + .base.static_constraint = C_O1_I2(r, r, rJ), + .out_rrr = tgen_add, + .out_rri = tgen_addi, +}; + + static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS])
@@ -1755,12 +1777,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_ldst(s, i1, a0, a1, a2); break; - case INDEX_op_add_i32: - i1 = OPC_ADDU, i2 = OPC_ADDIU; - goto do_binary; - case INDEX_op_add_i64: - i1 = OPC_DADDU, i2 = OPC_DADDIU; - goto do_binary; case INDEX_op_or_i32: case INDEX_op_or_i64: i1 = OPC_OR, i2 = OPC_ORI;
@@ -2213,9 +2229,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_st_i64: return C_O0_I2(rZ, r); - case INDEX_op_add_i32: - case INDEX_op_add_i64: - return C_O1_I2(r, r, rJ); case INDEX_op_sub_i32: case INDEX_op_sub_i64: return C_O1_I2(r, rZ, rN);
tcg/ppc/tcg-target.c.inc +22 -25
89 lines not on this page · raw message
tcg/riscv/tcg-target.c.inc +22 -17
@@ -1960,6 +1960,28 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, flush_idcache_range(jmp_rx, jmp_rw, 4); } + +static void tgen_add(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, TCGReg a2) +{ + RISCVInsn insn = type == TCG_TYPE_I32 ? OPC_ADDW : OPC_ADD; + tcg_out_opc_reg(s, insn, a0, a1, a2); +} + +static void tgen_addi(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, tcg_target_long a2) +{ + RISCVInsn insn = type == TCG_TYPE_I32 ? OPC_ADDIW : OPC_ADDI; + tcg_out_opc_imm(s, insn, a0, a1, a2); +} + +static const TCGOutOpBinary outop_add = { + .base.static_constraint = C_O1_I2(r, r, rI), + .out_rrr = tgen_add, + .out_rri = tgen_addi, +}; + + static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS])
@@ -2022,21 +2044,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_ldst(s, OPC_SD, a0, a1, a2); break; - case INDEX_op_add_i32: - if (c2) { - tcg_out_opc_imm(s, OPC_ADDIW, a0, a1, a2); - } else { - tcg_out_opc_reg(s, OPC_ADDW, a0, a1, a2); - } - break; - case INDEX_op_add_i64: - if (c2) { - tcg_out_opc_imm(s, OPC_ADDI, a0, a1, a2); - } else { - tcg_out_opc_reg(s, OPC_ADD, a0, a1, a2); - } - break; - case INDEX_op_sub_i32: if (c2) { tcg_out_opc_imm(s, OPC_ADDIW, a0, a1, -a2);
@@ -2658,11 +2665,9 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_st_i64: return C_O0_I2(rZ, r); - case INDEX_op_add_i32: case INDEX_op_and_i32: case INDEX_op_or_i32: case INDEX_op_xor_i32: - case INDEX_op_add_i64: case INDEX_op_and_i64: case INDEX_op_or_i64: case INDEX_op_xor_i64:
tcg/s390x/tcg-target.c.inc +55 -55
139 lines not on this page · raw message
tcg/sparc64/tcg-target.c.inc +20 -5
@@ -1288,6 +1288,26 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, { } + +static void tgen_add(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, TCGReg a2) +{ + tcg_out_arith(s, a0, a1, a2, ARITH_ADD); +} + +static void tgen_addi(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, tcg_target_long a2) +{ + tcg_out_arithi(s, a0, a1, a2, ARITH_ADD); +} + +static const TCGOutOpBinary outop_add = { + .base.static_constraint = C_O1_I2(r, r, rJ), + .out_rrr = tgen_add, + .out_rri = tgen_addi, +}; + + static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS])
@@ -1341,9 +1361,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, case INDEX_op_st32_i64: tcg_out_ldst(s, a0, a1, a2, STW); break; - OP_32_64(add): - c = ARITH_ADD; - goto gen_arith; OP_32_64(sub): c = ARITH_SUB; goto gen_arith;
@@ -1575,8 +1592,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_qemu_st_a64_i64: return C_O0_I2(rZ, r); - case INDEX_op_add_i32: - case INDEX_op_add_i64: case INDEX_op_mul_i32: case INDEX_op_mul_i64: case INDEX_op_div_i32:
tcg/tci/tcg-target.c.inc +12 -3
@@ -91,8 +91,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags) case INDEX_op_rem_i64: case INDEX_op_remu_i32: case INDEX_op_remu_i64: - case INDEX_op_add_i32: - case INDEX_op_add_i64: case INDEX_op_sub_i32: case INDEX_op_sub_i64: case INDEX_op_mul_i32:
@@ -665,6 +663,18 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, /* Always indirect, nothing to do */ } +static void tgen_add(TCGContext *s, TCGType type, + TCGReg a0, TCGReg a1, TCGReg a2) +{ + tcg_out_op_rrr(s, glue(INDEX_op_add_i,TCG_TARGET_REG_BITS), a0, a1, a2); +} + +static const TCGOutOpBinary outop_add = { + .base.static_constraint = C_O1_I2(r, r, r), + .out_rrr = tgen_add, +}; + + static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS])
@@ -706,7 +716,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type, tcg_out_ldst(s, opc, args[0], args[1], args[2]); break; - CASE_32_64(add) CASE_32_64(sub) CASE_32_64(mul) CASE_32_64(and)
Signature · 1 line
2.43.0
PATCH v2 53/81 tcg: Merge INDEX_op_add_{i32,i64}
In reply to Richard HendersonRely on TCGOP_TYPE instead of opcodes specific to each type.
--- include/tcg/tcg-opc.h | 4 ++-- target/sh4/translate.c | 6 +++--- tcg/optimize.c | 13 +++++-------- tcg/tcg-op.c | 4 ++-- tcg/tcg.c | 15 +++++---------- tcg/tci.c | 5 ++--- tcg/tci/tcg-target.c.inc | 6 ++---- 7 files changed, 21 insertions(+), 32 deletions(-)
include/tcg/tcg-opc.h +2 -2
@@ -39,6 +39,8 @@ DEF(mb, 0, 0, 1, TCG_OPF_NOT_PRESENT) DEF(mov, 1, 1, 0, TCG_OPF_INT | TCG_OPF_NOT_PRESENT) +DEF(add, 1, 2, 0, TCG_OPF_INT) + DEF(setcond_i32, 1, 2, 1, 0) DEF(negsetcond_i32, 1, 2, 1, 0)DEF (movcond_i32,1 ,4 ,1 ,0 )
@@ -52,7 +54,6 @@ DEF(st8_i32, 0, 2, 1, 0) DEF(st16_i32, 0, 2, 1, 0)DEF (st_i32,0 ,2 ,1 ,0 ) /* arith */ -DEF(add_i32, 1, 2, 0, 0) DEF(sub_i32, 1, 2, 0, 0) DEF(mul_i32, 1, 2, 0, 0)DEF (div_i32,1 ,2 ,0 ,0 )
@@ -115,7 +116,6 @@ DEF(st16_i64, 0, 2, 1, 0) DEF(st32_i64, 0, 2, 1, 0)DEF (st_i64,0 ,2 ,1 ,0 ) /* arith */ -DEF(add_i64, 1, 2, 0, 0) DEF(sub_i64, 1, 2, 0, 0) DEF(mul_i64, 1, 2, 0, 0)DEF (div_i64,1 ,2 ,0 ,0 )
target/sh4/translate.c +3 -3
@@ -1940,7 +1940,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env)NEXT_INSN ;switch (ctx->opcode &0xf00f ) {case 0x300c :/* add Rm,Rn */ - op_opc = INDEX_op_add_i32; + op_opc = INDEX_op_add; goto do_reg_op;case 0x2009 :/* and Rm,Rn */ op_opc = INDEX_op_and_i32;
@@ -1984,7 +1984,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env)if (op_dst !=B11_8 || mv_src >=0 ) { goto fail; } - op_opc = INDEX_op_add_i32; + op_opc = INDEX_op_add; op_arg =tcg_constant_i32 (B7_0s);break ;
@@ -2087,7 +2087,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env) ctx->memidx, ld_mop);break ; -case INDEX_op_add_i32: +case INDEX_op_add:if (op_dst != st_src) { goto fail; }
tcg/optimize.c +5 -8
@@ -412,7 +412,7 @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)uint64_t l64, h64;switch (op) { - CASE_OP_32_64(add): +case INDEX_op_add:return x + y; CASE_OP_32_64(sub):
@@ -2246,7 +2246,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg)break ; }if (convert) { -TCGOpcode add_opc, xor_opc, neg_opc; +TCGOpcode xor_opc, neg_opc;if (!inv && !neg) {return tcg_opt_gen_mov (ctx, op, op->args[0 ], op->args[1 ]);
@@ -2254,12 +2254,10 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg)switch (ctx->type) {case TCG_TYPE_I32 : - add_opc = INDEX_op_add_i32; neg_opc = INDEX_op_neg_i32; xor_opc = INDEX_op_xor_i32;break ;case TCG_TYPE_I64 : - add_opc = INDEX_op_add_i64; neg_opc = INDEX_op_neg_i64; xor_opc = INDEX_op_xor_i64;break ;
@@ -2270,7 +2268,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg)if (!inv) { op->opc = neg_opc; }else if (neg) { - op->opc = add_opc; + op->opc = INDEX_op_add; op->args[2 ] =arg_new_constant (ctx,-1 ); }else { op->opc = xor_opc;
@@ -2635,8 +2633,7 @@ static bool fold_sub(OptContext *ctx, TCGOp *op)if (arg_is_const (op->args[2 ])) {uint64_t val =arg_info (op->args[2 ])->val; - op->opc = (ctx->type ==TCG_TYPE_I32 - ? INDEX_op_add_i32 : INDEX_op_add_i64); + op->opc = INDEX_op_add; op->args[2 ] =arg_new_constant (ctx, -val); }return finish_folding (ctx, op);
@@ -2827,7 +2824,7 @@ void tcg_optimize(TCGContext *s)* Sorted alphabetically by opcode as much as possible. */ switch (opc) { - CASE_OP_32_64(add): +case INDEX_op_add: done =fold_add (&ctx, op);break ;case INDEX_op_add_vec:
tcg/tcg-op.c +2 -2
@@ -362,7 +362,7 @@ void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg)void tcg_gen_add_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2) { -tcg_gen_op3_i32 (INDEX_op_add_i32, ret, arg1, arg2); +tcg_gen_op3_i32 (INDEX_op_add, ret, arg1, arg2); }void tcg_gen_addi_i32 (TCGv_i32 ret,TCGv_i32 arg1,int32_t arg2)
@@ -1555,7 +1555,7 @@ void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset)void tcg_gen_add_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) {if (TCG_TARGET_REG_BITS ==64 ) { -tcg_gen_op3_i64 (INDEX_op_add_i64, ret, arg1, arg2); +tcg_gen_op3_i64 (INDEX_op_add, ret, arg1, arg2); }else {tcg_gen_add2_i32 (TCGV_LOW (ret),TCGV_HIGH (ret),TCGV_LOW (arg1),TCGV_HIGH (arg1),TCGV_LOW (arg2),TCGV_HIGH (arg2));
tcg/tcg.c +5 -10
@@ -991,8 +991,7 @@ static const TCGOutOp outop_notreached = {static const TCGOutOp *const all_outop[NB_OPS ] = { [0 ...NB_OPS -1 ] = &outop_notreached, -OUTOP (INDEX_op_add_i32, TCGOutOpBinary, outop_add), -OUTOP (INDEX_op_add_i64, TCGOutOpBinary, outop_add), +OUTOP (INDEX_op_add, TCGOutOpBinary, outop_add), };#undef OUTOP
@@ -2206,6 +2205,7 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_qemu_st_a64_i128:return TCG_TARGET_HAS_qemu_ldst_i128; +case INDEX_op_add:case INDEX_op_mov:return has_type;
@@ -2220,7 +2220,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_st8_i32:case INDEX_op_st16_i32:case INDEX_op_st_i32: -case INDEX_op_add_i32:case INDEX_op_sub_i32:case INDEX_op_neg_i32:case INDEX_op_mul_i32:
@@ -2304,7 +2303,6 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)case INDEX_op_st16_i64:case INDEX_op_st32_i64:case INDEX_op_st_i64: -case INDEX_op_add_i64:case INDEX_op_sub_i64:case INDEX_op_neg_i64:case INDEX_op_mul_i64:
@@ -4016,14 +4014,12 @@ liveness_pass_1(TCGContext *s)break ;case INDEX_op_add2_i32: - opc_new = INDEX_op_add_i32; +case INDEX_op_add2_i64: + opc_new = INDEX_op_add; goto do_addsub2;case INDEX_op_sub2_i32: opc_new = INDEX_op_sub_i32; goto do_addsub2; -case INDEX_op_add2_i64: - opc_new = INDEX_op_add_i64; - goto do_addsub2;case INDEX_op_sub2_i64: opc_new = INDEX_op_sub_i64; do_addsub2:
@@ -5430,8 +5426,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)tcg_out_extrl_i64_i32 (s, new_args[0 ], new_args[1 ]);break ; -case INDEX_op_add_i32: -case INDEX_op_add_i64: +case INDEX_op_add: {const TCGOutOpBinary *out =container_of (all_outop[op->opc], TCGOutOpBinary, base);
tcg/tci.c +2 -3
@@ -533,7 +533,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Arithmetic operations (mixed 32/64 bit). */ - CASE_32_64(add) +case INDEX_op_add:tci_args_rrr (insn, &r0, &r1, &r2); regs[r0] = regs[r1] + regs[r2];break ;
@@ -1138,8 +1138,7 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) op_name, str_r(r0), str_r(r1));break ; -case INDEX_op_add_i32: -case INDEX_op_add_i64: +case INDEX_op_add:case INDEX_op_sub_i32:case INDEX_op_sub_i64:case INDEX_op_mul_i32:
tcg/tci/tcg-target.c.inc +2 -4
@@ -475,9 +475,7 @@ static void tcg_out_ldst(TCGContext *s, TCGOpcode op, TCGReg val, stack_bounds_check(base, offset); if (offset != sextract32(offset, 0, 16)) { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, offset); - tcg_out_op_rrr(s, (TCG_TARGET_REG_BITS == 32 - ? INDEX_op_add_i32 : INDEX_op_add_i64), - TCG_REG_TMP, TCG_REG_TMP, base); + tcg_out_op_rrr(s, INDEX_op_add, TCG_REG_TMP, TCG_REG_TMP, base); base = TCG_REG_TMP; offset = 0; }
@@ -666,7 +664,7 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, static void tgen_add(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1, TCGReg a2) { - tcg_out_op_rrr(s, glue(INDEX_op_add_i,TCG_TARGET_REG_BITS), a0, a1, a2); + tcg_out_op_rrr(s, INDEX_op_add, a0, a1, a2); } static const TCGOutOpBinary outop_add = {
Signature · 1 line
2.43.0
Re: [PATCH v2 53/81] tcg: Merge INDEX_op_add_{i32,i64}
Quoted 12 lines · Richard Henderson
Rely on
TCGOP_TYPEinstead of opcodes specific to each type.Signed-off-by Richard Henderson <[email protected]>--- include/tcg/tcg-opc.h | 4 ++-- target/sh4/translate.c | 6 +++--- tcg/optimize.c | 13 +++++-------- tcg/tcg-op.c | 4 ++-- tcg/tcg.c | 15 +++++---------- tcg/tci.c | 5 ++--- tcg/tci/tcg-target.c.inc | 6 ++---- 7 files changed, 21 insertions(+), 32 deletions(-)