On 2/17/25 00:01, Philippe Mathieu-Daudé wrote:
On 17/2/25 00:08, Richard Henderson wrote:
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
include/tcg/tcg-opc.h | 3 +--
tcg/optimize.c | 9 +++------
tcg/tcg-op.c | 21 ++++++++++-----------
tcg/tcg.c | 6 ++----
tcg/tci.c | 6 ++----
docs/devel/tcg-ops.rst | 6 +++---
tcg/tci/tcg-target.c.inc | 2 +-
7 files changed, 22 insertions(+), 31 deletions(-)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index db0e79059b..0eeec47b83 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -765,8 +765,7 @@ void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32
arg2)
tcg_temp_free_i64(t2);
return;
}
- if (tcg_op_supported(INDEX_op_ctpop_i32, TCG_TYPE_I32, 0) ||
- tcg_op_supported(INDEX_op_ctpop_i64, TCG_TYPE_I64, 0)) {
+ if (tcg_op_supported(INDEX_op_ctpop, TCG_TYPE_REG, 0)) {
t = tcg_temp_ebb_new_i32();
tcg_gen_subi_i32(t, arg1, 1);
tcg_gen_andc_i32(t, t, arg1);
@@ -791,7 +790,7 @@ void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t
arg2)
{
if (arg2 == 32
&& !tcg_op_supported(INDEX_op_ctz, TCG_TYPE_I32, 0)
- && tcg_op_supported(INDEX_op_ctpop_i32, TCG_TYPE_I32, 0)) {
+ && tcg_op_supported(INDEX_op_ctpop, TCG_TYPE_REG, 0)) {
s/TCG_TYPE_REG/TCG_TYPE_I32/ ?
This more or less matches the change above in ctz_i32.
What we want here is to know if tcg_gen_ctz_i32 will expand properly.
Some 64-bit hosts only support 64-bit ctpop, but tcg_gen_ctpop_i32 will happily
zero-extend for that case.
r~