[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-pextrw.c
blob54926bd7e305fa06d536b33837eabec2408e0e7d
1 /* { dg-do run } */
2 /* { dg-options "-O3 -mvsx -Wno-psabi" } */
3 /* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */
4 /* { dg-require-effective-target p8vector_hw } */
6 #ifndef CHECK_H
7 #define CHECK_H "sse2-check.h"
8 #endif
10 #include CHECK_H
12 #ifndef TEST
13 #define TEST sse2_test_pextrw_1
14 #endif
16 #include <emmintrin.h>
18 #define msk0 0
19 #define msk1 1
20 #define msk2 2
21 #define msk3 3
22 #define msk4 4
23 #define msk5 5
24 #define msk6 6
25 #define msk7 7
27 static void
28 TEST (void)
30 union
32 __m128i x;
33 int i[4];
34 short s[8];
35 } val1;
36 int res[8], masks[8];
37 int i;
39 val1.i[0] = 0x04030201;
40 val1.i[1] = 0x08070605;
41 val1.i[2] = 0x0C0B0A09;
42 val1.i[3] = 0x100F0E0D;
44 res[0] = _mm_extract_epi16 (val1.x, msk0);
45 res[1] = _mm_extract_epi16 (val1.x, msk1);
46 res[2] = _mm_extract_epi16 (val1.x, msk2);
47 res[3] = _mm_extract_epi16 (val1.x, msk3);
48 res[4] = _mm_extract_epi16 (val1.x, msk4);
49 res[5] = _mm_extract_epi16 (val1.x, msk5);
50 res[6] = _mm_extract_epi16 (val1.x, msk6);
51 res[7] = _mm_extract_epi16 (val1.x, msk7);
53 masks[0] = msk0;
54 masks[1] = msk1;
55 masks[2] = msk2;
56 masks[3] = msk3;
57 masks[4] = msk4;
58 masks[5] = msk5;
59 masks[6] = msk6;
60 masks[7] = msk7;
62 for (i = 0; i < 8; i++)
63 if (res[i] != val1.s [masks[i]])
64 abort ();