(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-over-widen-21.c
       1  /* { dg-require-effective-target vect_int } */
       2  /* { dg-require-effective-target vect_shift } */
       3  /* { dg-require-effective-target vect_pack_trunc } */
       4  /* { dg-require-effective-target vect_unpack } */
       5  
       6  #include "tree-vect.h"
       7  
       8  #define N 111
       9  
      10  /* This shouldn't be treated as an over-widening operation: it's better
      11     to reuse the extensions of di and ei for di + ei than to add them
      12     as shorts and introduce a third extension.  */
      13  
      14  void __attribute__ ((noipa))
      15  f (unsigned int *restrict a, unsigned int *restrict b,
      16     unsigned int *restrict c, unsigned char *restrict d,
      17     unsigned char *restrict e)
      18  {
      19    for (__INTPTR_TYPE__ i = 0; i < N; ++i)
      20      {
      21        a[i] = d[i];
      22        b[i] = e[i];
      23        c[i] = d[i] + e[i];
      24      }
      25  }
      26  
      27  int
      28  main (void)
      29  {
      30    check_vect ();
      31  
      32    unsigned int a[N], b[N], c[N];
      33    unsigned char d[N], e[N];
      34    for (int i = 0; i < N; ++i)
      35      {
      36        d[i] = i * 2 + 3;
      37        e[i] = i + 100;
      38        asm volatile ("" ::: "memory");
      39      }
      40    f (a, b, c, d, e);
      41    for (int i = 0; i < N; ++i)
      42      if (a[i] != i * 2 + 3
      43  	|| b[i] != i + 100
      44  	|| c[i] != i * 3 + 103)
      45        __builtin_abort ();
      46  
      47    return 0;
      48  }
      49  
      50  /* { dg-final { scan-tree-dump-not {vect_recog_over_widening_pattern: detected} "vect" } } */
      51  /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */