c++: normalizing ttp constraints [PR115656]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-psllw-1.c
blobaafbe6bc52447a49f81fad7a3ba8f464071d3180
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_psllw_1
14 #endif
16 #include <emmintrin.h>
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); \
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)
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 (); \
49 static void
50 TEST (void)
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);