r300: Request that nir-to-tgsi avoid generating TGSI_OPCODE_CMP.
authorEmma Anholt <emma@anholt.net>
Fri, 4 Feb 2022 22:27:54 +0000 (14:27 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 9 Feb 2022 01:19:13 +0000 (01:19 +0000)
commitd52d500f17a0fa7d96e63fd6e558583f137a5997
tree51672f5becbac89e31d8562fe98209de94a9f01c
parent4a1ba7914a098cce5eb85292097911b69922afa0
r300: Request that nir-to-tgsi avoid generating TGSI_OPCODE_CMP.

Given that our fcsels are on float-bools, we can emit the LRP directly and
save the backend having to emit a SLT to turn the CMP src[0] into a bool.

This required passing a codegen flags struct for nir-to-tgsi.  I think
this is a good way forward for it, as the alternative I think has mostly
been adding flags to nir_shader_compiler_options (since adding
PIPE_SHADER_CAPs is an unreasonable amount of pain).

r300 shader-db:
total instructions in shared programs: 1484320 -> 1472463 (-0.80%)
instructions in affected programs: 243588 -> 231731 (-4.87%)
total temps in shared programs: 212485 -> 212143 (-0.16%)
temps in affected programs: 3845 -> 3503 (-8.89%)

Acked-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14886>
src/gallium/auxiliary/nir/nir_to_tgsi.c
src/gallium/auxiliary/nir/nir_to_tgsi.h
src/gallium/drivers/r300/ci/r300-rv515-fails.txt
src/gallium/drivers/r300/r300_state.c