1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-tree-optimized" } */
3
4 /* This test does not work when the truth type does not match vector type. */
5 /* { dg-additional-options "-mno-avx512f" { target { i?86-*-* x86_64-*-* } } } */
6 /* { dg-additional-options "-march=armv8-a" { target aarch64_sve } } */
7 /* { dg-additional-options "-maltivec" { target powerpc_altivec_ok } } */
8 /* { dg-skip-if "no fallback for MVE" { arm_mve } } */
9
10 #include <stdint.h>
11
12 void fun1(int32_t *x, int n)
13 {
14 for (int i = 0; i < (n & -16); i++)
15 x[i] = (-x[i]) >> 31;
16 }
17
18 void fun2(int32_t *x, int n)
19 {
20 for (int i = 0; i < (n & -16); i++)
21 x[i] = (-x[i]) >> 30;
22 }
23
24 /* Xfail amdgcn where vector truth type is not integer type. */
25 /* { dg-final { scan-tree-dump {\s+>\s+\{ 0(, 0)+ \}} optimized { target vect_shift xfail amdgcn-*-* } } } */
26 /* { dg-final { scan-tree-dump {\s+>\s+0} optimized { target { ! vect_shift } } } } */
27 /* { dg-final { scan-tree-dump-not {\s+>>\s+31} optimized { xfail amdgcn-*-* } } } */