Mesa (master): glsl: Optimize triop_csel with all-true or all-false.

Eric Anholt anholt at kemper.freedesktop.org
Fri Feb 7 20:49:52 UTC 2014


Module: Mesa
Branch: master
Commit: 1e12dafcac4aac50bc588cead4cc0d6291718edd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e12dafcac4aac50bc588cead4cc0d6291718edd

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Nov  1 12:29:12 2013 -0700

glsl: Optimize triop_csel with all-true or all-false.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/opt_algebraic.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 7863fe8..1b4d319 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -571,6 +571,13 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
       }
       break;
 
+   case ir_triop_csel:
+      if (is_vec_one(op_const[0]))
+	 return ir->operands[1];
+      if (is_vec_zero(op_const[0]))
+	 return ir->operands[2];
+      break;
+
    default:
       break;
    }




More information about the mesa-commit mailing list