<div dir="auto">The number of little single-character prefixes is starting to get out-of-hand. Could we instead work the condition function pointer stuff a bit and use that for "is used in if" and "has multiple uses"? I've got some more detailed ideas about that but I need to be in front of my laptop to really discuss them.</div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 8, 2017 5:06 AM, "Timothy Arceri" <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/compiler/nir/nir_<wbr>algebraic.py | 4 +++-<br>
src/compiler/nir/nir_search.c | 3 +++<br>
src/compiler/nir/nir_search.h | 3 +++<br>
3 files changed, 9 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/nir/nir_<wbr>algebraic.py b/src/compiler/nir/nir_<wbr>algebraic.py<br>
index 04c7423..c0ec019 100644<br>
--- a/src/compiler/nir/nir_<wbr>algebraic.py<br>
+++ b/src/compiler/nir/nir_<wbr>algebraic.py<br>
@@ -91,6 +91,7 @@ static const ${val.c_type} ${<a href="http://val.name" rel="noreferrer" target="_blank">val.name</a>} = {<br>
nir_op_${val.opcode},<br>
{ ${', '.join(src.c_ptr for src in val.sources)} },<br>
${'true' if val.is_many else 'false'},<br>
+ ${'true' if val.is_not_used_by_if else 'false'},<br>
% endif<br>
};""")<br>
<br>
@@ -186,7 +187,7 @@ class Variable(Value):<br>
elif self.required_type == 'float':<br>
return "nir_type_float"<br>
<br>
-_opcode_re = re.compile(r"(?P<inexact>~)?(?<wbr>P<many>%)?(?P<opcode>\w+)(?:@(<wbr>?P<bits>\d+))?")<br>
+_opcode_re = re.compile(r"(?P<inexact>~)?(?<wbr>P<many>%)?(?P<not_used_by_if>!<wbr>)?(?P<opcode>\w+)(?:@(?P<bits><wbr>\d+))?")<br>
<br>
class Expression(Value):<br>
def __init__(self, expr, name_base, varset):<br>
@@ -200,6 +201,7 @@ class Expression(Value):<br>
self.bit_size = int(m.group('bits')) if m.group('bits') else 0<br>
self.inexact = m.group('inexact') is not None<br>
self.is_many = m.group('many') is not None<br>
+ self.is_not_used_by_if = m.group('not_used_by_if') is not None<br>
self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset)<br>
for (i, src) in enumerate(expr[1:]) ]<br>
<br>
diff --git a/src/compiler/nir/nir_search.<wbr>c b/src/compiler/nir/nir_search.<wbr>c<br>
index 8318c27..e80ec8e 100644<br>
--- a/src/compiler/nir/nir_search.<wbr>c<br>
+++ b/src/compiler/nir/nir_search.<wbr>c<br>
@@ -264,6 +264,9 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr,<br>
list_is_singular(&instr->dest.<wbr>dest.ssa.if_uses))))<br>
return false;<br>
<br>
+ if (expr->is_not_used_by_if && !list_empty(&instr->dest.dest.<wbr>ssa.if_uses))<br>
+ return false;<br>
+<br>
if (instr->op != expr->opcode)<br>
return false;<br>
<br>
diff --git a/src/compiler/nir/nir_search.<wbr>h b/src/compiler/nir/nir_search.<wbr>h<br>
index 5f1b949..a14f606 100644<br>
--- a/src/compiler/nir/nir_search.<wbr>h<br>
+++ b/src/compiler/nir/nir_search.<wbr>h<br>
@@ -106,6 +106,9 @@ typedef struct {<br>
<br>
/* Specifies that this expression is used more than once */<br>
bool is_many;<br>
+<br>
+ /* Specifies that this expression is not used by an if */<br>
+ bool is_not_used_by_if;<br>
} nir_search_expression;<br>
<br>
NIR_DEFINE_CAST(nir_search_<wbr>value_as_variable, nir_search_value,<br>
<font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div>