testsuite: Revert to the original version of pr100056.c
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-7.c
blobe796e6ba216c098dcea78d15a0662be15fb4b736
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "--param max-completely-peel-times=1" } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #if VECTOR_BITS > 256
8 #define N (VECTOR_BITS / 16)
9 #else
10 #define N 16
11 #endif
13 unsigned short in[N];
14 unsigned short coef[N];
15 unsigned short a[N];
17 __attribute__ ((noinline)) unsigned int
18 foo (short scale){
19 int i;
20 unsigned short j;
21 unsigned int sum = 0;
22 unsigned short sum_j;
24 for (i = 0; i < N; i++) {
25 sum_j = 0;
26 for (j = 0; j < N; j++) {
27 sum_j += j;
29 a[i] = sum_j;
30 sum += ((unsigned int) in[i] * (unsigned int) coef[i]) >> scale;
32 return sum;
35 unsigned short
36 bar (void)
38 unsigned short j;
39 unsigned short sum_j;
41 sum_j = 0;
42 for (j = 0; j < N; j++) {
43 sum_j += j;
46 return sum_j;
49 int main (void)
51 int i;
52 unsigned short j, sum_j;
53 unsigned int sum = 0;
54 unsigned int res;
56 check_vect ();
58 for (i=0; i<N; i++){
59 in[i] = 2*i;
60 coef[i] = i;
63 res = foo (2);
65 /* check results: */
66 #pragma GCC novector
67 for (i=0; i<N; i++)
69 if (a[i] != bar ())
70 abort ();
71 sum += ((unsigned int) in[i] * (unsigned int) coef[i]) >> 2;
73 if (res != sum)
74 abort ();
76 return 0;
79 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { target vect_widen_mult_hi_to_si } } } */
80 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target vect_widen_mult_hi_to_si } } } */