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

            Bug ID: 62664
           Summary: MMX set intrinsics
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g.peterhoff.home at talkplus dot de

Hello,
the set/set1-mmx intrinsics do not work with optimizations on Windows. The
code:

typedef union
{
    __m64    m;
    int32_t    e[2];
} ZZ;

int main()
{
    srand(time(nullptr));

    int32_t    r=rand()%100;
    double    d; // or float; integer works
    ZZ    z;

    z.m=_mm_set1_pi32(r); // or other _mm_setX_piXX with correct ZZ.e
    d=z.e[0];
    std::cout<<z.e[0]<<std::endl<<d<<std::endl<<d<<std::endl<<d<<std::endl<<d;

    return 0;
}

result (eg):
81
nan
-81
81
81

Without optimizations it is correct. I have tested with
Win 8.0
  cygwin/32 gcc 4.8.3
  mingw/32 gcc 4.8.1
  mingw/64 gcc 4.8.1
Suse 12.3/64 gcc 4.7 -> working properly

Reply via email to