[Mesa-dev] [PATCH] glsl: remove logical xor FINISHME
Kenneth Graunke
kenneth at whitecape.org
Mon Jan 9 16:34:56 PST 2012
On 01/09/2012 08:36 AM, Eric Anholt wrote:
> On Sun, 8 Jan 2012 22:44:17 -0500, Matt Turner<mattst88 at 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.
More information about the mesa-dev
mailing list