https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68484
Bug ID: 68484
Summary: _mm_storel_epi64((__m128i *)x, m); does nothing if "x"
is a "volatile" ptr
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vvsed at hotmail dot com
Target Milestone: ---
Created attachment 36803
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36803&action=edit
It's *.ii file for the above source.
The following program prints "0 0" instead of "1 1".
If we use _mm_storel_pi() instead of _mm_storel_epi64(), it's OK.
The CPU is Intel Haswell with Windows 7.1.
Same with 4.8, 4.9, 5.1 g++ versions.
/*
D:\Tools\MinGW64\bin\g++.exe -m64 -O2 -Wall -Wextra -save-temps gcerr.cpp
-ovx_class_gc
Compiler: http://tdm-gcc.tdragon.net/about
_mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a "volatile" ptr
*/
#include <stdio.h>
#include <emmintrin.h>
int main(int argc, const char *argv[])
{
int _x[2] = {0};
int * volatile x = _x;
__m128i m = _mm_set1_epi32(1);
char s[1];
_mm_storel_epi64((__m128i *)x, m);
// _mm_storel_pi((__m64 *)x, *(__m128 *)&m); //OK
fprintf(stdout, "%d %d \npress Enter", x[0], x[1]);
gets(s);
return 0;
}