[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / recip-4.c
blobab60d0138b5659ca5a3fbbb7233d727f20dce96c
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 } } */
13 #define SIZE 1024
15 extern double a_d[SIZE] __attribute__((__aligned__(32)));
16 extern double b_d[SIZE] __attribute__((__aligned__(32)));
18 void
19 vectorize_rsqrt_d (void)
21 int i;
23 for (i = 0; i < SIZE; i++)
24 a_d[i] = 1.0 / __builtin_sqrt (b_d[i]);
27 extern float a_f[SIZE] __attribute__((__aligned__(32)));
28 extern float b_f[SIZE] __attribute__((__aligned__(32)));
30 void
31 vectorize_rsqrt_f (void)
33 int i;
35 for (i = 0; i < SIZE; i++)
36 a_f[i] = 1.0f / __builtin_sqrtf (b_f[i]);