From: Connor Abbott Date: Thu, 25 Mar 2021 14:22:44 +0000 (+0100) Subject: ir3: Add reg_elems(), reg_elem_size(), and reg_size() X-Git-Tag: upstream/21.2.3~2104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc7402b4cf472608f61982c98f79e41bb1970cc7;p=platform%2Fupstream%2Fmesa.git ir3: Add reg_elems(), reg_elem_size(), and reg_size() For working with registers in units of half-regs in the new RA. Part-of: --- diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 791417b..4b804b8 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -940,6 +940,26 @@ static inline bool is_meta(struct ir3_instruction *instr) return (opc_cat(instr->opc) == -1); } +static inline unsigned reg_elems(const struct ir3_register *reg) +{ + if (reg->flags & IR3_REG_ARRAY) + return reg->size; + else + return util_last_bit(reg->wrmask); +} + +static inline unsigned +reg_elem_size(const struct ir3_register *reg) +{ + return (reg->flags & IR3_REG_HALF) ? 1 : 2; +} + +static inline unsigned +reg_size(const struct ir3_register *reg) +{ + return reg_elems(reg) * reg_elem_size(reg); +} + static inline unsigned dest_regs(struct ir3_instruction *instr) { if ((instr->regs_count == 0) || is_store(instr) || is_flow(instr))