libstdc++: Make std::basic_format_context non-copyable [PR114387]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-sad.c
blob08f79874e9ca395e5004930672a7fe3466f6a5c6
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_usad_char } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 64
9 #define SAD N*N/2
11 unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12 unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 int abs (int);
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)
22 int i;
23 int result = 0;
25 for (i = 0; i < len; i++)
26 result += abs (X[i] - Y[i]);
28 return result;
32 int
33 main (void)
35 int i;
36 int sad;
38 check_vect ();
40 for (i = 0; i < N; i++)
42 X[i] = i;
43 Y[i] = N - i;
44 __asm__ volatile ("");
47 sad = foo (N);
48 if (sad != SAD)
49 abort ();
51 return 0;
54 /* { dg-final { scan-tree-dump "vect_recog_sad_pattern: detected" "vect" } } */
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */