broadcom/compiler: improve generation of if conditions
authorArcady Goldmints-Orlov <agoldmints@igalia.com>
Sat, 23 Jan 2021 19:42:55 +0000 (14:42 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 2 Feb 2021 06:55:49 +0000 (06:55 +0000)
commit93f8f83a95383e38769bca8cd3c236d3b1c4c87f
treef4c9afdc2995ec0b89a2abb0f6b3b9362fbb889a
parentb60dfa2c0926fd119e646df01a87cff495bbf98f
broadcom/compiler: improve generation of if conditions

Where it is safe to do so, avoid the generation of code to convert a
condition code into a boolean which is then tested to generate a
condition code. This is only done in uniform ifs, and only for condition
values that are SSA and only used once (in that if statement).

shader-db relative to MR 7726:

total instructions in shared programs: 8985667 -> 8974151 (-0.13%)
instructions in affected programs: 390140 -> 378624 (-2.95%)
helped: 810
HURT: 276
helped stats (abs) min: 1 max: 49 x̄: 17.77 x̃: 16
helped stats (rel) min: 0.10% max: 33.63% x̄: 7.97% x̃: 6.45%
HURT stats (abs)   min: 1 max: 46 x̄: 10.42 x̃: 10
HURT stats (rel)   min: 0.16% max: 21.54% x̄: 2.26% x̃: 2.03%
95% mean confidence interval for instructions value: -11.46 -9.75
95% mean confidence interval for instructions %-change: -5.76% -4.97%
Instructions are helped.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8709>
src/broadcom/compiler/nir_to_vir.c