(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
mmx-packs.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O3 -mpower8-vector" } */
       3  /* { dg-require-effective-target p8vector_hw } */
       4  
       5  #define NO_WARN_X86_INTRINSICS 1
       6  #include <mmintrin.h>
       7  #include "mmx-check.h"
       8  
       9  #ifndef TEST
      10  #define TEST mmx_test
      11  #endif
      12  
      13  static void
      14  __attribute__ ((noinline))
      15  check_packs_pu16 (unsigned long long int src1, unsigned long long int src2,
      16                    unsigned long long int res_ref)
      17  {
      18    unsigned long long int res;
      19  
      20    res = (unsigned long long int) _mm_packs_pu16 ((__m64 ) src1, (__m64 ) src2);
      21  
      22    if (res != res_ref)
      23      abort ();
      24  }
      25  
      26  static void
      27  __attribute__ ((noinline))
      28  check_packs_pi16 (unsigned long long int src1, unsigned long long int src2,
      29                    unsigned long long int res_ref)
      30  {
      31    unsigned long long int res;
      32  
      33    res = (unsigned long long int) _mm_packs_pi16 ((__m64 ) src1, (__m64 ) src2);
      34  
      35  
      36    if (res != res_ref)
      37      abort ();
      38  }
      39  
      40  static void
      41  __attribute__ ((noinline))
      42  check_packs_pi32 (unsigned long long int src1, unsigned long long int src2,
      43  		  unsigned long long int res_ref)
      44  {
      45    unsigned long long int res;
      46  
      47    res = (unsigned long long int) _mm_packs_pi32 ((__m64 ) src1, (__m64 ) src2);
      48  
      49    if (res != res_ref)
      50      abort ();
      51  }
      52  
      53  static unsigned long long int src1[] =
      54    { 0xffff0000fffe0000UL, 0x0001000000020000UL, 0xfffffffffffffffeUL,
      55        0x0000000100000002UL, 0x0001000200030004UL, 0xfffffffefffdfffcUL,
      56        0x0100020003000400UL, 0xff00fe01fe02fe03UL };
      57  
      58  static unsigned long long int src2[] =
      59    { 0xfffffffdfffffffcUL, 0x0000000200000003UL, 0xfffffffdfffffffcUL,
      60        0x0000000300000004UL, 0x0005000600070008UL, 0xfffbfffafff9fff8UL,
      61        0x0005000600070008UL, 0xfffbfffafff9fff8UL };
      62  
      63  static unsigned long long int res_pi16[] =
      64    { 0xfffdfffcff00fe00UL, 0x0002000301000200UL, 0xfffdfffcfffffffeUL,
      65        0x0003000400010002UL, 0x0506070801020304UL, 0xfbfaf9f8fffefdfcUL,
      66        0x050607087f7f7f7fUL, 0xfbfaf9f880808080UL };
      67  
      68  static unsigned long long int res_pi32[] =
      69    { 0xfffdfffc80008000UL, 0x000200037fff7fffUL, 0xfffdfffcfffffffeUL,
      70        0x0003000400010002UL, 0x7fff7fff7fff7fffUL, 0x80008000fffe8000UL,
      71        0x7fff7fff7fff7fffUL, 0x8000800080008000UL };
      72  
      73  static unsigned long long int res_pu16[] =
      74    { 0x0000000000000000UL, 0x0002000301000200UL, 0x0000000000000000UL,
      75        0x0003000400010002UL, 0x0506070801020304UL, 0x000000000000000UL,
      76        0x5060708ffffffffUL, 0x0000000000000000UL };
      77  
      78  static void
      79  TEST ()
      80  {
      81    long i;
      82  
      83    for (i = 0; i < 8; i++)
      84      {
      85        check_packs_pu16 (src1[i], src2[i], res_pu16[i]);
      86        check_packs_pi16 (src1[i], src2[i], res_pi16[i]);
      87        check_packs_pi32 (src1[i], src2[i], res_pi32[i]);
      88      }
      89  }
      90