Commit 8c7ccb02 authored by Emmanuel Thomé's avatar Emmanuel Thomé

rather use explicit volatile to avoid constant folding

parent fe5f2352
......@@ -17,8 +17,10 @@ int main() {
)
/* _m128i from 1 int64_t's */
#define _gf2x_mm_set1_epi64(u) _mm_set1_epi64( _gf2x_mm_cvtsi64_m64((int64_t) (u)))
__m128i a = _gf2x_mm_set1_epi64(17);
__m128i b = _gf2x_mm_set1_epi64(42);
volatile int a0 = 17;
volatile int a1 = 42;
__m128i a = _gf2x_mm_set1_epi64(a0);
__m128i b = _gf2x_mm_set1_epi64(a1);
union { __m128i s; unsigned long x[2]; } proxy;
proxy.s = _mm_clmulepi64_si128(a, b, 0);
return proxy.x[0] - 650;
......
......@@ -7,10 +7,12 @@
int main(int argc, char *argv[])
{
volatile int a0 = 17;
volatile int a1 = 42;
__m128i foo = _mm_setr_epi32(argc, argc + 1, argc + 2, argc + 3);
__m128i bar = _mm_setr_epi32(argc + 3, argc + 2, argc + 1, argc);
__m128i x = _mm_setr_epi32(42, 0, 17, 0);
__m128d g = _mm_set_pd(42.0, 17.0);
__m128i x = _mm_setr_epi32(a1, 0, a0, 0);
__m128d g = _mm_set_pd((double) a1, (double) a0);
x = _mm_srl_epi64(x, _mm_setr_epi32(2,0,0,0));
foo = _mm_mullo_epi16(foo, bar);
foo = _mm_slli_epi64(foo, 1);
......
......@@ -5,8 +5,10 @@
int main()
{
__m128d x = _mm_setr_pd(12.34, 34.12);
__m128d y = _mm_setr_pd(78.56, 56.78);
volatile double a0 = 12.34;
volatile double a1 = 56.78;
__m128d x = _mm_setr_pd(a0, 34.12);
__m128d y = _mm_setr_pd(78.56, a1);
double a[2], b[2] = { 78.56 + 56.78, 12.34 + 34.12 };
y = _mm_hadd_pd(y, x);
......
......@@ -8,11 +8,9 @@ int main(int argc, char * argv[])
/* the following test is for emulated 32-bit on physical 64-bit */
if (sizeof(unsigned long) != 8)
abort ();
if (argc < 3) {
fprintf(stderr, "This code must be called with arguments 17 and 42\n");
exit(EXIT_FAILURE);
}
__m128i x = _mm_setr_epi32(atoi(argv[2]), 0, atoi(argv[1]), 0);
volatile int a0 = 17;
volatile int a1 = 42;
__m128i x = _mm_setr_epi32(a1, 0, a0, 0);
// x = 0 0x2a 0 0x11
__m128i y = _mm_setr_epi32(42, 0, 17, 0);
// y = 0 0x2a 0 0x11
......
......@@ -5,7 +5,6 @@ if (HAVE_SSSE3)
try_run(sse41_runs sse41_compiles
${PROJECT_BINARY_DIR}/config
${PROJECT_SOURCE_DIR}/config/sse41.c
ARGS 17 42
)
if(sse41_compiles)
if (sse41_runs MATCHES FAILED_TO_RUN)
......@@ -20,7 +19,6 @@ if (HAVE_SSSE3)
${PROJECT_BINARY_DIR}/config
${PROJECT_SOURCE_DIR}/config/sse41.c
COMPILE_DEFINITIONS -msse4.1
ARGS 17 42
)
if(sse41_compiles)
if (sse41_runs MATCHES FAILED_TO_RUN)
......
......@@ -5,8 +5,10 @@
int main()
{
__m128i x = _mm_setr_epi32(0x03020100, 0x07060504, 0x0B0A0908, 0x0F0E0D0C);
__m128i y = _mm_setr_epi32(0x13121110, 0x17161514, 0x1B1A1918, 0x1F1E1D1C);
volatile uint32_t a0 = 0x03020100;
volatile uint32_t a1 = 0x1F1E1D1C;
__m128i x = _mm_setr_epi32(a0, 0x07060504, 0x0B0A0908, 0x0F0E0D0C);
__m128i y = _mm_setr_epi32(0x13121110, 0x17161514, 0x1B1A1918, a1);
uint64_t a[2], b[2] = { 0x0C0B0A0908070605, 0x14131211100F0E0D };
y = _mm_alignr_epi8(y, x, 0x5);
memcpy (a, &y, 16);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment