1 /* { dg-do run { target { powerpc*-*-linux* && { lp64 && p9vector_hw } } } } */
2 /* { dg-require-effective-target powerpc_p9vector_ok } */
3 /* { dg-options "-O3 -mcpu=power9" } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
6 /* Verify that we get correct code when we vectorize this SAD loop using
10 extern int abs (int __x
) __attribute__ ((__nothrow__
, __leaf__
)) __attribute__ ((__const__
));
13 foo (unsigned char *w
, int i
, unsigned char *x
, int j
)
16 for (int a
= 0; a
< 16; a
++)
18 for (int b
= 0; b
< 16; b
++)
19 tot
+= abs (w
[b
] - x
[b
]);
27 bar (unsigned char *w
, unsigned char *x
, int i
, int *result
)
29 *result
= foo (w
, 16, x
, i
);
39 for (i
= 0; i
< 256; ++i
)
42 m
[i
] = (i
% 8) * 2 + 1;
47 m
[i
] = -((i
% 8) * 2 + 2);
48 n
[i
] = -((i
% 8) >> 1);