Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/sse2-psllw-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_psllw_1
14 #endif
15
16 #include <emmintrin.h>
17
18 #define TEST_FUNC(id, N) \
19 static __m128i \
20 __attribute__((noinline, unused)) \
21 test##id (__m128i s1) \
22 { \
23 return _mm_slli_epi16 (s1, N); \
24 }
25
26 TEST_FUNC(0, 0)
27 TEST_FUNC(15, 15)
28 TEST_FUNC(16, 16)
29 TEST_FUNC(neg1, -1)
30 TEST_FUNC(neg16, -16)
31 TEST_FUNC(neg32, -32)
32 TEST_FUNC(neg64, -64)
33 TEST_FUNC(neg128, -128)
34
35 #define TEST_CODE(id, N) \
36 { \
37 short e[8] = {0}; \
38 union128i_w u, s; \
39 int i; \
40 s.x = _mm_set_epi16 (1, 2, 3, 4, 5, 6, 0x7000, 0x9000); \
41 u.x = test##id (s.x); \
42 if (N >= 0 && N < 16) \
43 for (i = 0; i < 8; i++) \
44 e[i] = s.a[i] << (N * (N >= 0)); \
45 if (check_union128i_w (u, e)) \
46 abort (); \
47 }
48
49 static void
50 TEST (void)
51 {
52 TEST_CODE(0, 0);
53 TEST_CODE(15, 15);
54 TEST_CODE(16, 16);
55 TEST_CODE(neg1, -1);
56 TEST_CODE(neg16, -16);
57 TEST_CODE(neg32, -32);
58 TEST_CODE(neg64, -64);
59 TEST_CODE(neg128, -128);
60 }