This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Add some folding of builtins fmin/fmax
On Sat, 2006-11-25 at 12:31 -0500, Kaveh R. GHAZI wrote:
> On Sat, 25 Nov 2006, Andrew Pinski wrote:
> > > + /* If either argument is NaN, return the other one. */
> > > + if (TREE_CODE (arg0) == REAL_CST && real_isnan (&TREE_REAL_CST (arg0)))
> > > + return fold_convert (type, arg1);
> > > + else
> > > + if (TREE_CODE (arg1) == REAL_CST && real_isnan (&TREE_REAL_CST (arg1)))
> > > + return fold_convert (type, arg0);
> > Shouldn't these be using omit_one_operand?
> Can a REAL_CST have side-effects?
Not really but the other argument could be an lvalue and you just made
fmax/fmin into a lvalue so some could write:
__builtin_fmax(__builtin_nan (), x) = 1;
Maybe add instead add a call to non_lvalue.