nir: Rename commutative to 2src_commutative

The meaning of the new name is that the first two sources are
commutative.  Since this is only currently applied to two-source
operations, there is no change.

A future change will mark ffma as 2src_commutative.

It is also possible that future work will add 3src_commutative for
opcodes like fmin3.

v2: s/commutative_2src/2src_commutative/g.  I had originally considered
this, but I discarded it because I did't want to deal with identifiers
that (should) start with 2.  Jason suggested it in review, so we decided
that _2src_commutative would be used in nir_opcodes.py.  Also add some
comments documenting what 2src_commutative means.  Also suggested by
Jason.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Ian Romanick
2019-05-09 15:27:14 -07:00
parent e99081e76d
commit ede45bf9cf
4 changed files with 60 additions and 48 deletions

View File

@@ -875,7 +875,14 @@ nir_op_vec(unsigned components)
}
typedef enum {
NIR_OP_IS_COMMUTATIVE = (1 << 0),
/**
* Operation where the first two sources are commutative.
*
* For 2-source operations, this just mathematical commutativity. Some
* 3-source operations, like ffma, are only commutative in the first two
* sources.
*/
NIR_OP_IS_2SRC_COMMUTATIVE = (1 << 0),
NIR_OP_IS_ASSOCIATIVE = (1 << 1),
} nir_op_algebraic_property;