1 /* { dg-do run } */
2 /* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */
3 /* { dg-require-effective-target lp64 } */
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_pslld_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_epi32 (s1, N);  \
24   }
25 
26 TEST_FUNC(0, 0)
27 TEST_FUNC(15, 15)
28 TEST_FUNC(16, 16)
29 TEST_FUNC(31, 31)
30 TEST_FUNC(neg1, -1)
31 TEST_FUNC(neg16, -16)
32 TEST_FUNC(neg32, -32)
33 TEST_FUNC(neg64, -64)
34 TEST_FUNC(neg128, -128)
35 
36 #define TEST_CODE(id, N) \
37   { \
38     int e[4] = {0}; \
39     union128i_d u, s; \
40     int i; \
41     s.x = _mm_set_epi32 (1, -2, 3, 4); \
42     u.x = test##id (s.x); \
43     if (N >= 0 && N < 32) \
44       for (i = 0; i < 4; i++) \
45         e[i] = s.a[i] << (N * (N >= 0)); \
46     if (check_union128i_d (u, e)) \
47       abort (); \
48   }
49 
50 static void
TEST(void)51 TEST (void)
52 {
53   TEST_CODE(0, 0);
54   TEST_CODE(15, 15);
55   TEST_CODE(16, 16);
56   TEST_CODE(31, 31);
57   TEST_CODE(neg1, -1);
58   TEST_CODE(neg16, -16);
59   TEST_CODE(neg32, -32);
60   TEST_CODE(neg64, -64);
61   TEST_CODE(neg128, -128);
62 }
63