1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
3 
4 #define DEF_LOOP(TYPE, ABS, NAME, OP)			\
5   void							\
6   test_##TYPE##_##NAME (TYPE *restrict r,		\
7 			TYPE *restrict a,		\
8 			TYPE *restrict b, int n)	\
9   {							\
10     for (int i = 0; i < n; ++i)				\
11       r[i] = ABS (a[i]) OP ABS (b[i]) ? 1.0 : 0.0;	\
12   }
13 
14 #define TEST_TYPE(T, TYPE, ABS)			\
15   T (TYPE, ABS, lt, <)				\
16   T (TYPE, ABS, le, <=)				\
17   T (TYPE, ABS, ge, >=)				\
18   T (TYPE, ABS, gt, >)
19 
20 #define TEST_ALL(T)				\
21   TEST_TYPE (T, _Float16, __builtin_fabsf16)	\
22   TEST_TYPE (T, float, __builtin_fabsf)		\
23   TEST_TYPE (T, double, __builtin_fabs)
24 
25 TEST_ALL (DEF_LOOP)
26 
27 /* { dg-final { scan-assembler-times {\tfac[lg]t\tp[0-9]+\.h, p[0-7]/z, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
28 /* { dg-final { scan-assembler-times {\tfac[lg]e\tp[0-9]+\.h, p[0-7]/z, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
29 
30 /* { dg-final { scan-assembler-times {\tfac[lg]t\tp[0-9]+\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
31 /* { dg-final { scan-assembler-times {\tfac[lg]e\tp[0-9]+\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
32 
33 /* { dg-final { scan-assembler-times {\tfac[lg]t\tp[0-9]+\.d, p[0-7]/z, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
34 /* { dg-final { scan-assembler-times {\tfac[lg]e\tp[0-9]+\.d, p[0-7]/z, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
35