[Mesa-dev] [PATCH 08/16] glsl: Add abs to get_range
Thomas Helland
thomashelland90 at gmail.com
Sun Nov 16 17:51:53 PST 2014
---
src/glsl/opt_minmax.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index b925aaa..a48d4d8 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -283,6 +283,16 @@ get_range(ir_rvalue *rval)
r1 = get_range(expr->operands[1]);
return combine_range(r0, r1, expr->operation == ir_binop_min);
+ case ir_unop_abs:
+ r0 = get_range(expr->operands[0]);
+ if (is_greater_than_zero(r0.low))
+ low = r0.low;
+ else
+ low = new(mem_ctx) ir_constant(0.0f);
+ if (r0.high && r0.low)
+ high = larger_constant(r0.high, abs(r0.low)->constant_expression_value());
+ return minmax_range(low, high);
+
case ir_unop_sin:
case ir_unop_sin_reduced:
case ir_unop_cos:
--
2.0.3
More information about the mesa-dev
mailing list