Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/sse2-pshufhw-1.c

raw
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 } */
5
6 #ifndef CHECK_H
7 #define CHECK_H "sse2-check.h"
8 #endif
9
10 #include CHECK_H
11
12 #ifndef TEST
13 #define TEST sse2_test_pshufhw_1
14 #endif
15
16 #define N 0xec
17
18 #include <emmintrin.h>
19
20 static __m128i
21 __attribute__((noinline, unused))
22 test (__m128i s1)
23 {
24 return _mm_shufflehi_epi16 (s1, N);
25 }
26
27 static void
28 TEST (void)
29 {
30 union128i_w s1, u;
31 short e[8] = { 0 };
32 int i;
33 int m1[4] = { 0x3, 0x3<<2, 0x3<<4, 0x3<<6 };
34 int m2[4];
35
36 s1.x = _mm_set_epi16 (0, 0, 0xa, 0xbcde, 0, 0, 0xef58, 0xa234);
37 u.x = test (s1.x);
38
39 for (i = 0; i < 4; i++)
40 e[i] = s1.a[i];
41
42 for (i = 0; i < 4; i++) {
43 int i2 = i;
44 #ifdef __LITTLE_ENDIAN__
45 i2 = 3 - i;
46 #endif
47 m2[i2] = (N & m1[i2]) >> (2 * i2);
48 }
49
50 for (i = 0; i < 4; i++)
51 e[i + 4] = s1.a[m2[i] + 4];
52
53 if (check_union128i_w(u, e))
54 {
55 #if DEBUG
56 union128i_w s;
57 s.x = s1.x;
58 printf ("sse2_test_pshufhw_1; check_union128i_w failed\n");
59 printf ("\t ([%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx])\n", s.a[0], s.a[1],
60 s.a[2], s.a[3], s.a[4], s.a[5], s.a[6], s.a[7]);
61 printf ("\t\t -> [%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx]\n", u.a[0], u.a[1],
62 u.a[2], u.a[3], u.a[4], u.a[5], u.a[6], u.a[7]);
63 printf ("\t expect [%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx]\n", e[0], e[1],
64 e[2], e[3], e[4], e[5], e[6], e[7]);
65 #endif
66 abort ();
67 }
68 }