2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr52754.c
blob0f2dbff2dd708e805ec64eb5d48a5e6eef2854ab
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fpredictive-commoning -msse2 -std=c99" } */
3 /* { dg-require-effective-target sse2 } */
5 #include <x86intrin.h>
7 #include "isa-check.h"
8 #include "sse-os-support.h"
10 int main()
12 const float mem[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
14 unsigned int indexes[8];
15 for (unsigned int i = 0; i < 8; ++i) indexes[i] = i;
17 check_isa ();
19 if (!sse_os_support ())
20 exit (0);
22 __m128 x = _mm_setr_ps(0, 1, 2, 3);
23 for (unsigned int i = 0; i + 4 < 6; ++i) {
24 const unsigned int *ii = &indexes[i];
25 const __m128 tmp = _mm_setr_ps(mem[ii[0]], mem[ii[1]], mem[ii[2]], mem[ii[3]]);
26 if (0xf != _mm_movemask_ps(_mm_cmpeq_ps(tmp, x))) {
27 __builtin_abort();
29 x = _mm_add_ps(x, _mm_set1_ps(1));
32 return 0;