1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
5 /* { dg-options "-O2 -mcpu=power7" } */
7 /* Check whether tdiv and tsqrt instructions generate the correct code. */
8 /* Each of the *tdiv* and *tsqrt* instructions should be generated exactly 3
9 times (the two calls in the _1 function should be combined). */
10 /* { dg-final { scan-assembler-times "xstdivdp" 3 } } */
11 /* { dg-final { scan-assembler-times "xvtdivdp" 3 } } */
12 /* { dg-final { scan-assembler-times "xvtdivsp" 3 } } */
13 /* { dg-final { scan-assembler-times "xstsqrtdp" 3 } } */
14 /* { dg-final { scan-assembler-times "xvtsqrtdp" 3 } } */
15 /* { dg-final { scan-assembler-times "xvtsqrtsp" 3 } } */
17 void test_div_df_1 (double a
, double b
, int *p
)
19 p
[0] = __builtin_vsx_xstdivdp_fe (a
, b
);
20 p
[1] = __builtin_vsx_xstdivdp_fg (a
, b
);
23 int *test_div_df_2 (double a
, double b
, int *p
)
25 if (__builtin_vsx_xstdivdp_fe (a
, b
))
31 int *test_div_df_3 (double a
, double b
, int *p
)
33 if (__builtin_vsx_xstdivdp_fg (a
, b
))
39 void test_sqrt_df_1 (double a
, int *p
)
41 p
[0] = __builtin_vsx_xstsqrtdp_fe (a
);
42 p
[1] = __builtin_vsx_xstsqrtdp_fg (a
);
45 int *test_sqrt_df_2 (double a
, int *p
)
47 if (__builtin_vsx_xstsqrtdp_fe (a
))
53 int *test_sqrt_df_3 (double a
, int *p
)
55 if (__builtin_vsx_xstsqrtdp_fg (a
))
61 void test_div_v2df_1 (__vector
double *a
, __vector
double *b
, int *p
)
63 p
[0] = __builtin_vsx_xvtdivdp_fe (*a
, *b
);
64 p
[1] = __builtin_vsx_xvtdivdp_fg (*a
, *b
);
67 int *test_div_v2df_2 (__vector
double *a
, __vector
double *b
, int *p
)
69 if (__builtin_vsx_xvtdivdp_fe (*a
, *b
))
75 int *test_div_v2df_3 (__vector
double *a
, __vector
double *b
, int *p
)
77 if (__builtin_vsx_xvtdivdp_fg (*a
, *b
))
83 void test_sqrt_v2df_1 (__vector
double *a
, int *p
)
85 p
[0] = __builtin_vsx_xvtsqrtdp_fe (*a
);
86 p
[1] = __builtin_vsx_xvtsqrtdp_fg (*a
);
89 int *test_sqrt_v2df_2 (__vector
double *a
, int *p
)
91 if (__builtin_vsx_xvtsqrtdp_fe (*a
))
97 int *test_sqrt_v2df_3 (__vector
double *a
, int *p
)
99 if (__builtin_vsx_xvtsqrtdp_fg (*a
))
105 void test_div_v4sf_1 (__vector
float *a
, __vector
float *b
, int *p
)
107 p
[0] = __builtin_vsx_xvtdivsp_fe (*a
, *b
);
108 p
[1] = __builtin_vsx_xvtdivsp_fg (*a
, *b
);
111 int *test_div_v4sf_2 (__vector
float *a
, __vector
float *b
, int *p
)
113 if (__builtin_vsx_xvtdivsp_fe (*a
, *b
))
119 int *test_div_v4sf_3 (__vector
float *a
, __vector
float *b
, int *p
)
121 if (__builtin_vsx_xvtdivsp_fg (*a
, *b
))
127 void test_sqrt_v4sf_1 (__vector
float *a
, int *p
)
129 p
[0] = __builtin_vsx_xvtsqrtsp_fe (*a
);
130 p
[1] = __builtin_vsx_xvtsqrtsp_fg (*a
);
133 int *test_sqrt_v4sf_2 (__vector
float *a
, int *p
)
135 if (__builtin_vsx_xvtsqrtsp_fe (*a
))
141 int *test_sqrt_v4sf_3 (__vector
float *a
, int *p
)
143 if (__builtin_vsx_xvtsqrtsp_fg (*a
))