From dc982f4a859d800ec3eba95d3c55bbe6af8d6518 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jan 2015 15:50:18 -0800 Subject: [PATCH] nir: Add a couple of simplifications of csel operations. vc4 was already cleaning these up, but it does shave 4 NIR instructions in shader-db. Reviewed-by: Matt Turner Reviewed-by: Connor Abbott --- src/glsl/nir/nir_opt_algebraic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 504c9f69054..ef3a0297457 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -145,6 +145,9 @@ optimizations = [ # next round of opt_algebraic, get picked up by one of the above two. (('bcsel', '#a', b, c), ('bcsel', ('ine', 'a', 0), b, c)), + (('bcsel', a, b, b), b), + (('fcsel', a, b, b), b), + # Subtracts (('fsub', 0.0, ('fsub', 0.0, a)), a), (('isub', 0, ('isub', 0, a)), a), -- 2.30.2