Hi Olivier, On Wed, May 25, 2011 at 06:13:28PM +0200, Olivier Maury wrote: > [...] > I wrote a very simple example to test some movntq builtin function: > > #include <stdlib.h> > #include <stdio.h> > > int main(int argc, char **argv) > { > double *out; > double in = 2.0; > long long unsigned int *vin = (long long unsigned int *)∈ > > out = (double*)malloc(sizeof(double)); > > out[0] = 0.0; > > printf("%E\n", out[0]); > printf("%E\n", *((double*)vin)); > > __builtin_ia32_movntq((long long unsigned int*)(out), *vin); > > printf("%E\n", *out); > } > > Since I'm compiling on a 32 bits OS I use the following compilation > command: gcc movntq.c -mfpmath=sse -msse3 > > If I have a look at the assembly code I have the following code between > the two last printf : > > call printf > movl -12(%ebp), %eax > movl (%eax), %edx > movl 4(%eax), %ecx > movl -16(%ebp), %eax > movl %edx, -32(%ebp) > movl %ecx, -28(%ebp) > movq -32(%ebp), %mm0 > movntq %mm0, (%eax) > movl -16(%ebp), %eax > movsd (%eax), %xmm0 > movsd %xmm0, 4(%esp) > movl $.LC2, (%esp) > call printf > > [...] > > If the value stored in out[0] is ok after the movntq instruction (p > out[0] returns 2 in gdb) the last printf returns a NAN... > > Does anyone have an idea about what's going on here ? Is it a bug ? Is think it's a bug in your code / the documentation. See the old bug report http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28331 calling __builtin_ia32_emms(); after movntq solves the problem on my machine. Axel