Commit 1643cf8962 for qemu.org
commit 1643cf8962f6512dfa06db0299b9728fa51cd99d
Author: Richard Henderson <richard.henderson@linaro.org>
Date: Tue Aug 11 17:03:38 2026 -0700
tcg/aarch64: Implement ctpop with FEAT_CSSC
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
index 55b3be0b96..1f784e8d46 100644
--- a/tcg/aarch64/tcg-target.c.inc
+++ b/tcg/aarch64/tcg-target.c.inc
@@ -535,6 +535,7 @@ typedef enum {
/* Data-processing (1 source) instructions. */
Irr_sf_CLZ = 0x5ac01000,
+ Irr_sf_CNT = 0x5ac01c00,
Irr_sf_RBIT = 0x5ac00000,
Irr_sf_REV = 0x5ac00000, /* + size << 10 */
@@ -2251,8 +2252,20 @@ static const TCGOutOpBinary outop_clz = {
.out_rri = tgen_clzi,
};
+static TCGConstraintSetIndex cset_ctpop(TCGType type, unsigned flags)
+{
+ return cpuinfo & CPUINFO_CSSC ? C_O1_I1(r, r) : C_NotImplemented;
+}
+
+static void tgen_ctpop(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1)
+{
+ tcg_out_insn(s, rr_sf, CNT, type, a0, a1);
+}
+
static const TCGOutOpUnary outop_ctpop = {
- .base.static_constraint = C_NotImplemented,
+ .base.static_constraint = C_Dynamic,
+ .base.dynamic_constraint = cset_ctpop,
+ .out_rr = tgen_ctpop,
};
static void tgen_ctz(TCGContext *s, TCGType type,