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   for (int i=0; i < N; i++)
7     c[i] = a[i] + b[i];
8 }
9 
add90snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])10 void add90snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
11 	       _Complex TYPE c[restrict N])
12 {
13   for (int i=0; i < N; i++)
14     c[i] = a[i] + (b[i] * I);
15 }
16 
17 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */
18 
add180snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])19 void add180snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
20 	        _Complex TYPE c[restrict N])
21 {
22   for (int i=0; i < N; i++)
23     c[i] = a[i] + (b[i] * I * I);
24 }
25 
add270snd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])26 void add270snd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
27 	        _Complex TYPE c[restrict N])
28 {
29   for (int i=0; i < N; i++)
30     c[i] = a[i] + (b[i] * I * I * I);
31 }
32 
33 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" } } */
34 
add90fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])35 void add90fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
36 	       _Complex TYPE c[restrict N])
37 {
38   for (int i=0; i < N; i++)
39     c[i] = (a[i] * I) + b[i];
40 }
41 
42 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */
43 
add180fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])44 void add180fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
45 	        _Complex TYPE c[restrict N])
46 {
47   for (int i=0; i < N; i++)
48     c[i] = (a[i] * I * I) + b[i];
49 }
50 
add270fst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])51 void add270fst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
52 	        _Complex TYPE c[restrict N])
53 {
54   for (int i=0; i < N; i++)
55     c[i] = (a[i] * I * I * I) + b[i];
56 }
57 
58 /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" } } */
59 
addconjfst(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])60 void addconjfst (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
61 		 _Complex TYPE c[restrict N])
62 {
63   for (int i=0; i < N; i++)
64     c[i] = ~a[i] + b[i];
65 }
66 
addconjsnd(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])67 void addconjsnd (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
68 		 _Complex TYPE c[restrict N])
69 {
70   for (int i=0; i < N; i++)
71     c[i] = a[i] + ~b[i];
72 }
73 
addconjboth(_Complex TYPE a[restrict N],_Complex TYPE b[restrict N],_Complex TYPE c[restrict N])74 void addconjboth (_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
75 		  _Complex TYPE c[restrict N])
76 {
77   for (int i=0; i < N; i++)
78     c[i] = ~a[i] + ~b[i];
79 }
80