1 #include <complex.h>
2 
add0(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])3 void add0 (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
4 	   _Complex TYPE c[restrict N])
5 {
6 #if defined (UNROLL)
7 #pragma GCC unroll 16
8 #endif
9   for (int i=0; i < N; i++)
10     c[i] = a[i] + b[i];
11 }
12 
add90snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])13 void add90snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
14 	       _Complex TYPE c[restrict N])
15 {
16 #if defined (UNROLL)
17 #pragma GCC unroll 16
18 #endif
19   for (int i=0; i < N; i++)
20     c[i] = a[i] + (b[i] * I);
21 }
22 
23 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */
24 
add180snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])25 void add180snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
26 	        _Complex TYPE c[restrict N])
27 {
28 #if defined (UNROLL)
29 #pragma GCC unroll 16
30 #endif
31   for (int i=0; i < N; i++)
32     c[i] = a[i] + (b[i] * I * I);
33 }
34 
add270snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])35 void add270snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
36 	        _Complex TYPE c[restrict N])
37 {
38 #if defined (UNROLL)
39 #pragma GCC unroll 16
40 #endif
41   for (int i=0; i < N; i++)
42     c[i] = a[i] + (b[i] * I * I * I);
43 }
44 
45 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" } } */
46 
add90fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])47 void add90fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
48 	       _Complex TYPE c[restrict N])
49 {
50 #if defined (UNROLL)
51 #pragma GCC unroll 16
52 #endif
53   for (int i=0; i < N; i++)
54     c[i] = (a[i] * I) + b[i];
55 }
56 
57 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */
58 
add180fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])59 void add180fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
60 	        _Complex TYPE c[restrict N])
61 {
62 #if defined (UNROLL)
63 #pragma GCC unroll 16
64 #endif
65   for (int i=0; i < N; i++)
66     c[i] = (a[i] * I * I) + b[i];
67 }
68 
add270fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])69 void add270fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
70 	        _Complex TYPE c[restrict N])
71 {
72 #if defined (UNROLL)
73 #pragma GCC unroll 16
74 #endif
75   for (int i=0; i < N; i++)
76     c[i] = (a[i] * I * I * I) + b[i];
77 }
78 
79 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" } } */
80 
addconjfst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])81 void addconjfst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
82 		 _Complex TYPE c[restrict N])
83 {
84 #if defined (UNROLL)
85 #pragma GCC unroll 16
86 #endif
87   for (int i=0; i < N; i++)
88     c[i] = ~a[i] + b[i];
89 }
90 
addconjsnd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])91 void addconjsnd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
92 		 _Complex TYPE c[restrict N])
93 {
94 #if defined (UNROLL)
95 #pragma GCC unroll 16
96 #endif
97   for (int i=0; i < N; i++)
98     c[i] = a[i] + ~b[i];
99 }
100 
addconjboth(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])101 void addconjboth (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
102 		  _Complex TYPE c[restrict N])
103 {
104 #if defined (UNROLL)
105 #pragma GCC unroll 16
106 #endif
107   for (int i=0; i < N; i++)
108     c[i] = ~a[i] + ~b[i];
109 }
110