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_psllq_1
      13  #endif
      14  
      15  #include <emmintrin.h>
      16  
      17  #ifdef _ARCH_PWR8
      18  #define TEST_FUNC(id, N) \
      19    static __m128i \
      20    __attribute__((noinline, unused)) \
      21    test##id (__m128i s1) \
      22    { \
      23      return _mm_slli_epi64 (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(63, 63)
      31  TEST_FUNC(neg1, -1)
      32  TEST_FUNC(neg16, -16)
      33  TEST_FUNC(neg32, -32)
      34  TEST_FUNC(neg64, -64)
      35  TEST_FUNC(neg128, -128)
      36  #endif
      37  
      38  #define TEST_CODE(id, N) \
      39    { \
      40      union128i_q u, s; \
      41      long long e[2] = {0}; \
      42      int i; \
      43      s.x = _mm_set_epi64x (-1, 0xf); \
      44      u.x = test##id (s.x); \
      45      if (N >= 0 && N < 64) \
      46        for (i = 0; i < 2; i++) \
      47          e[i] = s.a[i] << (N * (N >= 0)); \
      48      if (check_union128i_q (u, e)) \
      49        abort (); \
      50    }
      51  
      52  static void
      53  TEST (void)
      54  {
      55  #ifdef _ARCH_PWR8
      56    TEST_CODE(0, 0);
      57    TEST_CODE(15, 15);
      58    TEST_CODE(16, 16);
      59    TEST_CODE(31, 31);
      60    TEST_CODE(63, 63);
      61    TEST_CODE(neg1, -1);
      62    TEST_CODE(neg16, -16);
      63    TEST_CODE(neg32, -32);
      64    TEST_CODE(neg64, -64);
      65    TEST_CODE(neg128, -128);
      66  #endif
      67  }