This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Processor-specific code
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Dave Korn <dave dot korn at artimi dot com>
- Cc: "'Robert Dewar'" <dewar at adacore dot com>, "'Richard Henderson'" <rth at redhat dot com>, "'François-Xavier Coudert'" <Francois-Xavier dot Coudert at lcp dot u-psud dot fr>, "'Steve Kargl'" <sgk at troutmask dot apl dot washington dot edu>, fortran at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 15 Apr 2005 18:08:14 +0100
- Subject: RE: Processor-specific code
- Organization: GNU
- References: <SERRANOpM2yqOX9kOS60000018e@SERRANO.CAM.ARTIMI.COM>
On Fri, 2005-04-15 at 17:49, Dave Korn wrote:
> ----Original Message----
> >From: Richard Earnshaw
> >Sent: 15 April 2005 17:42
>
> > On Fri, 2005-04-15 at 15:50, Robert Dewar wrote:
> >> Richard Earnshaw wrote:
> >>
> >>> Not all environments can change the rounding mode dynamically. For
> >>> example, on the FPA co-processor for ARM, rounding is set by the
> >>> instruction selected -- so the concept of having an environment variable
> >>> to control this is meaningless.
> >>
> >> Right, such a feature obviously does not apply to hardware that is this
> >> far from the IEEE standard (which requires dynamic control). The Alpha
> >> architecture has similar problems.
> >
> > Precisely which statement in IEEE 754-1985 states this? As far as I can
> > tell this standard is a mathematical abstraction for mapping floating
> > point onto machine types. Chapter 4 describes the required rounding
> > modes but definitely makes no statement saying that this has to be
> > selectable in a dynamic manner.
> >
> > R.
>
> Doesn't the C language spec require the mode to be switchable at runtime?
>
> In any case, the ARM or Alpha isn't prevented from working in such a
> fashion just because the rounding mode is encoded in the instruction; it
> just means that fp primitives have to be compiled as intrinsics that test
> whatever flag controls the rounding mode and then branch to an fp insn of
> the appropriate form.
c90 doesn't require anything; it's all new in c99.
C99 has a number of functions and defines a number of macros *iff* the
environment supports rounding switching. It certainly doesn't require
it.
Code that changes the rounding has to be wrapped with certain pragmas to
inform the compiler that this might happen: on something like ARM+FPA
that might permit dynamic code switching, but I doubt anyone would
really want to pay that price.
R.