[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr48258-1.c
blobeecf135b5bf227debff69276bbd681c9fb27f0bf
1 /* { dg-do compile } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-skip-if "" { powerpc*le-*-* } } */
4 /* { dg-require-effective-target powerpc_vsx_ok } */
5 /* { dg-options "-O3 -mdejagnu-cpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */
6 /* { dg-final { scan-assembler-times "xvaddsp" 3 } } */
7 /* { dg-final { scan-assembler-times "xvminsp" 3 } } */
8 /* { dg-final { scan-assembler-times "xvmaxsp" 3 } } */
9 /* { dg-final { scan-assembler-times "xxsldwi" 6 } } */
10 /* { dg-final { scan-assembler-times "xscvspdp" 3 } } */
11 /* { dg-final { scan-assembler-not "stvewx" } } */
12 /* { dg-final { scan-assembler-not "stvx" } } */
13 /* { dg-final { scan-assembler-not "stxvd2x" } } */
14 /* { dg-final { scan-assembler-not "stxvw4x" } } */
16 #include <stddef.h>
18 #ifndef SIZE
19 #define SIZE 1024
20 #endif
22 float values[SIZE] __attribute__((__aligned__(32)));
24 float
25 vector_sum (void)
27 size_t i;
28 float sum = 0.0f;
30 for (i = 0; i < SIZE; i++)
31 sum += values[i];
33 return sum;
36 float
37 vector_min (void)
39 size_t i;
40 float min = values[0];
42 for (i = 0; i < SIZE; i++)
43 min = __builtin_fminf (min, values[i]);
45 return min;
48 float
49 vector_max (void)
51 size_t i;
52 float max = values[0];
54 for (i = 0; i < SIZE; i++)
55 max = __builtin_fmaxf (max, values[i]);
57 return max;