From: Jason Ekstrand Date: Thu, 15 Mar 2018 04:44:51 +0000 (-0700) Subject: nir: Add src/dest num_components helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=956f17395bfcf7f8ce9dd5ac9fd14a13e86f3a8f;p=mesa.git nir: Add src/dest num_components helpers We already have these for bit_size Reviewed-by: Kenneth Graunke --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 9fff1f4647d..5ba6a1f0687 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -631,12 +631,24 @@ nir_src_bit_size(nir_src src) return src.is_ssa ? src.ssa->bit_size : src.reg.reg->bit_size; } +static inline unsigned +nir_src_num_components(nir_src src) +{ + return src.is_ssa ? src.ssa->num_components : src.reg.reg->num_components; +} + static inline unsigned nir_dest_bit_size(nir_dest dest) { return dest.is_ssa ? dest.ssa.bit_size : dest.reg.reg->bit_size; } +static inline unsigned +nir_dest_num_components(nir_dest dest) +{ + return dest.is_ssa ? dest.ssa.num_components : dest.reg.reg->num_components; +} + void nir_src_copy(nir_src *dest, const nir_src *src, void *instr_or_if); void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr);