[Mesa-dev] [PATCH 15/16] glsl: Add ir_unop_neg to get_range

Thomas Helland thomashelland90 at gmail.com
Sun Nov 16 17:52:00 PST 2014


---
 src/glsl/opt_minmax.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 49a816e..466db8c 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -293,6 +293,14 @@ get_range(ir_rvalue *rval)
             high = larger_constant(r0.high, abs(r0.low)->constant_expression_value());
          return minmax_range(low, high);
 
+      case ir_unop_neg:
+         r0 = get_range(expr->operands[0]);
+         if (r0.high)
+            low = neg(r0.high)->constant_expression_value();
+         if (r0.low)
+            high = neg(r0.low)->constant_expression_value();
+         return minmax_range(low, high);
+
       case ir_unop_sqrt:
       case ir_unop_rsq:
       case ir_unop_exp:
-- 
2.0.3



More information about the mesa-dev mailing list