<div dir="ltr"><p dir="ltr"><br>
On Mar 23, 2016 2:07 AM, "Francisco Jerez" <<a href="mailto:currojerez@riseup.net" target="_blank">currojerez@riseup.net</a>> wrote:<br>
><br>
> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>> writes:<br>
><br>
> > Many of our optimizations, while great for cutting shaders down to size,<br>
> > aren't really precision-safe.  This commit tries to flag all of the<br>
> > inexact floating-point optimizations so they don't get run on values that<br>
> > are flagged "exact".  It's a bit conservative and maybe flags some safe<br>
> > optimizations as unsafe but that's better than missing one.<br>
> > ---<br>
> >  src/compiler/nir/nir_opt_algebraic.py | 156 +++++++++++++++++-----------------<br>
> >  1 file changed, 78 insertions(+), 78 deletions(-)<br>
> ><br>
> > diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py<br>
> > index 3e7ea06..b229f03 100644<br>
> > --- a/src/compiler/nir/nir_opt_algebraic.py<br>
> > +++ b/src/compiler/nir/nir_opt_algebraic.py<br>
> > @@ -61,19 +61,19 @@ optimizations = [<br>
> >     (('fabs', ('fneg', a)), ('fabs', a)),<br>
> >     (('iabs', ('iabs', a)), ('iabs', a)),<br>
> >     (('iabs', ('ineg', a)), ('iabs', a)),<br>
> > -   (('fadd', a, 0.0), a),<br>
> > +   (('~fadd', a, 0.0), a),<br>
> >     (('iadd', a, 0), a),<br>
> >     (('usadd_4x8', a, 0), a),<br>
> >     (('usadd_4x8', a, ~0), ~0),<br>
> > -   (('fadd', ('fmul', a, b), ('fmul', a, c)), ('fmul', a, ('fadd', b, c))),<br>
> > +   (('~fadd', ('fmul', a, b), ('fmul', a, c)), ('fmul', a, ('fadd', b, c))),<br>
> >     (('iadd', ('imul', a, b), ('imul', a, c)), ('imul', a, ('iadd', b, c))),<br>
> > -   (('fadd', ('fneg', a), a), 0.0),<br>
> > +   (('~fadd', ('fneg', a), a), 0.0),<br>
> >     (('iadd', ('ineg', a), a), 0),<br>
> >     (('iadd', ('ineg', a), ('iadd', a, b)), b),<br>
> >     (('iadd', a, ('iadd', ('ineg', a), b)), b),<br>
> > -   (('fadd', ('fneg', a), ('fadd', a, b)), b),<br>
> > -   (('fadd', a, ('fadd', ('fneg', a), b)), b),<br>
> > -   (('fmul', a, 0.0), 0.0),<br>
> > +   (('~fadd', ('fneg', a), ('fadd', a, b)), b),<br>
> > +   (('~fadd', a, ('fadd', ('fneg', a), b)), b),<br>
> > +   (('~fmul', a, 0.0), 0.0),<br>
> >     (('imul', a, 0), 0),<br>
> >     (('umul_unorm_4x8', a, 0), 0),<br>
> >     (('umul_unorm_4x8', a, ~0), a),<br>
> > @@ -81,33 +81,33 @@ optimizations = [<br>
> >     (('imul', a, 1), a),<br>
> >     (('fmul', a, -1.0), ('fneg', a)),<br>
> >     (('imul', a, -1), ('ineg', a)),<br>
> > -   (('ffma', 0.0, a, b), b),<br>
> > -   (('ffma', a, 0.0, b), b),<br>
> > -   (('ffma', a, b, 0.0), ('fmul', a, b)),<br>
> > -   (('ffma', a, 1.0, b), ('fadd', a, b)),<br>
> > -   (('ffma', 1.0, a, b), ('fadd', a, b)),<br>
><br>
> I think 'ffma a 1 b'/'ffma 1 a b' -> 'fadd a b' could be made safe.</p>
<p dir="ltr">I think that should be OK.</p>
<p dir="ltr">> > -   (('flrp', a, b, 0.0), a),<br>
> > -   (('flrp', a, b, 1.0), b),<br>
> > -   (('flrp', a, a, b), a),<br>
> > -   (('flrp', 0.0, a, b), ('fmul', a, b)),<br>
> > +   (('~ffma', 0.0, a, b), b),<br>
> > +   (('~ffma', a, 0.0, b), b),<br>
> > +   (('~ffma', a, b, 0.0), ('fmul', a, b)),<br>
> > +   (('~ffma', a, 1.0, b), ('fadd', a, b)),<br>
> > +   (('~ffma', 1.0, a, b), ('fadd', a, b)),<br>
> > +   (('~flrp', a, b, 0.0), a),<br>
> > +   (('~flrp', a, b, 1.0), b),<br>
> > +   (('~flrp', a, a, b), a),<br>
> > +   (('~flrp', 0.0, a, b), ('fmul', a, b)),<br>
> >     (('flrp', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp'),<br>
> >     (('ffract', a), ('fsub', a, ('ffloor', a)), 'options->lower_ffract'),<br>
> > -   (('fadd', ('fmul', a, ('fadd', 1.0, ('fneg', c))), ('fmul', b, c)), ('flrp', a, b, c), '!options->lower_flrp'),<br>
> > -   (('fadd', a, ('fmul', c, ('fadd', b, ('fneg', a)))), ('flrp', a, b, c), '!options->lower_flrp'),<br>
> > +   (('~fadd', ('fmul', a, ('fadd', 1.0, ('fneg', c))), ('fmul', b, c)), ('flrp', a, b, c), '!options->lower_flrp'),<br>
> > +   (('~fadd', a, ('fmul', c, ('fadd', b, ('fneg', a)))), ('flrp', a, b, c), '!options->lower_flrp'),<br>
> >     (('ffma', a, b, c), ('fadd', ('fmul', a, b), c), 'options->lower_ffma'),<br>
> > -   (('fadd', ('fmul', a, b), c), ('ffma', a, b, c), '!options->lower_ffma'),<br>
> > +   (('~fadd', ('fmul', a, b), c), ('ffma', a, b, c), '!options->lower_ffma'),<br>
> >     # Comparison simplifications<br>
> > -   (('inot', ('flt', a, b)), ('fge', a, b)),<br>
> > -   (('inot', ('fge', a, b)), ('flt', a, b)),<br>
> > -   (('inot', ('feq', a, b)), ('fne', a, b)),<br>
> > -   (('inot', ('fne', a, b)), ('feq', a, b)),<br>
> > -   (('inot', ('ilt', a, b)), ('ige', a, b)),<br>
> > -   (('inot', ('ige', a, b)), ('ilt', a, b)),<br>
> > -   (('inot', ('ieq', a, b)), ('ine', a, b)),<br>
> > -   (('inot', ('ine', a, b)), ('ieq', a, b)),<br>
><br>
> What's unsafe about the four integer comparison simplifications above?</p>
<p dir="ltr">Right.  I got too excited.  I'll leave those as safe.</p>
<p dir="ltr">> > -   (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),<br>
><br>
> This one seems mostly safe too.<br>
><br>
> > -   (('bcsel', ('flt', a, b), a, b), ('fmin', a, b)),<br>
> > -   (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),<br>
><br>
> What are the semantics of fmin/fmax?  Are they defined as in GLSL with<br>
> min(NaN, x) = NaN, min(x, NaN) = x?  Or the other way around?  Or is it<br>
> defined to be commutative?  In the first case the code above would<br>
> indeed be unsafe *but* the related simplification:</p><p dir="ltr"></p><p>I dug up the GLSL spec and it says the following for min:</p><p>Returns y if y < x, otherwise it returns x</p><p>so min(NaN, y) = y but min(x, NaN) = NaN<br></p><p>If we just change the optimizations to match the spec better, they would be safe.  Then we could add the non-safe ones as non-safe.</p><p>Sadly, I think our hardware implements the DX behaviour of "give me the non-NaN value"<br></p><p dir="ltr">> |     (('bcsel', ('flt', a, b), a, b), ('fmin', b, a)),<br>
> |     (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),<br>
><br>
> would be completely safe.<br>
><br>
> > +   (('~inot', ('flt', a, b)), ('fge', a, b)),<br>
> > +   (('~inot', ('fge', a, b)), ('flt', a, b)),<br>
> > +   (('~inot', ('feq', a, b)), ('fne', a, b)),<br>
> > +   (('~inot', ('fne', a, b)), ('feq', a, b)),<br>
> > +   (('~inot', ('ilt', a, b)), ('ige', a, b)),<br>
> > +   (('~inot', ('ige', a, b)), ('ilt', a, b)),<br>
> > +   (('~inot', ('ieq', a, b)), ('ine', a, b)),<br>
> > +   (('~inot', ('ine', a, b)), ('ieq', a, b)),<br>
> > +   (('~fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),<br>
> > +   (('~bcsel', ('flt', a, b), a, b), ('fmin', a, b)),<br>
> > +   (('~bcsel', ('flt', a, b), b, a), ('fmax', a, b)),<br>
> >     (('bcsel', ('inot', 'a@bool'), b, c), ('bcsel', a, c, b)),<br>
> >     (('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),<br>
> >     (('fmin', a, a), a),<br>
> > @@ -116,17 +116,17 @@ optimizations = [<br>
> >     (('imax', a, a), a),<br>
> >     (('umin', a, a), a),<br>
> >     (('umax', a, a), a),<br>
> > -   (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),<br>
> > -   (('fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),<br>
> > +   (('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),<br>
> > +   (('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),<br>
> >     (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),<br>
> >     (('fsat', ('fsat', a)), ('fsat', a)),<br>
> > -   (('fsat', ('fmin', a, 1.0)), ('fsat', a)),<br>
> > -   (('fsat', ('fmax', a, 0.0)), ('fsat', a)),<br>
> > +   (('~fsat', ('fmin', a, 1.0)), ('fsat', a)),<br>
> > +   (('~fsat', ('fmax', a, 0.0)), ('fsat', a)),<br>
> >     (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)),<br>
> > -   (('ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c))),<br>
> > -   (('ior', ('flt', a, c), ('flt', b, c)), ('flt', ('fmin', a, b), c)),<br>
> > -   (('ior', ('fge', a, b), ('fge', a, c)), ('fge', a, ('fmin', b, c))),<br>
> > -   (('ior', ('fge', a, c), ('fge', b, c)), ('fge', ('fmax', a, b), c)),<br>
><br>
> These would be safe if fmin/fmax were commutative, which I don't think<br>
> is the case?</p>
<p dir="ltr">They are not commutative :-(</p>
<p dir="ltr">> > +   (('~ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c))),<br>
> > +   (('~ior', ('flt', a, c), ('flt', b, c)), ('flt', ('fmin', a, b), c)),<br>
> > +   (('~ior', ('fge', a, b), ('fge', a, c)), ('fge', a, ('fmin', b, c))),<br>
> > +   (('~ior', ('fge', a, c), ('fge', b, c)), ('fge', ('fmax', a, b), c)),<br>
> >     (('slt', a, b), ('b2f', ('flt', a, b)), 'options->lower_scmp'),<br>
> >     (('sge', a, b), ('b2f', ('fge', a, b)), 'options->lower_scmp'),<br>
> >     (('seq', a, b), ('b2f', ('feq', a, b)), 'options->lower_scmp'),<br>
> > @@ -150,15 +150,15 @@ optimizations = [<br>
> >     (('ult', a, a), False),<br>
> >     (('uge', a, a), True),<br>
> >     # Logical and bit operations<br>
> > -   (('fand', a, 0.0), 0.0),<br>
> > +   (('~fand', a, 0.0), 0.0),<br>
><br>
> This is safe if fand(x, y) is defined as (x != 0 && y != 0 ? 1 : 0).<br>
> Could you remind me how it is defined?</p>
<p dir="ltr">Yes, that is the definition.</p>
<p dir="ltr">> >     (('iand', a, a), a),<br>
> >     (('iand', a, ~0), a),<br>
> >     (('iand', a, 0), 0),<br>
> >     (('ior', a, a), a),<br>
> >     (('ior', a, 0), a),<br>
> > -   (('fxor', a, a), 0.0),<br>
> > +   (('~fxor', a, a), 0.0),<br>
><br>
> Same goes here.</p>
<p dir="ltr">Right.</p>
<p dir="ltr">> >     (('ixor', a, a), 0),<br>
> > -   (('fxor', a, 0.0), a),<br>
> > +   (('~fxor', a, 0.0), a),<br>
> >     (('ixor', a, 0), a),<br>
> >     (('inot', ('inot', a)), a),<br>
> >     # DeMorgan's Laws<br>
> > @@ -174,35 +174,35 @@ optimizations = [<br>
> >     (('iand', 0xff, ('ushr', a, 24)), ('ushr', a, 24)),<br>
> >     (('iand', 0xffff, ('ushr', a, 16)), ('ushr', a, 16)),<br>
> >     # Exponential/logarithmic identities<br>
> > -   (('fexp2', ('flog2', a)), a), # 2^lg2(a) = a<br>
> > -   (('flog2', ('fexp2', a)), a), # lg2(2^a) = a<br>
> > +   (('~fexp2', ('flog2', a)), a), # 2^lg2(a) = a<br>
> > +   (('~flog2', ('fexp2', a)), a), # lg2(2^a) = a<br>
> >     (('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)), 'options->lower_fpow'), # a^b = 2^(lg2(a)*b)<br>
> > -   (('fexp2', ('fmul', ('flog2', a), b)), ('fpow', a, b), '!options->lower_fpow'), # 2^(lg2(a)*b) = a^b<br>
> > -   (('fexp2', ('fadd', ('fmul', ('flog2', a), b), ('fmul', ('flog2', c), d))),<br>
> > -    ('fmul', ('fpow', a, b), ('fpow', c, d)), '!options->lower_fpow'), # 2^(lg2(a) * b + lg2(c) + d) = a^b * c^d<br>
> > -   (('fpow', a, 1.0), a),<br>
> > -   (('fpow', a, 2.0), ('fmul', a, a)),<br>
> > -   (('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),<br>
> > -   (('fpow', 2.0, a), ('fexp2', a)),<br>
> > -   (('fpow', ('fpow', a, 2.2), 0.454545), a),<br>
> > -   (('fpow', ('fabs', ('fpow', a, 2.2)), 0.454545), ('fabs', a)),<br>
> > -   (('fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),<br>
> > -   (('frcp', ('fexp2', a)), ('fexp2', ('fneg', a))),<br>
> > -   (('frsq', ('fexp2', a)), ('fexp2', ('fmul', -0.5, a))),<br>
> > -   (('flog2', ('fsqrt', a)), ('fmul', 0.5, ('flog2', a))),<br>
> > -   (('flog2', ('frcp', a)), ('fneg', ('flog2', a))),<br>
> > -   (('flog2', ('frsq', a)), ('fmul', -0.5, ('flog2', a))),<br>
> > -   (('flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),<br>
> > -   (('fadd', ('flog2', a), ('flog2', b)), ('flog2', ('fmul', a, b))),<br>
> > -   (('fadd', ('flog2', a), ('fneg', ('flog2', b))), ('flog2', ('fdiv', a, b))),<br>
> > -   (('fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),<br>
> > +   (('~fexp2', ('fmul', ('flog2', a), b)), ('fpow', a, b), '!options->lower_fpow'), # 2^(lg2(a)*b) = a^b<br>
> > +   (('~fexp2', ('fadd', ('fmul', ('flog2', a), b), ('fmul', ('flog2', c), d))),<br>
> > +    ('~fmul', ('fpow', a, b), ('fpow', c, d)), '!options->lower_fpow'), # 2^(lg2(a) * b + lg2(c) + d) = a^b * c^d<br>
> > +   (('~fpow', a, 1.0), a),<br>
> > +   (('~fpow', a, 2.0), ('fmul', a, a)),<br>
> > +   (('~fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),<br>
> > +   (('~fpow', 2.0, a), ('fexp2', a)),<br>
> > +   (('~fpow', ('fpow', a, 2.2), 0.454545), a),<br>
> > +   (('~fpow', ('fabs', ('fpow', a, 2.2)), 0.454545), ('fabs', a)),<br>
> > +   (('~fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),<br>
> > +   (('~frcp', ('fexp2', a)), ('fexp2', ('fneg', a))),<br>
> > +   (('~frsq', ('fexp2', a)), ('fexp2', ('fmul', -0.5, a))),<br>
> > +   (('~flog2', ('fsqrt', a)), ('fmul', 0.5, ('flog2', a))),<br>
> > +   (('~flog2', ('frcp', a)), ('fneg', ('flog2', a))),<br>
> > +   (('~flog2', ('frsq', a)), ('fmul', -0.5, ('flog2', a))),<br>
> > +   (('~flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),<br>
> > +   (('~fadd', ('flog2', a), ('flog2', b)), ('flog2', ('fmul', a, b))),<br>
> > +   (('~fadd', ('flog2', a), ('fneg', ('flog2', b))), ('flog2', ('fdiv', a, b))),<br>
> > +   (('~fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),<br>
> >     # Division and reciprocal<br>
> > -   (('fdiv', 1.0, a), ('frcp', a)),<br>
> > -   (('fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),<br>
><br>
> This one is safe and I guess necessary if the back-end requires fdiv to<br>
> be lowered?</p>
<p dir="ltr">Thanks. I must have gotten too eager to flag things.</p>
<p dir="ltr">> > -   (('frcp', ('frcp', a)), a),<br>
> > -   (('frcp', ('fsqrt', a)), ('frsq', a)),<br>
> > -   (('fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'),<br>
><br>
> Same here.</p>
<p dir="ltr">Yup</p>
<p dir="ltr">> > -   (('frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),<br>
> > +   (('~fdiv', 1.0, a), ('frcp', a)),<br>
> > +   (('~fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),<br>
> > +   (('~frcp', ('frcp', a)), a),<br>
> > +   (('~frcp', ('fsqrt', a)), ('frsq', a)),<br>
> > +   (('~fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'),<br>
> > +   (('~frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),<br>
> >     # Boolean simplifications<br>
> >     (('ieq', 'a@bool', True), a),<br>
> >     (('ine', 'a@bool', True), ('inot', a)),<br>
> > @@ -221,8 +221,8 @@ optimizations = [<br>
> ><br>
> >     # Conversions<br>
> >     (('i2b', ('b2i', a)), a),<br>
> > -   (('f2i', ('ftrunc', a)), ('f2i', a)),<br>
> > -   (('f2u', ('ftrunc', a)), ('f2u', a)),<br>
> > +   (('~f2i', ('ftrunc', a)), ('f2i', a)),<br>
> > +   (('~f2u', ('ftrunc', a)), ('f2u', a)),<br>
> ><br>
> These seem safe to me.<br>
</p>I think they probably are.  I think there may be a problem when the number of mantissa bits is bigger than the number of integer bits.  In that case, the out-of-bounds behaviour may get interesting.  However, we're not handling that case yet so I think it's safe.<br><div><p dir="ltr">
> >     # Byte extraction<br>
> >     (('ushr', a, 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),<br>
> > @@ -235,17 +235,17 @@ optimizations = [<br>
> >     (('iand', 0xffff, a), ('extract_u16', a, 0), '!options->lower_extract_word'),<br>
> ><br>
> >     # Subtracts<br>
> > -   (('fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)),<br>
> > +   (('~fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)),<br>
> >     (('isub', a, ('isub', 0, b)), ('iadd', a, b)),<br>
> >     (('ussub_4x8', a, 0), a),<br>
> >     (('ussub_4x8', a, ~0), 0),<br>
> > -   (('fsub', a, b), ('fadd', a, ('fneg', b)), 'options->lower_sub'),<br>
> > +   (('~fsub', a, b), ('fadd', a, ('fneg', b)), 'options->lower_sub'),<br>
><br>
> Required for lowering.</p>
<p dir="ltr">Yup</p>
<p dir="ltr">> >     (('isub', a, b), ('iadd', a, ('ineg', b)), 'options->lower_sub'),<br>
> > -   (('fneg', a), ('fsub', 0.0, a), 'options->lower_negate'),<br>
> > +   (('~fneg', a), ('fsub', 0.0, a), 'options->lower_negate'),<br>
><br>
> Same here.</p>
<p dir="ltr">Yup</p>
<p dir="ltr">> >     (('ineg', a), ('isub', 0, a), 'options->lower_negate'),<br>
> > -   (('fadd', a, ('fsub', 0.0, b)), ('fsub', a, b)),<br>
> > +   (('~fadd', a, ('fsub', 0.0, b)), ('fsub', a, b)),<br>
> >     (('iadd', a, ('isub', 0, b)), ('isub', a, b)),<br>
> > -   (('fabs', ('fsub', 0.0, a)), ('fabs', a)),<br>
> > +   (('~fabs', ('fsub', 0.0, a)), ('fabs', a)),<br>
><br>
> This one seems safe.</p>
<p dir="ltr">Depends on whether or not a + 0.0 == a.  I think it should but glennk seemed to think it wasn't.  I'd rather be on the safe side for now.<br></p>
<p dir="ltr">> >     (('iabs', ('isub', 0, a)), ('iabs', a)),<br>
> ><br>
> >     # Misc. lowering<br>
> > @@ -372,10 +372,10 @@ for op in ['flt', 'fge', 'feq', 'fne',<br>
> >  # they help code generation but do not necessarily produce code that is<br>
> >  # more easily optimizable.<br>
> >  late_optimizations = [<br>
> > -   (('flt', ('fadd', a, b), 0.0), ('flt', a, ('fneg', b))),<br>
><br>
> This one also seems safe,</p>I've come to the conclusion that it isn't.  If you have a -inf and inf, then a+b is going to be one of NaN, inf, or 0.  In any case the expression on the left is commutative while the one on the right isn't.<br><p dir="ltr">> > -   (('fge', ('fadd', a, b), 0.0), ('fge', a, ('fneg', b))),<br>
> > -   (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),<br>
> > -   (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),<br>
><br>
> ...but these other ones are indeed unsafe for some sign combinations of<br>
> a and b when they are not finite.<br>
><br>
> > +   (('~flt', ('fadd', a, b), 0.0), ('flt', a, ('fneg', b))),<br>
> > +   (('~fge', ('fadd', a, b), 0.0), ('fge', a, ('fneg', b))),<br>
> > +   (('~feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),<br>
> > +   (('~fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),<br>
> >     (('fdot2', a, b), ('fdot_replicated2', a, b), 'options->fdot_replicates'),<br>
> >     (('fdot3', a, b), ('fdot_replicated3', a, b), 'options->fdot_replicates'),<br>
> >     (('fdot4', a, b), ('fdot_replicated4', a, b), 'options->fdot_replicates'),<br>
><br>
> I've also looked through the remaining algebraic optimizations in this<br>
> pass, and things look safe except for the ones you have already marked<br>
> unsafe in this patch -- I'll wait until you answer the questions I<br>
> pointed out before I send you a R-b for it though.<br>
><br>
> > --<br>
> > 2.5.0.400.gff86faf<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>
</div></div>