[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-builtin-6.c
blob1b91189c20f54bd66ceeee8523c997d6099899ab
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))
25 *p++ = 1;
27 return p;
30 int *test_div_df_3 (double a, double b, int *p)
32 if (__builtin_vsx_xstdivdp_fg (a, b))
33 *p++ = 1;
35 return p;
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))
47 *p++ = 1;
49 return p;
52 int *test_sqrt_df_3 (double a, int *p)
54 if (__builtin_vsx_xstsqrtdp_fg (a))
55 *p++ = 1;
57 return p;
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))
69 *p++ = 1;
71 return p;
74 int *test_div_v2df_3 (__vector double *a, __vector double *b, int *p)
76 if (__builtin_vsx_xvtdivdp_fg (*a, *b))
77 *p++ = 1;
79 return p;
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))
91 *p++ = 1;
93 return p;
96 int *test_sqrt_v2df_3 (__vector double *a, int *p)
98 if (__builtin_vsx_xvtsqrtdp_fg (*a))
99 *p++ = 1;
101 return p;
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))
113 *p++ = 1;
115 return p;
118 int *test_div_v4sf_3 (__vector float *a, __vector float *b, int *p)
120 if (__builtin_vsx_xvtdivsp_fg (*a, *b))
121 *p++ = 1;
123 return p;
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))
135 *p++ = 1;
137 return p;
140 int *test_sqrt_v4sf_3 (__vector float *a, int *p)
142 if (__builtin_vsx_xvtsqrtsp_fg (*a))
143 *p++ = 1;
145 return p;