[Mesa-dev] [PATCH 12/22] glsl: Add ir_binop_sub to get_range
Thomas Helland
thomashelland90 at gmail.com
Sat Jan 3 11:18:17 PST 2015
V2: Correct whitespace issues
Put in alphabetic order
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/opt_minmax.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index e4aa677..dd13800 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -422,6 +422,18 @@ get_range(ir_rvalue *rval)
r1 = get_range(expr->operands[1]);
return resolv_mul_range(r0, r1);
+ 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);
+
default:
break;
}
--
2.2.1
More information about the mesa-dev
mailing list