summaryrefslogtreecommitdiff
path: root/src/compiler/nir/nir_search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_search.c')
-rw-r--r--src/compiler/nir/nir_search.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c
index 0acb3c3cc9f8..be87d4dbe651 100644
--- a/src/compiler/nir/nir_search.c
+++ b/src/compiler/nir/nir_search.c
@@ -220,6 +220,9 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
if (instr->src[src].src.ssa->parent_instr->type != nir_instr_type_alu)
return false;
+ if (instr->src[src].abs || instr->src[src].negate)
+ return false;
+
return match_expression(nir_search_value_as_expression(value),
nir_instr_as_alu(instr->src[src].src.ssa->parent_instr),
num_components, new_swizzle, state, false);
@@ -235,7 +238,9 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
if (state->variables[var->variable].src.ssa != instr->src[src].src.ssa)
return false;
- assert(!instr->src[src].abs && !instr->src[src].negate);
+ if (state->variables[var->variable].abs != instr->src[src].abs ||
+ state->variables[var->variable].negate != instr->src[src].negate)
+ return false;
for (unsigned i = 0; i < num_components; ++i) {
if (state->variables[var->variable].swizzle[i] != new_swizzle[i])
@@ -257,8 +262,8 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
state->variables_seen |= (1 << var->variable);
state->variables[var->variable].src = instr->src[src].src;
- state->variables[var->variable].abs = false;
- state->variables[var->variable].negate = false;
+ state->variables[var->variable].abs = instr->src[src].abs;
+ state->variables[var->variable].negate = instr->src[src].negate;
state->is_ssa[var->variable] = instr->src[src].src.is_ssa;
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i) {