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>
Richard Henderson committed
Aug 11, 2026 at 17:03 UTC
1643cf8962f6512dfa06db0299b9728fa51cd99d
1 file changed
+14
-1
tcg/aarch64/tcg-target.c.inc
+14
-1
@@ -535,6 +535,7 @@ typedef enum {
535
536
/* Data-processing (1 source) instructions. */
537
Irr_sf_CLZ = 0x5ac01000,
538
+ Irr_sf_CNT = 0x5ac01c00,
539
Irr_sf_RBIT = 0x5ac00000,
540
Irr_sf_REV = 0x5ac00000, /* + size << 10 */
541
@@ -2251,8 +2252,20 @@ static const TCGOutOpBinary outop_clz = {
2252
.out_rri = tgen_clzi,
2253
};
2254
2255
+static TCGConstraintSetIndex cset_ctpop(TCGType type, unsigned flags)
2256
+{
2257
+ return cpuinfo & CPUINFO_CSSC ? C_O1_I1(r, r) : C_NotImplemented;
2258
+}
2259
+
2260
+static void tgen_ctpop(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1)
2261
+{
2262
+ tcg_out_insn(s, rr_sf, CNT, type, a0, a1);
2263
+}
2264
+
2265
static const TCGOutOpUnary outop_ctpop = {
2255
- .base.static_constraint = C_NotImplemented,
2266
+ .base.static_constraint = C_Dynamic,
2267
+ .base.dynamic_constraint = cset_ctpop,
2268
+ .out_rr = tgen_ctpop,
2269
};
2270
2271
static void tgen_ctz(TCGContext *s, TCGType type,