Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-builtin-6.c
blobc260f0e116c3339ffff4aadb853661ed65c23359
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))
26 *p++ = 1;
28 return p;
31 int *test_div_df_3 (double a, double b, int *p)
33 if (__builtin_vsx_xstdivdp_fg (a, b))
34 *p++ = 1;
36 return p;
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))
48 *p++ = 1;
50 return p;
53 int *test_sqrt_df_3 (double a, int *p)
55 if (__builtin_vsx_xstsqrtdp_fg (a))
56 *p++ = 1;
58 return p;
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))
70 *p++ = 1;
72 return p;
75 int *test_div_v2df_3 (__vector double *a, __vector double *b, int *p)
77 if (__builtin_vsx_xvtdivdp_fg (*a, *b))
78 *p++ = 1;
80 return p;
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))
92 *p++ = 1;
94 return p;
97 int *test_sqrt_v2df_3 (__vector double *a, int *p)
99 if (__builtin_vsx_xvtsqrtdp_fg (*a))
100 *p++ = 1;
102 return p;
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))
114 *p++ = 1;
116 return p;
119 int *test_div_v4sf_3 (__vector float *a, __vector float *b, int *p)
121 if (__builtin_vsx_xvtdivsp_fg (*a, *b))
122 *p++ = 1;
124 return p;
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))
136 *p++ = 1;
138 return p;
141 int *test_sqrt_v4sf_3 (__vector float *a, int *p)
143 if (__builtin_vsx_xvtsqrtsp_fg (*a))
144 *p++ = 1;
146 return p;