aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-6.c
blob: a722b83b976064333c1234c57d48d3d79e5a58c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O2 -mcpu=power7" } */

/* Check whether tdiv and tsqrt instructions generate the correct code.  */
/* Each of the *tdiv* and *tsqrt* instructions should be generated exactly 3
   times (the two calls in the _1 function should be combined).  */
/* { dg-final { scan-assembler-times "xstdivdp" 3 } } */
/* { dg-final { scan-assembler-times "xvtdivdp" 3 } } */
/* { dg-final { scan-assembler-times "xvtdivsp" 3 } } */
/* { dg-final { scan-assembler-times "xstsqrtdp" 3 } } */
/* { dg-final { scan-assembler-times "xvtsqrtdp" 3 } } */
/* { dg-final { scan-assembler-times "xvtsqrtsp" 3 } } */

void test_div_df_1 (double a, double b, int *p)
{
  p[0] = __builtin_vsx_xstdivdp_fe (a, b);
  p[1] = __builtin_vsx_xstdivdp_fg (a, b);
}

int *test_div_df_2 (double a, double b, int *p)
{
  if (__builtin_vsx_xstdivdp_fe (a, b))
    *p++ = 1;
  
  return p;
}

int *test_div_df_3 (double a, double b, int *p)
{
  if (__builtin_vsx_xstdivdp_fg (a, b))
    *p++ = 1;

  return p;
}

void test_sqrt_df_1 (double a, int *p)
{
  p[0] = __builtin_vsx_xstsqrtdp_fe (a);
  p[1] = __builtin_vsx_xstsqrtdp_fg (a);
}

int *test_sqrt_df_2 (double a, int *p)
{
  if (__builtin_vsx_xstsqrtdp_fe (a))
    *p++ = 1;

  return p;
}

int *test_sqrt_df_3 (double a, int *p)
{
  if (__builtin_vsx_xstsqrtdp_fg (a))
    *p++ = 1;

  return p;
}

void test_div_v2df_1 (__vector double *a, __vector double *b, int *p)
{
  p[0] = __builtin_vsx_xvtdivdp_fe (*a, *b);
  p[1] = __builtin_vsx_xvtdivdp_fg (*a, *b);
}

int *test_div_v2df_2 (__vector double *a, __vector double *b, int *p)
{
  if (__builtin_vsx_xvtdivdp_fe (*a, *b))
    *p++ = 1;

  return p;
}

int *test_div_v2df_3 (__vector double *a, __vector double *b, int *p)
{
  if (__builtin_vsx_xvtdivdp_fg (*a, *b))
    *p++ = 1;

  return p;
}

void test_sqrt_v2df_1 (__vector double *a, int *p)
{
  p[0] = __builtin_vsx_xvtsqrtdp_fe (*a);
  p[1] = __builtin_vsx_xvtsqrtdp_fg (*a);
}

int *test_sqrt_v2df_2 (__vector double *a, int *p)
{
  if (__builtin_vsx_xvtsqrtdp_fe (*a))
    *p++ = 1;

  return p;
}

int *test_sqrt_v2df_3 (__vector double *a, int *p)
{
  if (__builtin_vsx_xvtsqrtdp_fg (*a))
    *p++ = 1;

  return p;
}

void test_div_v4sf_1 (__vector float *a, __vector float *b, int *p)
{
  p[0] = __builtin_vsx_xvtdivsp_fe (*a, *b);
  p[1] = __builtin_vsx_xvtdivsp_fg (*a, *b);
}

int *test_div_v4sf_2 (__vector float *a, __vector float *b, int *p)
{
  if (__builtin_vsx_xvtdivsp_fe (*a, *b))
    *p++ = 1;

  return p;
}

int *test_div_v4sf_3 (__vector float *a, __vector float *b, int *p)
{
  if (__builtin_vsx_xvtdivsp_fg (*a, *b))
    *p++ = 1;

  return p;
}

void test_sqrt_v4sf_1 (__vector float *a, int *p)
{
  p[0] = __builtin_vsx_xvtsqrtsp_fe (*a);
  p[1] = __builtin_vsx_xvtsqrtsp_fg (*a);
}

int *test_sqrt_v4sf_2 (__vector float *a, int *p)
{
  if (__builtin_vsx_xvtsqrtsp_fe (*a))
    *p++ = 1;

  return p;
}

int *test_sqrt_v4sf_3 (__vector float *a, int *p)
{
  if (__builtin_vsx_xvtsqrtsp_fg (*a))
    *p++ = 1;

  return p;
}