nir/opt_large_constants: Add Small constant handling
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Mon, 17 Jul 2023 12:42:37 +0000 (14:42 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 16 Aug 2023 23:36:29 +0000 (23:36 +0000)
commite38522608f72931e3116883e2eaba3ea4d9abc20
treefd9ac05a67b9f78195b6958a3b2fb1cd84730486
parent8ec0fdf0178a72533e676da4d86e28b773d7f02a
nir/opt_large_constants: Add Small constant handling

Adds handling for constant arrays that can be lowered to
'(imm >> bit_index) & bit_mask' instead of constant loads.

RADV fossils:

Totals from 70 (0.05% of 131205) affected shaders:
Instrs: 31441 -> 31260 (-0.58%); split: -0.59%, +0.02%
CodeSize: 172104 -> 170568 (-0.89%)
VGPRs: 2608 -> 2616 (+0.31%)
Latency: 296687 -> 280859 (-5.33%); split: -5.34%, +0.00%
InvThroughput: 65491 -> 65696 (+0.31%); split: -0.11%, +0.42%
VClause: 671 -> 646 (-3.73%)
SClause: 1014 -> 964 (-4.93%)
Copies: 1742 -> 1564 (-10.22%); split: -10.51%, +0.29%
PreSGPRs: 2039 -> 2036 (-0.15%)
PreVGPRs: 2014 -> 2017 (+0.15%)

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9000>
src/compiler/nir/nir_opt_large_constants.c