This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to not fold constants?


Jeffrey A Law <law@cygnus.com> writes:

>   In message <37B0A847.B4EC8D0A@moene.indiv.nluug.nl>you write:
>   > > Yes.  There might be integer expressions inside that we want to fold.
>   > 
>   > Is that true - shouldn't the *frontend* decide how to interpret mixed
>   > mode expressions ?  Or is fold-const.c so tied up with C that the
>   > Fortran frontend probably shouldn't use it ?!?
> fold-const.c is supposed to be generic enough to be used by any front end.  If
> we need to extend the tree structures to indicate when certain folds are safe
> vs not safe, then that's the way to deal with these problems.
> 
> Similarly for the folding routines found in cse & combine; they are supposed to
> be language independent.

cse (& combine?) will need to be changed at a higher level; if you have

#pragma STDC FENV_ACCESS ON
void foo(void);
double bar(double x)
{
  double y;
  y = x + x;
  foo(void);
  y += x + x;
  return y;
}

you must still perform three '+' operations, despite the common
subexpression, because foo() may change the rounding mode or test
the exception flags (the addition may overflow, for instance).


-- 
Geoffrey Keating <geoffk@cygnus.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]