diff options
author | Ian Romanick <[email protected]> | 2019-05-09 15:33:11 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2019-05-14 11:25:02 -0700 |
commit | e049a9c92b3048f2d28d5a36f0dd780b19fe4b2a (patch) | |
tree | 1698453d02403c25074c998e815585669ed2c2c0 /src/compiler/nir/nir_algebraic.py | |
parent | ede45bf9cfe20578712ae874f7a3d18fd86a1297 (diff) |
nir: Add support for 2src_commutative ops that have 3 sources
v2: Instead of handling 3 sources as a special case, generalize with
loops to N sources. Suggested by Jason.
v3: Further generalize by only checking that number of sources is >= 2.
Suggested by Jason.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index d945c1a8075..aa4e9778a43 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -796,12 +796,12 @@ class TreeAutomaton(object): self.opcodes = self.IndexMap() def get_item(opcode, children, pattern=None): - commutative = len(children) == 2 \ + commutative = len(children) >= 2 \ and "2src_commutative" in opcodes[opcode].algebraic_properties item = self.items.setdefault((opcode, children), self.Item(opcode, children)) if commutative: - self.items[opcode, (children[1], children[0])] = item + self.items[opcode, (children[1], children[0]) + children[2:]] = item if pattern is not None: item.patterns.append(pattern) return item |