summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_algebraic.py
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-03-17 11:04:49 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-03-23 16:27:55 -0700
commit3a7cb6534c3f82482c05f6a6813308cf2cad131f (patch)
treeb7a677d183d4674e76ad753e874913a472952dc1 /src/compiler/nir/nir_algebraic.py
parenta6f25fa7d77cbbce113b92690dc43ed2ed9a0211 (diff)
downloadexternal_mesa3d-3a7cb6534c3f82482c05f6a6813308cf2cad131f.zip
external_mesa3d-3a7cb6534c3f82482c05f6a6813308cf2cad131f.tar.gz
external_mesa3d-3a7cb6534c3f82482c05f6a6813308cf2cad131f.tar.bz2
nir/algebraic: Allow for flagging operations as being inexact
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r--src/compiler/nir/nir_algebraic.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 1818877..d05564f 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -69,6 +69,7 @@ static const ${val.c_type} ${val.name} = {
${'true' if val.is_constant else 'false'},
${val.type() or 'nir_type_invalid' },
% elif isinstance(val, Expression):
+ ${'true' if val.inexact else 'false'},
nir_op_${val.opcode},
{ ${', '.join(src.c_ptr for src in val.sources)} },
% endif
@@ -145,12 +146,18 @@ class Variable(Value):
elif self.required_type == 'float':
return "nir_type_float"
+_opcode_re = re.compile(r"(?P<inexact>~)?(?P<opcode>\w+)")
+
class Expression(Value):
def __init__(self, expr, name_base, varset):
Value.__init__(self, name_base, "expression")
assert isinstance(expr, tuple)
- self.opcode = expr[0]
+ m = _opcode_re.match(expr[0])
+ assert m and m.group('opcode') is not None
+
+ self.opcode = m.group('opcode')
+ self.inexact = m.group('inexact') is not None
self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset)
for (i, src) in enumerate(expr[1:]) ]