diff options
author | Rob Clark <[email protected]> | 2016-05-07 13:01:24 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-06-03 16:05:03 -0400 |
commit | dfbae7d64f4d563bc65af338cdcb217f10474c1c (patch) | |
tree | 2a94671ec13b440c7c993cea08c28511cb205e30 /src/compiler/nir/nir_search.h | |
parent | a64c7cd2bac33a3a2bf908b5ef538dff03b93b73 (diff) |
nir/algebraic: support for power-of-two optimizations
Some optimizations, like converting integer multiply/divide into left/
right shifts, have additional constraints on the search expression.
Like requiring that a variable is a constant power of two. Support
these cases by allowing a fxn name to be appended to the search var
expression (ie. "a#32(is_power_of_two)").
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_search.h')
-rw-r--r-- | src/compiler/nir/nir_search.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_search.h b/src/compiler/nir/nir_search.h index a500febc915..f55d797e05e 100644 --- a/src/compiler/nir/nir_search.h +++ b/src/compiler/nir/nir_search.h @@ -68,6 +68,16 @@ typedef struct { * never match anything. */ nir_alu_type type; + + /** Optional condition fxn ptr + * + * This is only allowed in search expressions, and allows additional + * constraints to be placed on the match. Typically used for 'is_constant' + * variables to require, for example, power-of-two in order for the search + * to match. + */ + bool (*cond)(nir_alu_instr *instr, unsigned src, + unsigned num_components, const uint8_t *swizzle); } nir_search_variable; typedef struct { |