PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-const-u16.c
blobbe66e71ebe76d4a5f055d2a87a025824f40b4749
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fno-ipa-icf" } */
4 #include "tree-vect.h"
6 #define N 32
8 __attribute__ ((noinline)) void
9 foo (unsigned int *__restrict a,
10 unsigned short *__restrict b,
11 int n)
13 int i;
15 for (i = 0; i < n; i++)
16 a[i] = b[i] * 2333;
18 for (i = 0; i < n; i++)
19 if (a[i] != b[i] * 2333)
20 abort ();
23 __attribute__ ((noinline)) void
24 bar (unsigned int *__restrict a,
25 unsigned short *__restrict b,
26 int n)
28 int i;
30 for (i = 0; i < n; i++)
31 a[i] = (unsigned short) 2333 * b[i];
33 for (i = 0; i < n; i++)
34 if (a[i] != b[i] * (unsigned short) 2333)
35 abort ();
38 __attribute__ ((noinline)) void
39 baz (unsigned int *__restrict a,
40 unsigned short *__restrict b,
41 int n)
43 int i;
45 for (i = 0; i < n; i++)
46 a[i] = b[i] * 233333333;
48 for (i = 0; i < n; i++)
49 if (a[i] != b[i] * 233333333)
50 abort ();
54 int main (void)
56 int i;
57 unsigned int a[N];
58 unsigned short b[N];
60 check_vect ();
62 for (i = 0; i < N; i++)
64 a[i] = 0;
65 b[i] = i;
66 __asm__ volatile ("");
69 foo (a, b, N);
70 bar (a, b, N);
71 baz (a, b, N);
72 return 0;
75 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target vect_widen_mult_hi_to_si } } } */
76 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
77 /* { dg-final { scan-tree-dump-times "widen_mult pattern recognized" 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */