r300: merge simple movs with constant swizzles together
authorPavel Ondračka <pavel.ondracka@gmail.com>
Fri, 20 May 2022 09:11:07 +0000 (11:11 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sun, 5 Jun 2022 21:38:36 +0000 (21:38 +0000)
commit6c2959c0256167bc97ed338e12e0543a967f2fc3
tree745d9bb7705faace48cff1e04b54d66263918dd8
parent0fcd423a6a54842cb37505c87b395f2983fd904d
r300: merge simple movs with constant swizzles together

This pass will merge instructions like these

MOV output[0].x, temp[5].x___;
MOV output[0].yzw, none._001;

into

MOV output[0].xyzw, temp[5].x001;

It is currently very careful with control flow and dependency
tracking, so there is still room for improvements.

Shader-db stats with RV530:
total instructions in shared programs: 132486 -> 132256 (-0.17%)
instructions in affected programs: 6186 -> 5956 (-3.72%)
helped: 65
HURT: 0
total temps in shared programs: 18035 -> 18014 (-0.12%)
temps in affected programs: 295 -> 274 (-7.12%)
helped: 22
HURT: 1

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>
src/gallium/drivers/r300/compiler/radeon_optimize.c