mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
nir: restrict associativity to binary operations
mathemtically, associativity is only defined for binary operations. I have no idea what "associativity" would even mean for imad. I can kinda see the idea for iadd3 but iadd3 should not be formed until after reassociating adds so the point is moot. Unmark the "associative" ternary operations, and assert that associativity implies binary. nothing uses associativity yet, so this doesn't cause any functional change. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Mel Henning <mhenning@darkrefraction.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36257>
This commit is contained in:
parent
e466b8735b
commit
076f245df8
1 changed files with 3 additions and 2 deletions
|
|
@ -77,6 +77,7 @@ class Opcode(object):
|
|||
assert isinstance(algebraic_properties, str)
|
||||
assert isinstance(const_expr, str)
|
||||
assert len(input_sizes) == len(input_types)
|
||||
assert len(input_sizes) == 2 or "associative" not in algebraic_properties
|
||||
assert 0 <= output_size <= 5 or (output_size == 8) or (output_size == 16)
|
||||
for size in input_sizes:
|
||||
assert 0 <= size <= 5 or (size == 8) or (size == 16)
|
||||
|
|
@ -1042,10 +1043,10 @@ zero plus src2 if either src0 or src1 is zero.
|
|||
|
||||
triop("flrp", tfloat, "", "src0 * (1 - src2) + src1 * src2")
|
||||
|
||||
triop("iadd3", tint, _2src_commutative + associative, "src0 + src1 + src2",
|
||||
triop("iadd3", tint, _2src_commutative, "src0 + src1 + src2",
|
||||
description = "Ternary addition")
|
||||
|
||||
triop("imad", tint, _2src_commutative + associative, "src0 * src1 + src2",
|
||||
triop("imad", tint, _2src_commutative, "src0 * src1 + src2",
|
||||
description = "Integer multiply-add")
|
||||
|
||||
csel_description = """
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue