[testsuite] Fix directives order
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-vector-1.c
blob903a4343696abb7cd0a9d81285671d2a5b97076d
1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
5 /* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -ffast-math" } */
6 /* { dg-final { scan-assembler "xvadddp" } } */
7 /* { dg-final { scan-assembler "xvsubdp" } } */
8 /* { dg-final { scan-assembler "xvmuldp" } } */
9 /* { dg-final { scan-assembler "xvdivdp" } } */
10 /* { dg-final { scan-assembler "xvmadd" } } */
11 /* { dg-final { scan-assembler "xvmsub" } } */
12 /* { dg-final { scan-assembler "xvsqrtdp" } } */
13 /* { dg-final { scan-assembler "xvcpsgndp" } } */
14 /* { dg-final { scan-assembler "xvrdpim" } } */
15 /* { dg-final { scan-assembler "xvrdpip" } } */
16 /* { dg-final { scan-assembler "xvrdpiz" } } */
17 /* { dg-final { scan-assembler "xvrdpic" } } */
18 /* { dg-final { scan-assembler "xvrdpi " } } */
20 #ifndef SIZE
21 #define SIZE 1024
22 #endif
24 double a[SIZE] __attribute__((__aligned__(32)));
25 double b[SIZE] __attribute__((__aligned__(32)));
26 double c[SIZE] __attribute__((__aligned__(32)));
27 double d[SIZE] __attribute__((__aligned__(32)));
28 double e[SIZE] __attribute__((__aligned__(32)));
30 void
31 vector_add (void)
33 int i;
35 for (i = 0; i < SIZE; i++)
36 a[i] = b[i] + c[i];
39 void
40 vector_subtract (void)
42 int i;
44 for (i = 0; i < SIZE; i++)
45 a[i] = b[i] - c[i];
48 void
49 vector_multiply (void)
51 int i;
53 for (i = 0; i < SIZE; i++)
54 a[i] = b[i] * c[i];
57 void
58 vector_multiply_add (void)
60 int i;
62 for (i = 0; i < SIZE; i++)
63 a[i] = (b[i] * c[i]) + d[i];
66 void
67 vector_multiply_subtract (void)
69 int i;
71 for (i = 0; i < SIZE; i++)
72 a[i] = (b[i] * c[i]) - d[i];
75 void
76 vector_divide (void)
78 int i;
80 for (i = 0; i < SIZE; i++)
81 a[i] = b[i] / c[i];
84 extern double sqrt (double);
85 extern double floor (double);
86 extern double ceil (double);
87 extern double trunc (double);
88 extern double nearbyint (double);
89 extern double rint (double);
90 extern double copysign (double, double);
92 void
93 vector_sqrt (void)
95 int i;
97 for (i = 0; i < SIZE; i++)
98 a[i] = sqrt (b[i]);
101 void
102 vector_floor (void)
104 int i;
106 for (i = 0; i < SIZE; i++)
107 a[i] = floor (b[i]);
110 void
111 vector_ceil (void)
113 int i;
115 for (i = 0; i < SIZE; i++)
116 a[i] = ceil (b[i]);
119 void
120 vector_trunc (void)
122 int i;
124 for (i = 0; i < SIZE; i++)
125 a[i] = trunc (b[i]);
128 void
129 vector_nearbyint (void)
131 int i;
133 for (i = 0; i < SIZE; i++)
134 a[i] = nearbyint (b[i]);
137 void
138 vector_rint (void)
140 int i;
142 for (i = 0; i < SIZE; i++)
143 a[i] = rint (b[i]);
146 void
147 vector_copysign (void)
149 int i;
151 for (i = 0; i < SIZE; i++)
152 a[i] = copysign (b[i], c[i]);