1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
3 
4 #include "vcond_13.c"
5 
6 #define TEST_LOOP(INV, TYPE, CMPTYPE, SUFFIX)		\
7   {							\
8     TYPE a[N], b[N], c[N], d[N];			\
9     CMPTYPE cond[N];					\
10     for (int i = 0; i < N; ++i)				\
11       {							\
12 	b[i] = i % 15;					\
13 	c[i] = i % 9 + 11;				\
14 	d[i] = i % 13 + 14;				\
15 	cond[i] = i % 17;				\
16 	asm volatile ("" ::: "memory");			\
17       }							\
18     f_##INV##_##SUFFIX (a, b, c, d, cond);		\
19     for (int i = 0; i < N; ++i)				\
20       {							\
21 	double mb = (INV & 1 ? -b[i] : b[i]);		\
22 	double mc = c[i];				\
23 	double md = (INV & 2 ? -d[i] : d[i]);		\
24 	double fma = __builtin_fma (mb, mc, md);	\
25 	double truev = (INV & 4 ? -fma : fma);		\
26 	if (a[i] != (i % 17 < 10 ? truev : b[i]))	\
27 	  __builtin_abort ();				\
28 	asm volatile ("" ::: "memory");			\
29       }							\
30   }
31 
32 int
main(void)33 main (void)
34 {
35   FOR_EACH_INV (TEST_LOOP)
36   return 0;
37 }
38