comparison gcc/testsuite/gcc.dg/vect/vect-cond-arith-3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* { dg-require-effective-target scalar_all_fma } */
2 /* { dg-additional-options "-fdump-tree-optimized" } */
3
4 #include "tree-vect.h"
5
6 #define N (VECTOR_BITS * 11 / 64 + 3)
7
8 #define DEF(INV) \
9 void __attribute__ ((noipa)) \
10 f_##INV (double *restrict a, double *restrict b, \
11 double *restrict c, double *restrict d) \
12 { \
13 for (int i = 0; i < N; ++i) \
14 { \
15 double mb = (INV & 1 ? -b[i] : b[i]); \
16 double mc = c[i]; \
17 double md = (INV & 2 ? -d[i] : d[i]); \
18 double fma = __builtin_fma (mb, mc, md); \
19 double truev = (INV & 4 ? -fma : fma); \
20 a[i] = b[i] < 10 ? truev : 10.0; \
21 } \
22 }
23
24 #define TEST(INV) \
25 { \
26 f_##INV (a, b, c, d); \
27 for (int i = 0; i < N; ++i) \
28 { \
29 double mb = (INV & 1 ? -b[i] : b[i]); \
30 double mc = c[i]; \
31 double md = (INV & 2 ? -d[i] : d[i]); \
32 double fma = __builtin_fma (mb, mc, md); \
33 double truev = (INV & 4 ? -fma : fma); \
34 if (a[i] != (i % 17 < 10 ? truev : 10.0)) \
35 __builtin_abort (); \
36 asm volatile ("" ::: "memory"); \
37 } \
38 }
39
40 #define FOR_EACH_INV(T) \
41 T (0) T (1) T (2) T (3) T (4) T (5) T (6) T (7)
42
43 FOR_EACH_INV (DEF)
44
45 int
46 main (void)
47 {
48 double a[N], b[N], c[N], d[N];
49 for (int i = 0; i < N; ++i)
50 {
51 b[i] = i % 17;
52 c[i] = i % 9 + 11;
53 d[i] = i % 13 + 14;
54 asm volatile ("" ::: "memory");
55 }
56 FOR_EACH_INV (TEST)
57 return 0;
58 }
59
60 /* { dg-final { scan-tree-dump-times { = \.COND_FMA } 2 "optimized" { target vect_double_cond_arith } } } */
61 /* { dg-final { scan-tree-dump-times { = \.COND_FMS } 2 "optimized" { target vect_double_cond_arith } } } */
62 /* { dg-final { scan-tree-dump-times { = \.COND_FNMA } 2 "optimized" { target vect_double_cond_arith } } } */
63 /* { dg-final { scan-tree-dump-times { = \.COND_FNMS } 2 "optimized" { target vect_double_cond_arith } } } */