1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-additional-options "-msse4.2" { target { x86_64-*-* i?86-*-* } } } */
4 /* { dg-require-effective-target vect_usad_char } */
11 unsigned char X
[N
] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__
)));
12 unsigned char Y
[N
] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__
)));
15 /* Sum of absolute differences between arrays of unsigned char types.
16 Detected as a sad pattern.
17 Vectorized on targets that support sad for unsigned chars. */
19 __attribute__ ((noinline
)) int
20 foo (int len
, int *res2
)
26 for (i
= 0; i
< len
; i
++)
28 /* Make sure we are not using an SLP reduction for this. */
29 result
+= abs (X
[2*i
] - Y
[2*i
]);
30 result2
+= abs (X
[2*i
+ 1] - Y
[2*i
+ 1]);
46 for (i
= 0; i
< N
/2; i
++)
52 __asm__
volatile ("");
57 sad
= foo (N
/2, &sad2
);
58 if (sad
!= (N
/2)*(N
/4))
60 if (sad2
!= (N
/2-1)*(N
/2)/2)
66 /* { dg-final { scan-tree-dump "vect_recog_sad_pattern: detected" "vect" } } */
67 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */