On 01/09/2012 08:36 AM, Eric Anholt wrote:
On Sun,  8 Jan 2012 22:44:17 -0500, Matt Turner<matts...@gmail.com>  wrote:
GLSL spec boneheadedly says (a ^^ a) must actually be evaluated.

What it's trying to say there is that any side-effects of both LHS and
RHS will occur (as opposed to how&&  or || work), not that you actually
compute the expression that you could just avoid.  Any side effects will
already be taken care of before opt_algebraic gets a look at the
ir_expression.

In fact, with my patches that change ir_call to be a statement rather than an ir_rvalue, all expression trees are pure and there can be no side-effects. I'm hoping to land those for Mesa 8.1.

Even now, though, there shouldn't be side-effects in expression trees. My patches just make it more explicit.

So I think it's actually safe to optimize a ^^ a == false.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to