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

Ian Romanick idr at freedesktop.org
Wed Nov 19 11:22:21 PST 2014


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 11/16/2014 05:52 PM, Thomas Helland wrote:
> ---
>  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:
> 



More information about the mesa-dev mailing list