r300: move power of two multipliers down

RV530 shader-db:
total instructions in shared programs: 128864 -> 128840 (-0.02%)
instructions in affected programs: 1260 -> 1236 (-1.90%)
helped: 21
HURT: 2
total presub in shared programs: 7682 -> 7670 (-0.16%)
presub in affected programs: 77 -> 65 (-15.58%)
helped: 12
HURT: 0
total omod in shared programs: 386 -> 403 (4.40%)
omod in affected programs: 3 -> 20 (566.67%)
helped: 0
HURT: 14
total temps in shared programs: 16948 -> 16926 (-0.13%)
temps in affected programs: 280 -> 258 (-7.86%)
helped: 20
HURT: 2
total cycles in shared programs: 194101 -> 193751 (-0.18%)
cycles in affected programs: 3422 -> 3072 (-10.23%)
helped: 25
HURT: 5

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6855
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24830>
This commit is contained in:
Pavel Ondračka
2023-07-17 14:49:21 +02:00
committed by Marge Bot
parent 7ae3d3eb8d
commit 87ea850d76

View File

@@ -82,6 +82,11 @@ r300_nir_prepare_presubtract = [
(('fmul', 'a(is_ubo_or_input)', 2.0), ('fadd', a, a)),
]
for multiplier in [2.0, 4.0, 8.0, 16.0, 0.5, 0.25, 0.125, 0.0625]:
r300_nir_prepare_presubtract.extend([
(('fmul', a, ('fmul(is_used_once)', 'b(is_ubo_or_input)', multiplier)), ('fmul', multiplier, ('fmul', a, b))),
])
# Previous prepare_presubtract pass can sometimes produce double fneg patterns.
# The backend copy propagate could handle it, but the nir to tgsi translation
# does not and blows up. Just run a simple pass to clean it up.