1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mdejagnu-cpu=power7 -fno-unroll-loops" } */
5 /* { dg-final { scan-assembler-times "xvredp" 4 } } */
6 /* { dg-final { scan-assembler-times "xvresp" 5 } } */
7 /* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */
8 /* { dg-final { scan-assembler-times "fres\|xsresp" 2 } } */
9 /* { dg-final { scan-assembler-times "fmuls\|xsmulsp" 2 } } */
10 /* { dg-final { scan-assembler-times "fnmsubs\|xsnmsub.sp" 2 } } */
11 /* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 2 } } */
12 /* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 4 } } */
13 /* { dg-final { scan-assembler-times "xvmulsp" 7 } } */
14 /* { dg-final { scan-assembler-times "xvnmsub.sp" 5 } } */
15 /* { dg-final { scan-assembler-times "xvmuldp" 6 } } */
16 /* { dg-final { scan-assembler-times "xvnmsub.dp" 8 } } */
20 float f_recip (float a
, float b
) { return __builtin_recipdivf (a
, b
); }
21 double d_recip (double a
, double b
) { return __builtin_recipdiv (a
, b
); }
23 float f_div (float a
, float b
) { return a
/ b
; }
24 double d_div (double a
, double b
) { return a
/ b
; }
28 double d_a
[SIZE
] __attribute__((__aligned__(32)));
29 double d_b
[SIZE
] __attribute__((__aligned__(32)));
30 double d_c
[SIZE
] __attribute__((__aligned__(32)));
32 float f_a
[SIZE
] __attribute__((__aligned__(32)));
33 float f_b
[SIZE
] __attribute__((__aligned__(32)));
34 float f_c
[SIZE
] __attribute__((__aligned__(32)));
36 void vec_f_recip (void)
40 for (i
= 0; i
< SIZE
; i
++)
41 f_a
[i
] = __builtin_recipdivf (f_b
[i
], f_c
[i
]);
44 void vec_d_recip (void)
48 for (i
= 0; i
< SIZE
; i
++)
49 d_a
[i
] = __builtin_recipdiv (d_b
[i
], d_c
[i
]);
56 for (i
= 0; i
< SIZE
; i
++)
57 f_a
[i
] = f_b
[i
] / f_c
[i
];
60 void vec_f_div2 (void)
64 for (i
= 0; i
< SIZE
; i
++)
65 f_a
[i
] = f_b
[i
] / 2.0f
;
68 void vec_f_div53 (void)
72 for (i
= 0; i
< SIZE
; i
++)
73 f_a
[i
] = f_b
[i
] / 53.0f
;
80 for (i
= 0; i
< SIZE
; i
++)
81 d_a
[i
] = d_b
[i
] / d_c
[i
];
84 void vec_d_div2 (void)
88 for (i
= 0; i
< SIZE
; i
++)
89 d_a
[i
] = d_b
[i
] / 2.0;
92 void vec_d_div53 (void)
96 for (i
= 0; i
< SIZE
; i
++)
97 d_a
[i
] = d_b
[i
] / 53.0;
100 vector
float v4sf_recip1 (vector
float a
, vector
float b
) { return vec_recipdiv (a
, b
); }
101 vector
float v4sf_recip2 (vector
float a
, vector
float b
) { return __builtin_altivec_vrecipdivfp (a
, b
); }
102 vector
double v2df_recip1 (vector
double a
, vector
double b
) { return vec_recipdiv (a
, b
); }
103 vector
float v4sf_recip3 (vector
float a
, vector
float b
) { return __builtin_vsx_xvrecipdivsp (a
, b
); }
104 vector
double v2df_recip2 (vector
double a
, vector
double b
) { return __builtin_vsx_xvrecipdivdp (a
, b
); }