[Mesa-dev] [PATCH 9/9] glsl: optimize (0 cmp x + y) into (-x cmp y).

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Feb 24 23:59:19 PST 2015


On Tuesday 24 February 2015 12:22:18 Ian Romanick wrote:
> This patch is
> 
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> 
> Please also add the following to the commit message:
> 
> Cc: "10.4 10.5" <mesa-stable at lists.freedesktop.org>
> 
> If you guys have the time, I'd also really appreciate a piglit test or
> two for this case.
> 

OK, we are going to create piglit tests for this case.

Thanks for the review,

Sam

> On 02/24/2015 10:02 AM, Eduardo Lima Mitev wrote:
> > From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> > 
> > The optimization done by commit 34ec1a24d did not take it into account.
> > 
> > Fixes:
> > 
> > dEQP-GLES3.functional.shaders.random.all_features.fragment.20
> > 
> > Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> > ---
> > 
> >  src/glsl/opt_algebraic.cpp | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
> > index c6f4a9c..8183d57 100644
> > --- a/src/glsl/opt_algebraic.cpp
> > +++ b/src/glsl/opt_algebraic.cpp
> > @@ -578,9 +578,18 @@ ir_algebraic_visitor::handle_expression(ir_expression
> > *ir)> 
> >           if (!is_vec_zero(zero))
> >           
> >              continue;
> > 
> > -         return new(mem_ctx) ir_expression(ir->operation,
> > -                                           add->operands[0],
> > -                                           neg(add->operands[1]));
> > +         /* Depending of the zero position we want to optimize
> > +          * (0 cmp x+y) into (-x cmp y) or (x+y cmp 0) into (x cmp -y)
> > +          */
> > +         if (add_pos == 1) {
> > +            return new(mem_ctx) ir_expression(ir->operation,
> > +                                              neg(add->operands[0]),
> > +                                              add->operands[1]);
> > +         } else {
> > +            return new(mem_ctx) ir_expression(ir->operation,
> > +                                              add->operands[0],
> > +                                              neg(add->operands[1]));
> > +         }
> > 
> >        }
> >        break;
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150225/6f0fcf45/attachment.sig>


More information about the mesa-dev mailing list