LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-reduc-sad.c
blobd921c7cd65dafe7480664a74c312e01416e48efe
1 /* { dg-require-effective-target vect_usad_char } */
3 #include "tree-vect.h"
5 typedef unsigned int uint32_t;
6 typedef unsigned short uint16_t;
7 typedef unsigned char uint8_t;
9 extern int abs (int);
10 extern void abort (void);
12 int __attribute__((noinline,noclone))
13 foo (uint8_t *pix1, uint8_t *pix2, int i_stride_pix2)
15 int i_sum = 0;
16 for( int y = 0; y < 16; y++ )
18 i_sum += abs ( pix1[0] - pix2[0] );
19 i_sum += abs ( pix1[1] - pix2[1] );
20 i_sum += abs ( pix1[2] - pix2[2] );
21 i_sum += abs ( pix1[3] - pix2[3] );
22 i_sum += abs ( pix1[4] - pix2[4] );
23 i_sum += abs ( pix1[5] - pix2[5] );
24 i_sum += abs ( pix1[6] - pix2[6] );
25 i_sum += abs ( pix1[7] - pix2[7] );
26 i_sum += abs ( pix1[8] - pix2[8] );
27 i_sum += abs ( pix1[9] - pix2[9] );
28 i_sum += abs ( pix1[10] - pix2[10] );
29 i_sum += abs ( pix1[11] - pix2[11] );
30 i_sum += abs ( pix1[12] - pix2[12] );
31 i_sum += abs ( pix1[13] - pix2[13] );
32 i_sum += abs ( pix1[14] - pix2[14] );
33 i_sum += abs ( pix1[15] - pix2[15] );
34 pix1 += 16;
35 pix2 += i_stride_pix2;
37 return i_sum;
40 int
41 main ()
43 check_vect ();
45 uint8_t X[16*16];
46 uint8_t Y[16*16];
48 for (int i = 0; i < 16*16; ++i)
50 X[i] = i;
51 Y[i] = 16*16 - i;
52 __asm__ volatile ("");
55 if (foo (X, Y, 16) != 32512)
56 abort ();
58 return 0;
61 /* { dg-final { scan-tree-dump "vect_recog_sad_pattern: detected" "vect" } } */
62 /* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */