target/arm: Update CNTP for PREDDESC

Since b64ee454a4a0, all predicate operations should be
using these field macros for predicates.

Backports f556a201b5bbeb59841b37247969fcfc1ab7bd5d
This commit is contained in:
Richard Henderson 2021-03-30 14:40:59 -04:00 committed by Lioncash
parent 7e26827ea5
commit c374bdc9ca
2 changed files with 6 additions and 6 deletions

View file

@ -2835,12 +2835,12 @@ uint32_t HELPER(sve_brkns)(void *vd, void *vn, void *vg, uint32_t pred_desc)
uint64_t HELPER(sve_cntp)(void *vn, void *vg, uint32_t pred_desc) uint64_t HELPER(sve_cntp)(void *vn, void *vg, uint32_t pred_desc)
{ {
intptr_t oprsz = extract32(pred_desc, 0, SIMD_OPRSZ_BITS) + 2; intptr_t words = DIV_ROUND_UP(FIELD_EX32(pred_desc, PREDDESC, OPRSZ), 8);
intptr_t esz = extract32(pred_desc, SIMD_DATA_SHIFT, 2); intptr_t esz = FIELD_EX32(pred_desc, PREDDESC, ESZ);
uint64_t *n = vn, *g = vg, sum = 0, mask = pred_esz_masks[esz]; uint64_t *n = vn, *g = vg, sum = 0, mask = pred_esz_masks[esz];
intptr_t i; intptr_t i;
for (i = 0; i < DIV_ROUND_UP(oprsz, 8); ++i) { for (i = 0; i < words; ++i) {
uint64_t t = n[i] & g[i] & mask; uint64_t t = n[i] & g[i] & mask;
sum += ctpop64(t); sum += ctpop64(t);
} }

View file

@ -3063,11 +3063,11 @@ static void do_cntp(DisasContext *s, TCGv_i64 val, int esz, int pn, int pg)
} else { } else {
TCGv_ptr t_pn = tcg_temp_new_ptr(tcg_ctx); TCGv_ptr t_pn = tcg_temp_new_ptr(tcg_ctx);
TCGv_ptr t_pg = tcg_temp_new_ptr(tcg_ctx); TCGv_ptr t_pg = tcg_temp_new_ptr(tcg_ctx);
unsigned desc; unsigned desc = 0;
TCGv_i32 t_desc; TCGv_i32 t_desc;
desc = psz - 2; desc = FIELD_DP32(desc, PREDDESC, OPRSZ, psz);
desc = deposit32(desc, SIMD_DATA_SHIFT, 2, esz); desc = FIELD_DP32(desc, PREDDESC, ESZ, esz);
tcg_gen_addi_ptr(tcg_ctx, t_pn, tcg_ctx->cpu_env, pred_full_reg_offset(s, pn)); tcg_gen_addi_ptr(tcg_ctx, t_pn, tcg_ctx->cpu_env, pred_full_reg_offset(s, pn));
tcg_gen_addi_ptr(tcg_ctx, t_pg, tcg_ctx->cpu_env, pred_full_reg_offset(s, pg)); tcg_gen_addi_ptr(tcg_ctx, t_pg, tcg_ctx->cpu_env, pred_full_reg_offset(s, pg));