Alignment of doubles in ghc

Matthew Donadio
Sat, 03 May 2003 22:24:29 -0400

Hi all,

I was wondering if anyone has investigated the alignment of doubles in

On x86 machines, doubles can be aligned on 4 byte boundaries, but there
is a performace improvement if they have 8 byte alignment.  As far as I
can tell, ghc uses 4 byte alignment for doubles.

I started to look into the changes needed to go from 4 to 8 byte

>From what I saw, it looks like I need to add -malign-double to the gcc
flags in ghc/compiler/main/DriverFlags.hs for the x86 architecture.

The only other place I saw is in the autoconf stuff.  The
FPTOOLS_CHECK_ALIGNMENT macro is defined in aclocal.m4, and I can just
set CFLAGS="-malign-double" in that macro (despite the name, that flag
also effects other types...).

Are there any other places that need attention?

Has anyone else looked into this?


Matthew Donadio <>