SVE Intrinsics: Change return type of redirect_call to gcall.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-arith-4.c
blob7d26dbedc5e45c1a09e972d3c4eb31d9424e1513
1 /* { dg-additional-options "-fdump-tree-optimized" } */
3 #include "tree-vect.h"
5 #define N (VECTOR_BITS * 11 / 64 + 3)
7 #define add(A, B) ((A) + (B))
8 #define sub(A, B) ((A) - (B))
9 #define mul(A, B) ((A) * (B))
10 #define div(A, B) ((A) / (B))
12 #define DEF(OP) \
13 void __attribute__ ((noipa)) \
14 f_##OP (double *restrict a, double *restrict b, double x) \
15 { \
16 for (int i = 0; i < N; ++i) \
17 a[i] = b[i] < 100 ? OP (b[i], x) : b[i]; \
20 #define TEST(OP) \
21 { \
22 f_##OP (a, b, 10); \
23 _Pragma("GCC novector") \
24 for (int i = 0; i < N; ++i) \
25 { \
26 int bval = (i % 17) * 10; \
27 int truev = OP (bval, 10); \
28 if (a[i] != (bval < 100 ? truev : bval)) \
29 __builtin_abort (); \
30 asm volatile ("" ::: "memory"); \
31 } \
34 #define FOR_EACH_OP(T) \
35 T (add) \
36 T (sub) \
37 T (mul) \
38 T (div)
40 FOR_EACH_OP (DEF)
42 int
43 main (void)
45 double a[N], b[N];
46 for (int i = 0; i < N; ++i)
48 b[i] = (i % 17) * 10;
49 asm volatile ("" ::: "memory");
51 FOR_EACH_OP (TEST)
52 return 0;
55 /* { dg-final { scan-tree-dump { = \.COND_(LEN_)?ADD} "optimized" { target vect_double_cond_arith } } } */
56 /* { dg-final { scan-tree-dump { = \.COND_(LEN_)?SUB} "optimized" { target vect_double_cond_arith } } } */
57 /* { dg-final { scan-tree-dump { = \.COND_(LEN_)?MUL} "optimized" { target vect_double_cond_arith } } } */
58 /* { dg-final { scan-tree-dump { = \.COND_(LEN_)?RDIV} "optimized" { target vect_double_cond_arith } } } */
59 /* { dg-final { scan-tree-dump-not {VEC_COND_EXPR} "optimized" { target vect_double_cond_arith } } } */