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>
This commit is contained in:

committed by
Jason Ekstrand

parent
2fe8708ffd
commit
3191a82372
@@ -88,6 +88,9 @@ constant_fold_alu_instr(nir_alu_instr *instr, void *mem_ctx)
|
||||
case 8:
|
||||
src[i].u8[j] = load_const->value.u8[instr->src[i].swizzle[j]];
|
||||
break;
|
||||
case 1:
|
||||
src[i].b[j] = load_const->value.b[instr->src[i].swizzle[j]];
|
||||
break;
|
||||
default:
|
||||
unreachable("Invalid bit size");
|
||||
}
|
||||
|
Reference in New Issue
Block a user