[Bug c/86866] New: MMX intrinsics / x87 registers aliasing

konovalov.alv at ya dot ru gcc-bugzilla@gcc.gnu.org
Mon Aug 6 13:20:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86866

            Bug ID: 86866
           Summary: MMX intrinsics / x87 registers aliasing
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: konovalov.alv at ya dot ru
  Target Milestone: ---

Each 64-bit MMX register corresponds to the mantissa part of an 80-bit x87
register. But the GCC considers the MMX and X87 registers independent.


For example:

#include <mmintrin.h>
#include <stdio.h>

int main()
{
   float x = 3.14;
   __m64 y = _mm_or_si64(_m_from_int(1), _m_from_int(2));
   (void)y;
   printf("%f\n", x);
}


If I build this code using 387 floating-point coprocessor, program prints wrong
result:

bash-4.2$ gcc -mfpmath=387 -O0 -g3 test2.c -o test
bash-4.2$ ./test 
-nan


More information about the Gcc-bugs mailing list