mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
nir/algebraic: add pattern for (a << #b) * #c => a * (#c << #b)
Totals from 2545 (3.19% of 79839) affected shaders: (Navi48) Instrs: 6371003 -> 6364130 (-0.11%); split: -0.12%, +0.01% CodeSize: 33827548 -> 33812244 (-0.05%); split: -0.06%, +0.01% Latency: 47451755 -> 47430108 (-0.05%); split: -0.05%, +0.00% InvThroughput: 10442450 -> 10437159 (-0.05%); split: -0.05%, +0.00% SClause: 159829 -> 159874 (+0.03%); split: -0.01%, +0.04% Copies: 500725 -> 500721 (-0.00%); split: -0.01%, +0.01% PreSGPRs: 110482 -> 110478 (-0.00%); split: -0.00%, +0.00% PreVGPRs: 147289 -> 147287 (-0.00%); split: -0.00%, +0.00% VALU: 3456135 -> 3454241 (-0.05%); split: -0.06%, +0.01% SALU: 925982 -> 923616 (-0.26%) VOPD: 1243 -> 1212 (-2.49%) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37173>
This commit is contained in:
parent
87f451aa39
commit
c78f1d516c
1 changed files with 3 additions and 2 deletions
|
|
@ -522,9 +522,10 @@ optimizations.extend([
|
|||
(('ishl', ('iadd', ('imul', a, '#b'), '#c'), '#d'),
|
||||
('iadd', ('imul', a, ('ishl', b, d)), ('ishl', c, d))),
|
||||
|
||||
# (a * #b) << #c
|
||||
# a * (#b << #c)
|
||||
# (a * #b) << #c => a * (#b << #c)
|
||||
(('ishl', ('imul', a, '#b'), '#c'), ('imul', a, ('ishl', b, c))),
|
||||
# (a << #b) * #c => a * (#c << #b)
|
||||
(('imul', ('ishl', a, '#b'), '#c'), ('imul', a, ('ishl', c, b))),
|
||||
])
|
||||
|
||||
# Care must be taken here. Shifts in NIR uses only the lower log2(bitsize)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue