1 /* { dg-do compile { target { powerpc64*-*-* } } } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O2 -ftree-vectorize" } */
4
5 /* Verify that we can optimize a vector conditional move, where one of the arms
6 is all 1's into using the mask as one of the inputs to XXSEL. */
7
8 #include <altivec.h>
9
10 static int a[1024], b[1024], c[1024];
11
12 int *p_a = a, *p_b = b, *p_c = c;
13
14 void
test(void)15 test (void)
16 {
17 unsigned long i;
18
19 for (i = 0; i < 1024; i++)
20 a[i] = (b[i] == c[i]) ? -1 : a[i];
21 }
22
23 /* { dg-final { scan-assembler {\mvcmpequw\M} } } */
24 /* { dg-final { scan-assembler {\mxxsel\M} } } */
25 /* { dg-final { scan-assembler-not {\mvspltisw\M} } } */
26 /* { dg-final { scan-assembler-not {\mxxlorc\M} } } */
27