gcc/testsuite/gcc.target/i386/sse-18.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O3 -msse2" } */ |
| 3 | /* { dg-require-effective-target sse2 } */ |
| 4 | |
| 5 | #include "sse2-check.h" |
| 6 | |
| 7 | #include <emmintrin.h> |
| 8 | |
| 9 | __m128i foo (char) __attribute__((noinline)); |
| 10 | __m128i foo (char x) { |
| 11 | return _mm_set1_epi8(x); |
| 12 | } |
| 13 | __m128i bar (char) __attribute__((noinline)); |
| 14 | __m128i bar (char x) { |
| 15 | return _mm_set_epi8 (x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x); |
| 16 | } |
| 17 | |
| 18 | static void |
| 19 | sse2_test (void) { |
| 20 | int i, j; |
| 21 | union u { __m128i v; char c[16]; }; |
| 22 | union u x, y; |
| 23 | |
| 24 | for (i = -128; i <= 127; i++) |
| 25 | { |
| 26 | x.v = foo ((char)i); |
| 27 | y.v = bar ((char)i); |
| 28 | for (j=0; j<16; j++) |
| 29 | if (x.c[j] != y.c[j]) |
| 30 | abort(); |
| 31 | } |
| 32 | } |
| 33 |