[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr48258-2.c
blob5604fe6716c572e8badb8988ffcc3d61f716731e
1 /* { dg-do compile } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-O3 -mdejagnu-cpu=power7 -mabi=altivec -ffast-math" } */
5 /* { dg-final { scan-assembler "xvadddp" } } */
6 /* { dg-final { scan-assembler "xvmindp" } } */
7 /* { dg-final { scan-assembler "xvmaxdp" } } */
9 #include <stddef.h>
11 #ifndef SIZE
12 #define SIZE 1024
13 #endif
15 double values[SIZE] __attribute__((__aligned__(32)));
17 double
18 vector_sum (void)
20 size_t i;
21 double sum = 0.0;
23 for (i = 0; i < SIZE; i++)
24 sum += values[i];
26 return sum;
29 double
30 vector_min (void)
32 size_t i;
33 double min = values[0];
35 for (i = 0; i < SIZE; i++)
36 min = __builtin_fmin (min, values[i]);
38 return min;
41 double
42 vector_max (void)
44 size_t i;
45 double max = values[0];
47 for (i = 0; i < SIZE; i++)
48 max = __builtin_fmax (max, values[i]);
50 return max;