This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Strangeness with SSE(1)
- From: "David Mathog" <mathog at caltech dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 21 Jan 2011 13:14:56 -0800
- Subject: Re: Strangeness with SSE(1)
Can somebody please explain the behavior of the following program
to me?
cat >test.c <<EOD
#include <stdio.h>
#include <stdlib.h>
#include <xmmintrin.h>
int main(void){
register __m128 var;
fprintf(stdout,"pre %X\n",var);
var = _mm_setzero_ps();
fprintf(stdout,"post %X\n",var);
fprintf(stdout,"zerof %X\n",0.0f);
exit(EXIT_SUCCESS);
}
EOD
gcc -O0 -g -std=gnu99 -msse -mno-sse2 -m32 -o test test.c
./test
pre FFC5FC98
post FFC5FC98
zerof 0
gcc --version
gcc (GCC) 4.4.1
Now I know that var is 16 bytes, not 4, so the %X isn't appropriate to
show all of it, but apparently it doesn't show any of it, since any 4
bytes out of the 16 should have been 0.
Plus if this is run in valgrind there are
Conditional jump or move depends on uninitialised value(s)
at both of the print statements that access var.
Adding -Wall
test.c:7: warning: format '%X' expects type 'unsigned int', but argument
3 has type '__m128'
test.c:9: warning: format '%X' expects type 'unsigned int', but argument
3 has type '__m128'
test.c:10: warning: format '%X' expects type 'unsigned int', but
argument 3 has type 'double'
test.c:7: warning: 'var' is used uninitialized in this function
But the last one goes away if the first fprintf is commented out. So
gcc passes _something_ for var to fprintf, but what?
Thanks,
David Mathog
mathog@caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech