Hi,
Using gcc 4.4 cross compiler ( running on IA-32 but generating code for
x86-64 ):
gcc -O3 -fomit-frame-pointer -ffast-math -mfpmath=sse -msse2
-msse4 -mmmx -S -m64 -o x.s x.c
for x.c being:
#define DIM 1000
double a[DIM][DIM];
double dot()
{
double sum;
int i, j;
sum = 0.;
for ( i = 0; i < DIM; i++ )
{
for ( j = 0; j < DIM; j++ )
{
sum += a[i][j];
}
}
return sum;
}
generates the following assembly output x.s ( only part is shown ):
.type dot, @function
dot:
.LFB0:
xorpd %xmm0, %xmm0
movl $a, %eax
.
.
The register 'eax' ( 'rax' actualy ) is used later in the code as the
base for an address.
Questions:
1. Why 'movl' and not 'movq' is used? ( It seems that compilers
assumes that the size of the address of the symbol 'a' is 32 bits
only )
2. How to force the compiler to generate 'movq'?
Thanks in advance.
--
David Livshin
http://www.dalsoft.com