This is the mail archive of the
`gcc-patches@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] |

Other format: | [Raw text] |

*From*: Ian Lance Taylor <iant at google dot com>*To*: Richard Guenther <richard dot guenther at gmail dot com>*Cc*: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com*Date*: Fri, 10 Feb 2012 06:17:24 -0800*Subject*: Re: Go patch committed: Build math library with -funsafe-math-optimizations*References*: <mcraa4tt8sx.fsf@dhcp-172-18-216-180.mtv.corp.google.com> <CAFiYyc0NpcqDvc20BmduUS-sur4ksxXV3_SSiEO3o5jwpqVg+g@mail.gmail.com> <mcr1uq3rjyb.fsf@dhcp-172-18-216-180.mtv.corp.google.com> <CAFiYyc0-X0-H2+aL8eXvU5CrzF5VK_ga+dSQEqWXyYKEB9zAUg@mail.gmail.com>

Richard Guenther <richard.guenther@gmail.com> writes: > On Thu, Feb 9, 2012 at 6:32 PM, Ian Lance Taylor <iant@google.com> wrote: >> Richard Guenther <richard.guenther@gmail.com> writes: >> >>> On Wed, Feb 8, 2012 at 8:38 PM, Ian Lance Taylor <iant@google.com> wrote: >>>> The master Go math library uses assembler code on 386 processors to take >>>> advantage of 387 instructions. ÂThis patch lets gccgo do the same thing, >>>> by compiling the math library with -funsafe-math-optimizations. ÂI also >>>> pass -mfancy-math-387, although that is the default. ÂIt would not be >>>> appropriate to compile all Go code with -funsafe-math-optimizations, of >>>> course, but the math library is designed to handle it. >>> >>> Huh ... I'd rather not do that if I were you. ÂInstead I'd say we lack a >>> machine specific flag to enable the fancy-x87-math patterns which >>> then -funsafe-math-optimizations should enable. ÂThe x87 math >>> routines are the only thing you are after, right? ÂNo math-library >>> can be _safe_ against -funsafe-math-optimizations I believe. >> >> Yes, that approach would make sense, but this doesn't seem like the >> right time to do it. >> >> The -funsafe-math-optimizations option does not permit arbitrary >> behaviour. ÂIt merely permits a set of optimizations which violate >> strict IEEE conformance. ÂI believe the Go math library can be safe in >> the presence of those optimizations, because the library does explicit >> checks for NaN and infinity, where necessary, before it does the actual >> operation. ÂThe math library has a fairly extensive set of tests, >> including tests of exceptional conditions, and it passes the tests when >> using -funsafe-math-optimizations. ÂNote that I'm only using >> -funsafe-math-optimizations on x86. > > I see. -funsafe-math-optimizations affects precision though (it doesn't > assume NaNs or Infinities do not happen), see the docs - it enables > -fno-signed-zeros, -fno-trapping-math, -fassociative-math and -freciprocal-math. Affecting precision is OK for the Go math library, since the master version of the library is written to use the 80-bit 80387 registers on 386, in order to use the magic 80387 instructions. Ian

**References**:**Go patch committed: Build math library with -funsafe-math-optimizations***From:*Ian Lance Taylor

**Re: Go patch committed: Build math library with -funsafe-math-optimizations***From:*Richard Guenther

**Re: Go patch committed: Build math library with -funsafe-math-optimizations***From:*Ian Lance Taylor

**Re: Go patch committed: Build math library with -funsafe-math-optimizations***From:*Richard Guenther

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |