1 /* { dg-require-effective-target vect_int } */
2 
3 #include "tree-vect.h"
4 
5 #define N 32
6 #define COEF 32470
7 #define COEF2 324700
8 
9 unsigned char in[N];
10 int out[N];
11 int out2[N];
12 
13 __attribute__ ((noinline)) void
foo(int a)14 foo (int a)
15 {
16   int i;
17 
18   for (i = 0; i < N; i++)
19     {
20       out[i] = in[i] * COEF;
21       out2[i] = in[i] + a;
22     }
23 }
24 
main(void)25 int main (void)
26 {
27   int i;
28 
29   check_vect ();
30 
31   for (i = 0; i < N; i++)
32     {
33       in[i] = i;
34       __asm__ volatile ("");
35     }
36 
37   foo (COEF2);
38 
39   for (i = 0; i < N; i++)
40     if (out[i] != in[i] * COEF || out2[i] != in[i] + COEF2)
41       abort ();
42 
43   return 0;
44 }
45 
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_hi_to_si } } } */
47 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
48 /* { dg-final { scan-tree-dump-times "pattern recognized" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
49 
50