"David Mathog" <mat...@caltech.edu> writes: > Can somebody please explain the behavior of the following program > to me?
This question is not appropriate for the gcc@gcc.gnu.org mailing list, which is for the development of gcc itself. It would be appropriate on gcc-h...@gcc.gnu.org. Please take any followups to gcc-help. Thanks. > 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. SSE variables are passed in xmm registers. %X prints an unsigned int value; unsigned int values are passed in regular registers. The %X is seeing random garbage, it's not seeing the variable you are passing. Ian