(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-widen-mult-const-u16.c
       1  /* Disabling epilogues until we find a better way to deal with scans.  */
       2  /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
       3  /* { dg-require-effective-target vect_int } */
       4  /* { dg-additional-options "-fno-ipa-icf" } */
       5  
       6  #include "tree-vect.h"
       7  
       8  #define N 32
       9  
      10  __attribute__ ((noinline)) void 
      11  foo (unsigned int *__restrict a,
      12       unsigned short *__restrict b,
      13       int n)
      14  {
      15    int i;
      16  
      17    for (i = 0; i < n; i++)
      18      a[i] = b[i] * 2333;
      19  
      20    for (i = 0; i < n; i++)
      21      if (a[i] != b[i] * 2333)
      22        abort ();
      23  }
      24  
      25  __attribute__ ((noinline)) void
      26  bar (unsigned int *__restrict a,
      27       unsigned short *__restrict b,
      28       int n)
      29  {
      30    int i;
      31  
      32    for (i = 0; i < n; i++)
      33      a[i] = (unsigned short) 2333 * b[i];
      34  
      35    for (i = 0; i < n; i++)
      36      if (a[i] != b[i] * (unsigned short) 2333)
      37        abort ();
      38  }
      39  
      40  __attribute__ ((noinline)) void
      41  baz (unsigned int *__restrict a,
      42       unsigned short *__restrict b,
      43       int n)
      44  {
      45    int i;
      46  
      47    for (i = 0; i < n; i++)
      48      a[i] = b[i] * 233333333;
      49  
      50    for (i = 0; i < n; i++)
      51      if (a[i] != b[i] * 233333333)
      52        abort ();
      53  }
      54  
      55  
      56  int main (void)
      57  {
      58    int i;
      59    unsigned int a[N];
      60    unsigned short b[N];
      61  
      62    check_vect ();
      63  
      64    for (i = 0; i < N; i++)
      65      {
      66        a[i] = 0;
      67        b[i] = i;
      68        __asm__ volatile ("");
      69      }
      70  
      71    foo (a, b, N);
      72    bar (a, b, N);
      73    baz (a, b, N);
      74    return 0;
      75  }
      76  
      77  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target vect_widen_mult_hi_to_si } } } */
      78  /* { dg-final { scan-tree-dump-times {vect_recog_widen_mult_pattern: detected:[^\n]* 2333} 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
      79  /* { dg-final { scan-tree-dump-times {widen_mult pattern recognized:[^\n]* = \(int\)} 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */