[Mesa-dev] [PATCH 2/2] nir: Add an optimization for a common path in vc4 blending.

Eric Anholt eric at anholt.net
Thu Jan 19 11:40:12 UTC 2017


This cuts 1 or 2 instructions in 3 different glmark2 tests.
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index d7ad1f2fbf3f..1136bfe826b0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -330,6 +330,9 @@ optimizations = [
    (('~fadd', '#a', ('fadd', b, '#c')), ('fadd', ('fadd', a, c), b)),
    (('iadd', '#a', ('iadd', b, '#c')), ('iadd', ('iadd', a, c), b)),
 
+   # VC4 blending fixups
+   (('ior at 32', ('iand', a, 0x00ffffff), 0xff000000), ('ior', a, 0xff000000)),
+
    # Misc. lowering
    (('fmod at 32', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod32'),
    (('fmod at 64', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod64'),
-- 
2.11.0



More information about the mesa-dev mailing list