1 /* { dg-do run } */
2 /* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */
3 /* { dg-require-effective-target p8vector_hw } */
4
5 #ifndef CHECK_H
6 #define CHECK_H "sse2-check.h"
7 #endif
8
9 #include CHECK_H
10
11 #ifndef TEST
12 #define TEST sse2_test_pslld_1
13 #endif
14
15 #include <emmintrin.h>
16
17 #define TEST_FUNC(id, N) \
18 static __m128i \
19 __attribute__((noinline, unused)) \
20 test##id (__m128i s1) \
21 { \
22 return _mm_slli_epi32 (s1, N); \
23 }
24
25 TEST_FUNC(0, 0)
26 TEST_FUNC(15, 15)
27 TEST_FUNC(16, 16)
28 TEST_FUNC(31, 31)
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 int e[4] = {0}; \
38 union128i_d u, s; \
39 int i; \
40 s.x = _mm_set_epi32 (1, -2, 3, 4); \
41 u.x = test##id (s.x); \
42 if (N >= 0 && N < 32) \
43 for (i = 0; i < 4; i++) \
44 e[i] = s.a[i] << (N * (N >= 0)); \
45 if (check_union128i_d (u, e)) \
46 abort (); \
47 }
48
49 static void
TEST(void)50 TEST (void)
51 {
52 TEST_CODE(0, 0);
53 TEST_CODE(15, 15);
54 TEST_CODE(16, 16);
55 TEST_CODE(31, 31);
56 TEST_CODE(neg1, -1);
57 TEST_CODE(neg16, -16);
58 TEST_CODE(neg32, -32);
59 TEST_CODE(neg64, -64);
60 TEST_CODE(neg128, -128);
61 }
62