mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
nir/algebraic: Pack various bitfields in the nir_search_value_union.
This gets our union's size down to 22 bytes (now smaller than any of the union's types were before we made the union!). Cuts another 48kb off of the drivers. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13987>
This commit is contained in:
parent
53f49b7066
commit
45a8d11b6e
2 changed files with 10 additions and 9 deletions
|
|
@ -186,8 +186,8 @@ class Value(object):
|
|||
${val.swizzle()},
|
||||
% elif isinstance(val, Expression):
|
||||
${'true' if val.inexact else 'false'}, ${'true' if val.exact else 'false'},
|
||||
${val.comm_expr_idx}, ${val.comm_exprs},
|
||||
${val.c_opcode()},
|
||||
${val.comm_expr_idx}, ${val.comm_exprs},
|
||||
{ ${', '.join(src.array_index for src in val.sources)} },
|
||||
${val.cond_index},
|
||||
% endif
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
struct nir_builder;
|
||||
|
||||
typedef enum {
|
||||
typedef enum PACKED {
|
||||
nir_search_value_expression,
|
||||
nir_search_value_variable,
|
||||
nir_search_value_constant,
|
||||
|
|
@ -60,21 +60,21 @@ typedef struct {
|
|||
* - If bit_size < 0, then the value is constructed with the same bit size
|
||||
* as variable (-bit_size - 1).
|
||||
*/
|
||||
int bit_size;
|
||||
int8_t bit_size;
|
||||
} nir_search_value;
|
||||
|
||||
typedef struct {
|
||||
nir_search_value value;
|
||||
|
||||
/** The variable index; Must be less than NIR_SEARCH_MAX_VARIABLES */
|
||||
unsigned variable;
|
||||
uint8_t variable : 7;
|
||||
|
||||
/** Indicates that the given variable must be a constant
|
||||
*
|
||||
* This is only allowed in search expressions and indicates that the
|
||||
* given variable is only allowed to match constant values.
|
||||
*/
|
||||
bool is_constant;
|
||||
bool is_constant : 1;
|
||||
|
||||
/** Indicates that the given variable must have a certain type
|
||||
*
|
||||
|
|
@ -137,10 +137,13 @@ typedef struct {
|
|||
* value that does *not* have the exact bit set. If unset, the exact bit
|
||||
* on the SSA value is ignored.
|
||||
*/
|
||||
bool inexact;
|
||||
bool inexact : 1;
|
||||
|
||||
/** In a replacement, requests that the instruction be marked exact. */
|
||||
bool exact;
|
||||
bool exact : 1;
|
||||
|
||||
/* One of nir_op or nir_search_op */
|
||||
uint16_t opcode : 14;
|
||||
|
||||
/* Commutative expression index. This is assigned by opt_algebraic.py when
|
||||
* search structures are constructed and is a unique (to this structure)
|
||||
|
|
@ -154,8 +157,6 @@ typedef struct {
|
|||
*/
|
||||
uint8_t comm_exprs;
|
||||
|
||||
/* One of nir_op or nir_search_op */
|
||||
uint16_t opcode;
|
||||
/* Index in table->values[] for the expression operands */
|
||||
uint16_t srcs[4];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue