[Mesa-dev] [PATCH 13/16] glsl: Add ir_binop_sub to get_range
Thomas Helland
thomashelland90 at gmail.com
Sun Nov 16 17:51:58 PST 2014
---
src/glsl/opt_minmax.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 0638a12..9d300d3 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -335,6 +335,15 @@ get_range(ir_rvalue *rval)
high = add(r0.high, r1.high)->constant_expression_value();
return minmax_range(low, high);
+ case ir_binop_sub:
+ r0 = get_range(expr->operands[0]);
+ r1 = get_range(expr->operands[1]);
+ if (r0.low && r1.high)
+ low = sub(r0.low, r1.high)->constant_expression_value();
+ if(r0.high && r1.low)
+ high = sub(r0.high, r1.low)->constant_expression_value();
+ return minmax_range(low, high);
+
case ir_binop_pow:
r0 = get_range(expr->operands[0]);
if (is_greater_than_or_equal_zero(r0.low))
--
2.0.3
More information about the mesa-dev
mailing list