1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power7" } */
6 /* Check whether tdiv and tsqrt instructions generate the correct code. */
7 /* Each of the *tdiv* and *tsqrt* instructions should be generated exactly 3
8 times (the two calls in the _1 function should be combined). */
9 /* { dg-final { scan-assembler-times "xstdivdp" 3 } } */
10 /* { dg-final { scan-assembler-times "xvtdivdp" 3 } } */
11 /* { dg-final { scan-assembler-times "xvtdivsp" 3 } } */
12 /* { dg-final { scan-assembler-times "xstsqrtdp" 3 } } */
13 /* { dg-final { scan-assembler-times "xvtsqrtdp" 3 } } */
14 /* { dg-final { scan-assembler-times "xvtsqrtsp" 3 } } */
16 void test_div_df_1 (double a
, double b
, int *p
)
18 p
[0] = __builtin_vsx_xstdivdp_fe (a
, b
);
19 p
[1] = __builtin_vsx_xstdivdp_fg (a
, b
);
22 int *test_div_df_2 (double a
, double b
, int *p
)
24 if (__builtin_vsx_xstdivdp_fe (a
, b
))
30 int *test_div_df_3 (double a
, double b
, int *p
)
32 if (__builtin_vsx_xstdivdp_fg (a
, b
))
38 void test_sqrt_df_1 (double a
, int *p
)
40 p
[0] = __builtin_vsx_xstsqrtdp_fe (a
);
41 p
[1] = __builtin_vsx_xstsqrtdp_fg (a
);
44 int *test_sqrt_df_2 (double a
, int *p
)
46 if (__builtin_vsx_xstsqrtdp_fe (a
))
52 int *test_sqrt_df_3 (double a
, int *p
)
54 if (__builtin_vsx_xstsqrtdp_fg (a
))
60 void test_div_v2df_1 (__vector
double *a
, __vector
double *b
, int *p
)
62 p
[0] = __builtin_vsx_xvtdivdp_fe (*a
, *b
);
63 p
[1] = __builtin_vsx_xvtdivdp_fg (*a
, *b
);
66 int *test_div_v2df_2 (__vector
double *a
, __vector
double *b
, int *p
)
68 if (__builtin_vsx_xvtdivdp_fe (*a
, *b
))
74 int *test_div_v2df_3 (__vector
double *a
, __vector
double *b
, int *p
)
76 if (__builtin_vsx_xvtdivdp_fg (*a
, *b
))
82 void test_sqrt_v2df_1 (__vector
double *a
, int *p
)
84 p
[0] = __builtin_vsx_xvtsqrtdp_fe (*a
);
85 p
[1] = __builtin_vsx_xvtsqrtdp_fg (*a
);
88 int *test_sqrt_v2df_2 (__vector
double *a
, int *p
)
90 if (__builtin_vsx_xvtsqrtdp_fe (*a
))
96 int *test_sqrt_v2df_3 (__vector
double *a
, int *p
)
98 if (__builtin_vsx_xvtsqrtdp_fg (*a
))
104 void test_div_v4sf_1 (__vector
float *a
, __vector
float *b
, int *p
)
106 p
[0] = __builtin_vsx_xvtdivsp_fe (*a
, *b
);
107 p
[1] = __builtin_vsx_xvtdivsp_fg (*a
, *b
);
110 int *test_div_v4sf_2 (__vector
float *a
, __vector
float *b
, int *p
)
112 if (__builtin_vsx_xvtdivsp_fe (*a
, *b
))
118 int *test_div_v4sf_3 (__vector
float *a
, __vector
float *b
, int *p
)
120 if (__builtin_vsx_xvtdivsp_fg (*a
, *b
))
126 void test_sqrt_v4sf_1 (__vector
float *a
, int *p
)
128 p
[0] = __builtin_vsx_xvtsqrtsp_fe (*a
);
129 p
[1] = __builtin_vsx_xvtsqrtsp_fg (*a
);
132 int *test_sqrt_v4sf_2 (__vector
float *a
, int *p
)
134 if (__builtin_vsx_xvtsqrtsp_fe (*a
))
140 int *test_sqrt_v4sf_3 (__vector
float *a
, int *p
)
142 if (__builtin_vsx_xvtsqrtsp_fg (*a
))