Duncan Coutts wrote:

I found that -O2-for-C/-optc-O2 breaks on sparc (makes genprimop
segfault immediately on startup). That's not a bug of course, though it
happens to work on x86/amd64. People do do this kind of thing despite
the warnings:
http://haskell.org/haskellwiki/Performance/GHC
see "Crank up the gcc flags", "-optc-O3 -optc-ffast-math" :-)

-optc-O2 is certainly supposed to work on x86 / x86_64, in fact we use it to build our binaries. In the HEAD, -O2 even turns on -optc-O2 (that may have been a bit rash, I can always change it back).

We needed -optc-O2 because with gcc around 3.4 there was some horrible code being generated by plain -O.

I'm currently testing a system in the Gentoo ghc ebuilds to pass a
highly filtered set of the users' CFLAGS through to gcc via
-optc/-opta/-optl as appropriate. This was requested by the Gentoo
people who support the less common arches like sparc,mips,alpha etc.
Their point was that it's important for some abi flags to be passed
through to gcc or we'll end up using a different abi from the rest of
the system. This is particularly true with mips which seems to have
about half a dozen different possible ABIs including 32/64bit
instructions, 32/64bit pointers and big/little endian. Crazy. A more
sensible example is sparc where if you don't specify and -march= flag
then gcc will generate code for the sparc v7 cpu generation which did
not have integer or floating point multiplication/division instructions.
So pretty much all sparc users have something like "-march=ultrasparc"
in their CFLAGS. If we pass that through then we do get gcc emiting the
new assembler instructions. On some apps this can make a big performance
difference. The one most often quoted is OpenSSL which runs several
times faster for some operations when compiled for the appropriate sparc
CPU generation.

So we're testing this code in ghc-6.4.1-r3.ebuild and
ghc-6.4.2_pre200603XX.ebuild, hence my noticing that -O2 breaks sparc.
-O2 also breaks ia64 by changing the assembly and upsetting the mangler.
Both are now filtered out.

Ok, that's all useful to know, thanks.

Cheers,
        Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to