OSDN Git Service

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