Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-vector-2.c
blobfb26ead3ee637ea8b13a9a2db7e1f7e1bcf67766
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 "xvaddsp" } } */
7 /* { dg-final { scan-assembler "xvsubsp" } } */
8 /* { dg-final { scan-assembler "xvmulsp" } } */
9 /* { dg-final { scan-assembler "xvdivsp" } } */
10 /* { dg-final { scan-assembler "vmadd" } } */
11 /* { dg-final { scan-assembler "xvmsub" } } */
12 /* { dg-final { scan-assembler "xvrsqrtesp" } } */
13 /* { dg-final { scan-assembler "xvcpsgnsp" } } */
14 /* { dg-final { scan-assembler "xvrspim" } } */
15 /* { dg-final { scan-assembler "xvrspip" } } */
16 /* { dg-final { scan-assembler "xvrspiz" } } */
17 /* { dg-final { scan-assembler "xvrspic" } } */
18 /* { dg-final { scan-assembler "xvrspi " } } */
20 #ifndef SIZE
21 #define SIZE 1024
22 #endif
24 float a[SIZE] __attribute__((__aligned__(32)));
25 float b[SIZE] __attribute__((__aligned__(32)));
26 float c[SIZE] __attribute__((__aligned__(32)));
27 float d[SIZE] __attribute__((__aligned__(32)));
28 float 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 float sqrtf (float);
85 extern float floorf (float);
86 extern float ceilf (float);
87 extern float truncf (float);
88 extern float nearbyintf (float);
89 extern float rintf (float);
90 extern float copysignf (float, float);
92 void
93 vector_sqrt (void)
95 int i;
97 for (i = 0; i < SIZE; i++)
98 a[i] = sqrtf (b[i]);
101 void
102 vector_floor (void)
104 int i;
106 for (i = 0; i < SIZE; i++)
107 a[i] = floorf (b[i]);
110 void
111 vector_ceil (void)
113 int i;
115 for (i = 0; i < SIZE; i++)
116 a[i] = ceilf (b[i]);
119 void
120 vector_trunc (void)
122 int i;
124 for (i = 0; i < SIZE; i++)
125 a[i] = truncf (b[i]);
128 void
129 vector_nearbyint (void)
131 int i;
133 for (i = 0; i < SIZE; i++)
134 a[i] = nearbyintf (b[i]);
137 void
138 vector_rint (void)
140 int i;
142 for (i = 0; i < SIZE; i++)
143 a[i] = rintf (b[i]);
146 void
147 vector_copysign (void)
149 int i;
151 for (i = 0; i < SIZE; i++)
152 a[i] = copysignf (b[i], c[i]);