1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target powerpc_fprs } */
3 /* { dg-options "-O3 -ftree-vectorize -mrecip -ffast-math -mdejagnu-cpu=power7 -fno-unroll-loops" } */
4 /* { dg-final { scan-assembler-times "xvrsqrtedp" 1 } } */
5 /* { dg-final { scan-assembler-times "xvmuldp" 2 } } */
6 /* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */
7 /* { dg-final { scan-assembler-times "xvmadd.dp" 3 } } */
8 /* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */
9 /* { dg-final { scan-assembler-times "xvmulsp" 2 } } */
10 /* { dg-final { scan-assembler-times "xvnmsub.sp" 1 } } */
11 /* { dg-final { scan-assembler-times "xvmadd.sp" 1 } } */
12
13 #define SIZE 1024
14
15 extern double a_d[SIZE] __attribute__((__aligned__(32)));
16 extern double b_d[SIZE] __attribute__((__aligned__(32)));
17
18 void
19 vectorize_rsqrt_d (void)
20 {
21 int i;
22
23 for (i = 0; i < SIZE; i++)
24 a_d[i] = 1.0 / __builtin_sqrt (b_d[i]);
25 }
26
27 extern float a_f[SIZE] __attribute__((__aligned__(32)));
28 extern float b_f[SIZE] __attribute__((__aligned__(32)));
29
30 void
31 vectorize_rsqrt_f (void)
32 {
33 int i;
34
35 for (i = 0; i < SIZE; i++)
36 a_f[i] = 1.0f / __builtin_sqrtf (b_f[i]);
37 }