summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_opcodes.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-12-16 12:22:01 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:20:22 -0800
commit46f3e1ab504f016ab900c045f165a8376cf3fc0c (patch)
treecb1afd74eeed6f431d061e9edf629df8d727b89c /src/glsl/nir/nir_opcodes.c
parent2c7da78805175f36879111306ac37c12d33bf65b (diff)
nir/opcodes: Add algebraic properties metadata
This commit adds some algebraic properties to the metadata of each opcode in NIR. In particular, you now know, just from the metadata, if a given opcode is commutative or associative. This will be useful for algebraic transformation passes that want to be able to match a + b as well as b + a in one go. v2: Make algebraic properties all caps. This was more consistent with the intrinsics flags and seems better for flags in general. Also, the enums are now declared with (1 << n) rather then hex values. v3: fmin and fmax technically aren't commutative or associative. Things get funny when one of the arguments is a NaN. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_opcodes.c')
-rw-r--r--src/glsl/nir/nir_opcodes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_opcodes.c b/src/glsl/nir/nir_opcodes.c
index a62f989eed7..3a86641bc8a 100644
--- a/src/glsl/nir/nir_opcodes.c
+++ b/src/glsl/nir/nir_opcodes.c
@@ -28,7 +28,7 @@
#include "nir.h"
#define OPCODE(_name, _num_inputs, _per_component, _output_size, _output_type, \
- _input_sizes, _input_types) \
+ _input_sizes, _input_types, _algebraic_props) \
{ \
.name = #_name, \
.num_inputs = _num_inputs, \
@@ -37,6 +37,7 @@
.output_type = _output_type, \
.input_sizes = _input_sizes, \
.input_types = _input_types, \
+ .algebraic_properties = _algebraic_props, \
},
#define LAST_OPCODE(name)