PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-half.c
blob3fb162de79a22034a19393d7ea2dfb9ca24b0929
1 /* { dg-require-effective-target vect_int } */
3 #include "tree-vect.h"
4 #include <stdlib.h>
6 #define N 32
7 #define COEF 32470
8 #define COEF2 324700
10 unsigned char in[N];
11 int out[N];
12 int out2[N];
14 __attribute__ ((noinline)) void
15 foo (int a)
17 int i;
19 for (i = 0; i < N; i++)
21 out[i] = in[i] * COEF;
22 out2[i] = in[i] + a;
26 int main (void)
28 int i;
30 for (i = 0; i < N; i++)
32 in[i] = i;
33 __asm__ volatile ("");
36 foo (COEF2);
38 for (i = 0; i < N; i++)
39 if (out[i] != in[i] * COEF || out2[i] != in[i] + COEF2)
40 abort ();
42 return 0;
45 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_hi_to_si } } } */
46 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
47 /* { dg-final { scan-tree-dump-times "pattern recognized" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
48 /* { dg-final { cleanup-tree-dump "vect" } } */