(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
sse2-pshuflw-1.c
       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_pshuflw_1
      13  #endif
      14  
      15  #define N 0xec
      16  
      17  #include <emmintrin.h>
      18  
      19  static __m128i
      20  __attribute__((noinline, unused))
      21  test (__m128i s1)
      22  {
      23    return _mm_shufflelo_epi16 (s1, N); 
      24  }
      25  
      26  static void
      27  TEST (void)
      28  {
      29    union128i_w s1, u;
      30    short  e[8] = { 0 };
      31    int i;
      32    int m1[4] = { 0x3, 0x3<<2, 0x3<<4, 0x3<<6 };
      33    int m2[4];
      34    
      35    s1.x = _mm_set_epi16 (0, 0, 0xa, 0xbcde, 0, 0, 0xef58, 0xa234);
      36    u.x = test (s1.x);
      37  
      38    for (i = 0; i < 4; i++)
      39      e[i + 4] = s1.a[i + 4];
      40  
      41    for (i = 0; i < 4; i++) {
      42      int i2 = i;
      43  #ifdef __LITTLE_ENDIAN__
      44      i2 = 3 - i;
      45  #endif
      46      m2[i2] = (N & m1[i2]) >> (2 * i2);
      47    }
      48  
      49    for (i = 0; i < 4; i++)
      50      e[i] = s1.a[m2[i]];
      51  
      52    if (check_union128i_w(u, e))
      53      {
      54  #if DEBUG
      55        union128i_w s;
      56        s.x = s1.x;
      57        printf ("sse2_test_pshuflw_1; check_union128i_w failed\n");
      58        printf ("\t ([%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx])\n", s.a[0], s.a[1],
      59  	      s.a[2], s.a[3], s.a[4], s.a[5], s.a[6], s.a[7]);
      60        printf ("\t\t -> [%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx]\n", u.a[0], u.a[1],
      61  	      u.a[2], u.a[3], u.a[4], u.a[5], u.a[6], u.a[7]);
      62        printf ("\t expect [%hx,%hx,%hx,%hx, %hx,%hx,%hx,%hx]\n", e[0], e[1],
      63  	      e[2], e[3], e[4], e[5], e[6], e[7]);
      64  #endif
      65        abort ();
      66      }
      67  }