nir/builder: Add a vector extract helper
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 11 Mar 2019 23:58:24 +0000 (18:58 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 16 Mar 2019 04:10:26 +0000 (23:10 -0500)
commitfe9a6c0f14aa3ca6dfb1c7480871c95838b5cf14
tree5cbbefe919ad7886b7df6abe739f592d82b9a32a
parent9bb63e9a7c57f164a9d453ba33347d803e453144
nir/builder: Add a vector extract helper

This one's a tiny bit better than what we had in spirv_to_nir because it
emits a binary tree rather than a linear walk.  It also doesn't leave
around unneeded bcsel instructions for a constant index and returns an
undef for constant OOB access.

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