--- src/compiler/nir/nir_algebraic.py | 4 +++- src/compiler/nir/nir_search.c | 7 +++++++ src/compiler/nir/nir_search.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 19ac6ee..04c7423 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -90,6 +90,7 @@ static const ${val.c_type} ${val.name} = { ${'true' if val.inexact else 'false'}, nir_op_${val.opcode}, { ${', '.join(src.c_ptr for src in val.sources)} }, + ${'true' if val.is_many else 'false'}, % endif };""") @@ -185,7 +186,7 @@ class Variable(Value): elif self.required_type == 'float': return "nir_type_float" -_opcode_re = re.compile(r"(?P<inexact>~)?(?P<opcode>\w+)(?:@(?P<bits>\d+))?") +_opcode_re = re.compile(r"(?P<inexact>~)?(?P<many>%)?(?P<opcode>\w+)(?:@(?P<bits>\d+))?") class Expression(Value): def __init__(self, expr, name_base, varset): @@ -198,6 +199,7 @@ class Expression(Value): self.opcode = m.group('opcode') self.bit_size = int(m.group('bits')) if m.group('bits') else 0 self.inexact = m.group('inexact') is not None + self.is_many = m.group('many') is not None self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset) for (i, src) in enumerate(expr[1:]) ] diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index b34b13f..8318c27 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -257,6 +257,13 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr, unsigned num_components, const uint8_t *swizzle, struct match_state *state) { + if (expr->is_many && + ((list_empty(&instr->dest.dest.ssa.if_uses) && + list_is_singular(&instr->dest.dest.ssa.uses)) || + (list_empty(&instr->dest.dest.ssa.uses) && + list_is_singular(&instr->dest.dest.ssa.if_uses)))) + return false; + if (instr->op != expr->opcode) return false; diff --git a/src/compiler/nir/nir_search.h b/src/compiler/nir/nir_search.h index dec19d5..5f1b949 100644 --- a/src/compiler/nir/nir_search.h +++ b/src/compiler/nir/nir_search.h @@ -103,6 +103,9 @@ typedef struct { nir_op opcode; const nir_search_value *srcs[4]; + + /* Specifies that this expression is used more than once */ + bool is_many; } nir_search_expression; NIR_DEFINE_CAST(nir_search_value_as_variable, nir_search_value, -- 2.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev