nir/builder: Add a nir_extract_bits helper
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 6 Nov 2019 18:09:56 +0000 (12:09 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Mon, 11 Nov 2019 17:17:02 +0000 (17:17 +0000)
commitd0bbf98c968179c4d23c88d1d1748e45afead78f
tree1fc5a08bfbc580a907ceff604351fb829335f82c
parent86d3a346f1576acb6c2f8c3be3853a6a3e226b5c
nir/builder: Add a nir_extract_bits helper

This new helper is better than nir_bitcast_vector because it's able to
take a (mostly) arbitrary range from the source vector.  The only
requirement is that first_bit has to be aligned to the smaller of the
two bit sizes.  It wouldn't be hard to lift that requirement but it's
reasonable for now.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir/nir_builder.h