nir: Add support for 1-bit data types
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 18 Oct 2018 16:59:40 +0000 (11:59 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Sun, 16 Dec 2018 21:03:02 +0000 (21:03 +0000)
commit3191a823726053242696a7d96f37abd5475fadcc
tree0a0e4df0a26cdb134392f0453c2ab28ab8a76be3
parent2fe8708ffda532fe13aab96a19bc1fb9c3fec68f
nir: Add support for 1-bit data types

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.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_builder.h
src/compiler/nir/nir_constant_expressions.py
src/compiler/nir/nir_instr_set.c
src/compiler/nir/nir_lower_load_const_to_scalar.c
src/compiler/nir/nir_opt_constant_folding.c
src/compiler/nir/nir_print.c
src/compiler/nir/nir_search.c
src/compiler/nir/nir_validate.c
src/compiler/spirv/spirv_to_nir.c