i915: Enable generation of fcsel_gt and fcsel_ge opcodes

DX9 PS 1.x / GL_ARB_fragment_program shaders that have been converted to
GLSL are littered with patterns like

    ps_r1.x = ((ps_t0.y >= 0.0) ? ps_r1.x : ps_c1.y);

This is because CMP is a fundamental opcode in those earlier shading
languages.  i915 supports this opcode natively, but there's no way to
get it directly into the backend.  Instead, NIR and NTT generate some
combination of fcsel and sge and hope for the best.

i915
total instructions in shared programs: 49032 -> 48897 (-0.28%)
instructions in affected programs: 4173 -> 4038 (-3.24%)
helped: 39
HURT: 0

total temps in shared programs: 2795 -> 2790 (-0.18%)
temps in affected programs: 22 -> 17 (-22.73%)
helped: 5
HURT: 0

total const in shared programs: 4976 -> 4967 (-0.18%)
const in affected programs: 203 -> 194 (-4.43%)
helped: 9
HURT: 0

GAINED: shaders/trine/fp-13.shader_test FS

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20162>
This commit is contained in:
Ian Romanick 2022-06-14 22:05:21 -07:00 committed by Marge Bot
parent cb1ab133ea
commit 36e842839f

View file

@ -124,6 +124,7 @@ static const nir_shader_compiler_options i915_compiler_options = {
.force_indirect_unrolling_sampler = true,
.max_unroll_iterations = 32,
.no_integers = true,
.has_fused_comp_and_csel = true,
};
static const struct nir_shader_compiler_options gallivm_nir_options = {