nir: Recognize max(min(a, 1.0), 0.0) as fsat(a).
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 11 Jun 2015 08:59:44 +0000 (01:59 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 25 Jun 2015 09:12:32 +0000 (02:12 -0700)
commit6026f7e8fb993a34f3e2ad1638d7a842a5cefd80
treed16f068272cfd7741776714f2d133d6b0bfe767e
parent77a78c65f80323059d892c501ca551ccf324b17d
nir: Recognize max(min(a, 1.0), 0.0) as fsat(a).

We already recognize min(max(a, 0.0), 1.0) as a saturate, but neglected
this variant (which is also handled by the GLSL IR pass).

shader-db results on Broadwell:
total instructions in shared programs: 7363046 -> 7362788 (-0.00%)
instructions in affected programs:     11928 -> 11670 (-2.16%)
helped:                                64
HURT:                                  0

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/glsl/nir/nir_opt_algebraic.py