nir: Add support for 1-bit data types

Graphics / Mesa 3D Graphics Library / Mesa - Jason Ekstrand [intel.com] - 16 December 2018 21:03 EST

This commit adds support for 1-bit Booleans and integers. Booleans obviously take a value of true or false. Because we have to define the semantics of 1-bit signed and unsigned integers, we define uint1_t to take values of 0 and 1 and int1_t to take values of 0 and -1. 1-bit arithmetic is then well-defined in the usual way, just with fewer bits. The definition of int1_t and uint1_t doesn't usually matter but we do need something for purposes of constant folding.

3191a82372 nir: Add support for 1-bit data types
src/compiler/nir/nir.c | 15 +++++++-------
src/compiler/nir/nir.h | 21 +++++++++++++------
src/compiler/nir/nir_builder.h | 12 ++++++++++-
src/compiler/nir/nir_constant_expressions.py | 25 +++++++++++++++++++----
src/compiler/nir/nir_instr_set.c | 20 ++++++++++++++----
src/compiler/nir/nir_lower_load_const_to_scalar.c | 3 +++
src/compiler/nir/nir_opt_constant_folding.c | 3 +++
src/compiler/nir/nir_print.c | 3 +++
src/compiler/nir/nir_search.c | 3 ++-
src/compiler/nir/nir_validate.c | 2 +-
src/compiler/spirv/spirv_to_nir.c | 9 ++++++++
11 files changed, 92 insertions(+), 24 deletions(-)

Upstream: cgit.freedesktop.org


  • Share