1 /* { dg-require-effective-target vect_usad_char } */
5 typedef unsigned int uint32_t;
6 typedef unsigned short uint16_t;
7 typedef unsigned char uint8_t;
10 extern void abort (void);
12 int __attribute__((noinline
,noclone
))
13 foo (uint8_t *pix1
, uint8_t *pix2
, int i_stride_pix2
)
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] );
35 pix2
+= i_stride_pix2
;
48 for (int i
= 0; i
< 16*16; ++i
)
52 __asm__
volatile ("");
55 if (foo (X
, Y
, 16) != 32512)
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" } } */