nir: Add 1-bit Boolean opcodes

We also have to add support for 1-bit integers while we're here so we
get 1-bit variants of iand, ior, and inot.

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:
Jason Ekstrand
2018-10-19 10:40:20 -05:00
committed by Jason Ekstrand
parent 615cc26b97
commit 191a1dce92
3 changed files with 34 additions and 3 deletions

View File

@@ -110,7 +110,8 @@ nir_op_matches_search_op(nir_op nop, uint16_t sop)
#define MATCH_BCONV_CASE(op) \
case nir_search_op_##op: \
return nop == nir_op_##op##32;
return nop == nir_op_##op##1 || \
nop == nir_op_##op##32;
switch (sop) {
MATCH_FCONV_CASE(i2f)
@@ -160,6 +161,7 @@ nir_op_for_search_op(uint16_t sop, unsigned bit_size)
#define RET_BCONV_CASE(op) \
case nir_search_op_##op: \
switch (bit_size) { \
case 1: return nir_op_##op##1; \
case 32: return nir_op_##op##32; \
default: unreachable("Invalid bit size"); \
}