summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_algebraic.py
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-10 15:47:31 +1100
committerTimothy Arceri <[email protected]>2017-01-12 09:47:29 +1100
commite8328e55e7ac26bbf3b3a47a1bb1cae4ab9130a2 (patch)
tree78030c419e1f8eda5eaa07d776a6278c068142fd /src/compiler/nir/nir_algebraic.py
parenta7e399de5921b4f23e884f369feae77518e8662d (diff)
nir/algebraic: add support for conditional helper functions to expressions
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r--src/compiler/nir/nir_algebraic.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 19ac6ee2ba4..b0fa9e7092f 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)} },
+ ${val.cond if val.cond else 'NULL'},
% endif
};""")
@@ -185,7 +186,8 @@ 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<opcode>\w+)(?:@(?P<bits>\d+))?"
+ r"(?P<cond>\([^\)]+\))?")
class Expression(Value):
def __init__(self, expr, name_base, varset):
@@ -198,6 +200,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.cond = m.group('cond')
self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset)
for (i, src) in enumerate(expr[1:]) ]