[Mesa-dev] [PATCH 10/16] glsl: Add ir_binop_add to get_range
Thomas Helland
thomashelland90 at gmail.com
Sun Nov 16 17:51:55 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 1aa4611..9852dd9 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -326,6 +326,15 @@ get_range(ir_rvalue *rval)
// We can get the intersection here to limit the range even more
return range_intersection(r0, minmax_range(low, high));
+ case ir_binop_add:
+ r0 = get_range(expr->operands[0]);
+ r1 = get_range(expr->operands[1]);
+ if(r0.low && r1.low)
+ low = add(r0.low, r1.low)->constant_expression_value();
+ if(r0.high && r1.high)
+ high = add(r0.high, r1.high)->constant_expression_value();
+ return minmax_range(low, high);
+
default:
break;
}
--
2.0.3
More information about the mesa-dev
mailing list