[Bug c++/68484] _mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a "volatile" ptr

vvsed at hotmail dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 23 07:36:00 GMT 2015


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

--- Comment #2 from Vladimir Sedach <vvsed at hotmail dot com> ---
It is not just about "long long".

_mm_store_ps() is also wrong, while _mm_store_pd() / _mm_store_si128() are OK:


#include <stdio.h>
#include <emmintrin.h>

int main(int argc, const char *argv[])
{
        __attribute__((aligned(16))) int        _x[4] = {0};
        int * volatile x = _x;
        __m128i m = _mm_set1_epi32(1);

        _mm_storel_epi64((__m128i *)x, m);              //wrong
//      _mm_storel_pi((__m64 *)x, *(__m128 *)&m);       //ok

        _mm_store_ps((float *)x, *(__m128 *)&m);        //wrong
//      _mm_store_pd((double *)x, *(__m128d *)&m);      //ok
//      _mm_store_si128((__m128i *)x, *(__m128i *)&m);  //ok

        fprintf(stdout, "%d %d \npress Enter", x[0], x[1]);

        getc(stdin);
        return 0;
}


More information about the Gcc-bugs mailing list