This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add FMA_EXPR, un-cse multiplications before expansion
On Thu, 21 Oct 2010, Geert Bosch wrote:
> Yes, that would be great. It is essential for some numerical code to
> avoid automatic contractions. As such code is typically library code
> that is compiled separately, it would be acceptable to have a compile-time
> option for now.
>
> Can't wait for pragma STDC FP_CONTRACT implementation, as well as working
Out of interest, are the other pragmas (FENV_ACCESS, CX_LIMITED_RANGE) of
interest, or just FP_CONTRACT? As you probably know, there are lots of
ways in which -frounding-math -ftrapping-math fail to implement the full
requirements of FENV_ACCESS, so separate compilation isn't a full
solution there.
The FP_CONTRACT pragma requires information about source language
expressions to be preserved up to the point where contracting takes place
on GIMPLE. All three pragmas require information about pragma state to be
tracked with expressions for as long as relevant; for FP_CONTRACT this is
only until the contracting on GIMPLE (supposing that RTL descriptions of
fma as (a*b)+c are eliminated), for CX_LIMITED_RANGE this is (I think)
only until complex arithmetic is lowered, but for FENV_ACCESS the effects
of exceptions and rounding modes need to be handled throughout the GIMPLE
and RTL optimizers. Proper support for all the pragmas would also involve
a large and complicated set of testcases to cover the different ways in
which it's easy to get these things wrong. (There are of course lots of
other fixes needed in places including back ends and libgcc for
FENV_ACCESS to work properly.)
--
Joseph S. Myers
joseph@codesourcery.com