nir/opt_algebraic: Convert a + b + a to b + 2a
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This allows fusing into one FMA later.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37113>
This commit is contained in:
Christoph Pillmayer 2025-08-29 15:08:22 +00:00 committed by Marge Bot
parent 8233d9d571
commit f81f3c85e2
6 changed files with 12 additions and 11 deletions

View file

@ -38,7 +38,7 @@ traces:
checksum: 6cb8190a2ee4c335291914fbc70a8bb8
gputest/furmark-v2.trace:
gl-radeonsi-stoney:
checksum: d9452b1aa606d61a51a80fb4644b7303
checksum: 1b0894a0059e5cdb6aadb24a7d291e9f
gputest/triangle-v2.trace:
gl-radeonsi-stoney:
checksum: 2d0527e7288a0fc31099404546dadbfb

View file

@ -243,6 +243,7 @@ optimizations = [
(('~fadd', a, ('fadd', ('fneg', a), b)), b),
(('fadd', ('fsat', a), ('fsat', ('fneg', a))), ('fsat', ('fabs', a))),
(('fadd', a, a), ('fmul', a, 2.0)),
(('fadd(contract)', a, ('fadd(is_used_once)', a, b)), ('fadd', b, ('fmul', a, 2.0))),
(('~fmul', a, 0.0), 0.0),
# The only effect a*0.0 should have is when 'a' is infinity, -0.0 or NaN
(('fmul(nsz,nnan)', 'a', 0.0), 0.0),

View file

@ -190,9 +190,9 @@ traces:
freedreno-a530:
checksum: 88188447495b819e5814368486deb0a0
freedreno-a618:
checksum: eb810bd258c06f873a2d9718c5209c6d
checksum: 709d72f86faa9b768495888b49cad086
zink-a618:
checksum: eefcef0b1167c1140c298f3908c31195
checksum: ac00716889f247788292e838139bc2ac
# gimark requires an environment var to work around a bug, disable for now
# gputest/gimark-v2.trace:

View file

@ -9,7 +9,7 @@ traces:
checksum: f8eba0fec6e3e0af9cb09844bc73bdc8
gputest/furmark-v2.trace:
gl-virgl:
checksum: e9013d2861ac60b5b80d759455a6f058
checksum: 95b55f29d9f6dceb842386ea887861d4
gputest/triangle-v2.trace:
gl-virgl:
checksum: 7812de00011a3a059892e36cea19c696

View file

@ -67,13 +67,13 @@ traces:
gputest/furmark-v2.trace:
gl-zink-anv-adl:
label: [no-perf]
checksum: 30649dc37efcf5dadc7b761769de51d7
checksum: 2d3f45cda72a1f8a54fd115fb27ee8d6
gl-zink-anv-tgl:
checksum: 30649dc37efcf5dadc7b761769de51d7
checksum: 2d3f45cda72a1f8a54fd115fb27ee8d6
zink-radv-vangogh:
checksum: d02c3021f720ae4b1023fc298f125581
checksum: 6466543da6b14d7e35630c6ed3e90e5f
zink-radv-gfx1201:
checksum: d02c3021f720ae4b1023fc298f125581
checksum: 6466543da6b14d7e35630c6ed3e90e5f
gputest/triangle-v2.trace:
gl-zink-anv-adl:

View file

@ -97,13 +97,13 @@ traces:
checksum: 448886e3b24f6408e013ea13f7c96d28
gputest/furmark-v2.trace:
gl-intel-apl:
checksum: 06f4222f7f5737f93ed1d191cbdc0798
checksum: 54305eb5dd7fea9e34bd61567bbd4c08
gl-intel-glk:
checksum: 06f4222f7f5737f93ed1d191cbdc0798
checksum: 54305eb5dd7fea9e34bd61567bbd4c08
gl-intel-amly:
checksum: 06f4222f7f5737f93ed1d191cbdc0798
gl-intel-kbl:
checksum: 06f4222f7f5737f93ed1d191cbdc0798
checksum: 54305eb5dd7fea9e34bd61567bbd4c08
gl-intel-whl:
checksum: 06d587a2b934295da6ad874b750b9c9d
gl-intel-cml: