(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
conv-vectorize-2.c
       1  /* { dg-require-effective-target powerpc_vsx_ok } */
       2  /* { dg-options "-O2 -ftree-vectorize -mvsx -fno-vect-cost-model" } */
       3  
       4  /* Test vectorizer can exploit vector conversion instructions to convert
       5     float to unsigned/signed long long.  */
       6  
       7  #include <stddef.h>
       8  
       9  #define SIZE 32
      10  #define ALIGN 16
      11  
      12  float sflt_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
      13  float uflt_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
      14  
      15  unsigned long long ulong_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
      16  signed long long slong_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
      17  
      18  void
      19  convert_float_to_slong (void)
      20  {
      21    size_t i;
      22  
      23    for (i = 0; i < SIZE; i++)
      24      slong_array[i] = (signed long long) sflt_array[i];
      25  }
      26  
      27  void
      28  convert_float_to_ulong (void)
      29  {
      30    size_t i;
      31  
      32    for (i = 0; i < SIZE; i++)
      33      ulong_array[i] = (unsigned long long) uflt_array[i];
      34  }
      35  
      36  /* { dg-final { scan-assembler {\mxvcvspsxds\M} } } */
      37  /* { dg-final { scan-assembler {\mxvcvspuxds\M} } } */