~pocl/pocl/trunk

« back to all changes in this revision

Viewing changes to lib/kernel/vecmathlib-pocl/remainder.cc

  • Committer: Erik Schnetter
  • Date: 2013-08-17 16:11:57 UTC
  • Revision ID: eschnetter@perimeterinstitute.ca-20130817161157-pco7u3hv98nbg2uk
Move pocl-specific Vecmathlib code into a separate subdirectory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Note: This file has been automatically generated. Do not modify.
 
2
 
 
3
#include "pocl-compat.h"
 
4
 
 
5
// remainder: ['VF', 'VF'] -> VF
 
6
 
 
7
// remainder: VF=float
 
8
#if defined VECMATHLIB_HAVE_VEC_FLOAT_1
 
9
// Implement remainder by calling vecmathlib
 
10
float _cl_remainder(float x0, float x1)
 
11
{
 
12
  vecmathlib::realvec<float,1> y0 = bitcast<float,vecmathlib::realvec<float,1> >(x0);
 
13
  vecmathlib::realvec<float,1> y1 = bitcast<float,vecmathlib::realvec<float,1> >(x1);
 
14
  vecmathlib::realvec<float,1> r = vecmathlib::remainder(y0, y1);
 
15
  return bitcast<vecmathlib::realvec<float,1>,float>((r));
 
16
}
 
17
#else
 
18
// Implement remainder by calling libm
 
19
float _cl_remainder(float x0, float x1)
 
20
{
 
21
  vecmathlib::realpseudovec<float,1> y0 = x0;
 
22
  vecmathlib::realpseudovec<float,1> y1 = x1;
 
23
  vecmathlib::realpseudovec<float,1> r = remainder(y0, y1);
 
24
  return (r)[0];
 
25
}
 
26
#endif
 
27
 
 
28
// remainder: VF=float2
 
29
#if defined VECMATHLIB_HAVE_VEC_FLOAT_2
 
30
// Implement remainder by calling vecmathlib
 
31
float2 _cl_remainder(float2 x0, float2 x1)
 
32
{
 
33
  vecmathlib::realvec<float,2> y0 = bitcast<float2,vecmathlib::realvec<float,2> >(x0);
 
34
  vecmathlib::realvec<float,2> y1 = bitcast<float2,vecmathlib::realvec<float,2> >(x1);
 
35
  vecmathlib::realvec<float,2> r = vecmathlib::remainder(y0, y1);
 
36
  return bitcast<vecmathlib::realvec<float,2>,float2>((r));
 
37
}
 
38
#elif defined VECMATHLIB_HAVE_VEC_FLOAT_4 || defined VECMATHLIB_HAVE_VEC_FLOAT_8 || defined VECMATHLIB_HAVE_VEC_FLOAT_16
 
39
// Implement remainder by using a larger vector size
 
40
float4 _cl_remainder(float4, float4);
 
41
float2 _cl_remainder(float2 x0, float2 x1)
 
42
{
 
43
  float4 y0 = bitcast<float2,float4>(x0);
 
44
  float4 y1 = bitcast<float2,float4>(x1);
 
45
  float4 r = _cl_remainder(y0, y1);
 
46
  return bitcast<float4,float2>(r);
 
47
}
 
48
#else
 
49
// Implement remainder by splitting into a smaller vector size
 
50
float _cl_remainder(float, float);
 
51
float2 _cl_remainder(float2 x0, float2 x1)
 
52
{
 
53
  pair_float y0 = bitcast<float2,pair_float>(x0);
 
54
  pair_float y1 = bitcast<float2,pair_float>(x1);
 
55
  pair_float r;
 
56
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
57
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
58
  pocl_static_assert(sizeof(pair_float) == sizeof(float2));
 
59
  return bitcast<pair_float,float2>(r);
 
60
}
 
61
#endif
 
62
 
 
63
// remainder: VF=float3
 
64
#if defined VECMATHLIB_HAVE_VEC_FLOAT_3
 
65
// Implement remainder by calling vecmathlib
 
66
float3 _cl_remainder(float3 x0, float3 x1)
 
67
{
 
68
  vecmathlib::realvec<float,3> y0 = bitcast<float3,vecmathlib::realvec<float,3> >(x0);
 
69
  vecmathlib::realvec<float,3> y1 = bitcast<float3,vecmathlib::realvec<float,3> >(x1);
 
70
  vecmathlib::realvec<float,3> r = vecmathlib::remainder(y0, y1);
 
71
  return bitcast<vecmathlib::realvec<float,3>,float3>((r));
 
72
}
 
73
#elif defined VECMATHLIB_HAVE_VEC_FLOAT_4 || defined VECMATHLIB_HAVE_VEC_FLOAT_8 || defined VECMATHLIB_HAVE_VEC_FLOAT_16
 
74
// Implement remainder by using a larger vector size
 
75
float4 _cl_remainder(float4, float4);
 
76
float3 _cl_remainder(float3 x0, float3 x1)
 
77
{
 
78
  float4 y0 = bitcast<float3,float4>(x0);
 
79
  float4 y1 = bitcast<float3,float4>(x1);
 
80
  float4 r = _cl_remainder(y0, y1);
 
81
  return bitcast<float4,float3>(r);
 
82
}
 
83
#else
 
84
// Implement remainder by splitting into a smaller vector size
 
85
float2 _cl_remainder(float2, float2);
 
86
float3 _cl_remainder(float3 x0, float3 x1)
 
87
{
 
88
  pair_float2 y0 = bitcast<float3,pair_float2>(x0);
 
89
  pair_float2 y1 = bitcast<float3,pair_float2>(x1);
 
90
  pair_float2 r;
 
91
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
92
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
93
  pocl_static_assert(sizeof(pair_float2) == sizeof(float3));
 
94
  return bitcast<pair_float2,float3>(r);
 
95
}
 
96
#endif
 
97
 
 
98
// remainder: VF=float4
 
99
#if defined VECMATHLIB_HAVE_VEC_FLOAT_4
 
100
// Implement remainder by calling vecmathlib
 
101
float4 _cl_remainder(float4 x0, float4 x1)
 
102
{
 
103
  vecmathlib::realvec<float,4> y0 = bitcast<float4,vecmathlib::realvec<float,4> >(x0);
 
104
  vecmathlib::realvec<float,4> y1 = bitcast<float4,vecmathlib::realvec<float,4> >(x1);
 
105
  vecmathlib::realvec<float,4> r = vecmathlib::remainder(y0, y1);
 
106
  return bitcast<vecmathlib::realvec<float,4>,float4>((r));
 
107
}
 
108
#elif defined VECMATHLIB_HAVE_VEC_FLOAT_8 || defined VECMATHLIB_HAVE_VEC_FLOAT_16
 
109
// Implement remainder by using a larger vector size
 
110
float8 _cl_remainder(float8, float8);
 
111
float4 _cl_remainder(float4 x0, float4 x1)
 
112
{
 
113
  float8 y0 = bitcast<float4,float8>(x0);
 
114
  float8 y1 = bitcast<float4,float8>(x1);
 
115
  float8 r = _cl_remainder(y0, y1);
 
116
  return bitcast<float8,float4>(r);
 
117
}
 
118
#else
 
119
// Implement remainder by splitting into a smaller vector size
 
120
float2 _cl_remainder(float2, float2);
 
121
float4 _cl_remainder(float4 x0, float4 x1)
 
122
{
 
123
  pair_float2 y0 = bitcast<float4,pair_float2>(x0);
 
124
  pair_float2 y1 = bitcast<float4,pair_float2>(x1);
 
125
  pair_float2 r;
 
126
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
127
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
128
  pocl_static_assert(sizeof(pair_float2) == sizeof(float4));
 
129
  return bitcast<pair_float2,float4>(r);
 
130
}
 
131
#endif
 
132
 
 
133
// remainder: VF=float8
 
134
#if defined VECMATHLIB_HAVE_VEC_FLOAT_8
 
135
// Implement remainder by calling vecmathlib
 
136
float8 _cl_remainder(float8 x0, float8 x1)
 
137
{
 
138
  vecmathlib::realvec<float,8> y0 = bitcast<float8,vecmathlib::realvec<float,8> >(x0);
 
139
  vecmathlib::realvec<float,8> y1 = bitcast<float8,vecmathlib::realvec<float,8> >(x1);
 
140
  vecmathlib::realvec<float,8> r = vecmathlib::remainder(y0, y1);
 
141
  return bitcast<vecmathlib::realvec<float,8>,float8>((r));
 
142
}
 
143
#elif defined VECMATHLIB_HAVE_VEC_FLOAT_16
 
144
// Implement remainder by using a larger vector size
 
145
float16 _cl_remainder(float16, float16);
 
146
float8 _cl_remainder(float8 x0, float8 x1)
 
147
{
 
148
  float16 y0 = bitcast<float8,float16>(x0);
 
149
  float16 y1 = bitcast<float8,float16>(x1);
 
150
  float16 r = _cl_remainder(y0, y1);
 
151
  return bitcast<float16,float8>(r);
 
152
}
 
153
#else
 
154
// Implement remainder by splitting into a smaller vector size
 
155
float4 _cl_remainder(float4, float4);
 
156
float8 _cl_remainder(float8 x0, float8 x1)
 
157
{
 
158
  pair_float4 y0 = bitcast<float8,pair_float4>(x0);
 
159
  pair_float4 y1 = bitcast<float8,pair_float4>(x1);
 
160
  pair_float4 r;
 
161
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
162
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
163
  pocl_static_assert(sizeof(pair_float4) == sizeof(float8));
 
164
  return bitcast<pair_float4,float8>(r);
 
165
}
 
166
#endif
 
167
 
 
168
// remainder: VF=float16
 
169
#if defined VECMATHLIB_HAVE_VEC_FLOAT_16
 
170
// Implement remainder by calling vecmathlib
 
171
float16 _cl_remainder(float16 x0, float16 x1)
 
172
{
 
173
  vecmathlib::realvec<float,16> y0 = bitcast<float16,vecmathlib::realvec<float,16> >(x0);
 
174
  vecmathlib::realvec<float,16> y1 = bitcast<float16,vecmathlib::realvec<float,16> >(x1);
 
175
  vecmathlib::realvec<float,16> r = vecmathlib::remainder(y0, y1);
 
176
  return bitcast<vecmathlib::realvec<float,16>,float16>((r));
 
177
}
 
178
#else
 
179
// Implement remainder by splitting into a smaller vector size
 
180
float8 _cl_remainder(float8, float8);
 
181
float16 _cl_remainder(float16 x0, float16 x1)
 
182
{
 
183
  pair_float8 y0 = bitcast<float16,pair_float8>(x0);
 
184
  pair_float8 y1 = bitcast<float16,pair_float8>(x1);
 
185
  pair_float8 r;
 
186
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
187
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
188
  pocl_static_assert(sizeof(pair_float8) == sizeof(float16));
 
189
  return bitcast<pair_float8,float16>(r);
 
190
}
 
191
#endif
 
192
 
 
193
#ifdef cl_khr_fp64
 
194
 
 
195
// remainder: VF=double
 
196
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_1
 
197
// Implement remainder by calling vecmathlib
 
198
double _cl_remainder(double x0, double x1)
 
199
{
 
200
  vecmathlib::realvec<double,1> y0 = bitcast<double,vecmathlib::realvec<double,1> >(x0);
 
201
  vecmathlib::realvec<double,1> y1 = bitcast<double,vecmathlib::realvec<double,1> >(x1);
 
202
  vecmathlib::realvec<double,1> r = vecmathlib::remainder(y0, y1);
 
203
  return bitcast<vecmathlib::realvec<double,1>,double>((r));
 
204
}
 
205
#else
 
206
// Implement remainder by calling libm
 
207
double _cl_remainder(double x0, double x1)
 
208
{
 
209
  vecmathlib::realpseudovec<double,1> y0 = x0;
 
210
  vecmathlib::realpseudovec<double,1> y1 = x1;
 
211
  vecmathlib::realpseudovec<double,1> r = remainder(y0, y1);
 
212
  return (r)[0];
 
213
}
 
214
#endif
 
215
 
 
216
// remainder: VF=double2
 
217
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_2
 
218
// Implement remainder by calling vecmathlib
 
219
double2 _cl_remainder(double2 x0, double2 x1)
 
220
{
 
221
  vecmathlib::realvec<double,2> y0 = bitcast<double2,vecmathlib::realvec<double,2> >(x0);
 
222
  vecmathlib::realvec<double,2> y1 = bitcast<double2,vecmathlib::realvec<double,2> >(x1);
 
223
  vecmathlib::realvec<double,2> r = vecmathlib::remainder(y0, y1);
 
224
  return bitcast<vecmathlib::realvec<double,2>,double2>((r));
 
225
}
 
226
#elif defined VECMATHLIB_HAVE_VEC_DOUBLE_4 || defined VECMATHLIB_HAVE_VEC_DOUBLE_8 || defined VECMATHLIB_HAVE_VEC_DOUBLE_16
 
227
// Implement remainder by using a larger vector size
 
228
double4 _cl_remainder(double4, double4);
 
229
double2 _cl_remainder(double2 x0, double2 x1)
 
230
{
 
231
  double4 y0 = bitcast<double2,double4>(x0);
 
232
  double4 y1 = bitcast<double2,double4>(x1);
 
233
  double4 r = _cl_remainder(y0, y1);
 
234
  return bitcast<double4,double2>(r);
 
235
}
 
236
#else
 
237
// Implement remainder by splitting into a smaller vector size
 
238
double _cl_remainder(double, double);
 
239
double2 _cl_remainder(double2 x0, double2 x1)
 
240
{
 
241
  pair_double y0 = bitcast<double2,pair_double>(x0);
 
242
  pair_double y1 = bitcast<double2,pair_double>(x1);
 
243
  pair_double r;
 
244
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
245
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
246
  pocl_static_assert(sizeof(pair_double) == sizeof(double2));
 
247
  return bitcast<pair_double,double2>(r);
 
248
}
 
249
#endif
 
250
 
 
251
// remainder: VF=double3
 
252
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_3
 
253
// Implement remainder by calling vecmathlib
 
254
double3 _cl_remainder(double3 x0, double3 x1)
 
255
{
 
256
  vecmathlib::realvec<double,3> y0 = bitcast<double3,vecmathlib::realvec<double,3> >(x0);
 
257
  vecmathlib::realvec<double,3> y1 = bitcast<double3,vecmathlib::realvec<double,3> >(x1);
 
258
  vecmathlib::realvec<double,3> r = vecmathlib::remainder(y0, y1);
 
259
  return bitcast<vecmathlib::realvec<double,3>,double3>((r));
 
260
}
 
261
#elif defined VECMATHLIB_HAVE_VEC_DOUBLE_4 || defined VECMATHLIB_HAVE_VEC_DOUBLE_8 || defined VECMATHLIB_HAVE_VEC_DOUBLE_16
 
262
// Implement remainder by using a larger vector size
 
263
double4 _cl_remainder(double4, double4);
 
264
double3 _cl_remainder(double3 x0, double3 x1)
 
265
{
 
266
  double4 y0 = bitcast<double3,double4>(x0);
 
267
  double4 y1 = bitcast<double3,double4>(x1);
 
268
  double4 r = _cl_remainder(y0, y1);
 
269
  return bitcast<double4,double3>(r);
 
270
}
 
271
#else
 
272
// Implement remainder by splitting into a smaller vector size
 
273
double2 _cl_remainder(double2, double2);
 
274
double3 _cl_remainder(double3 x0, double3 x1)
 
275
{
 
276
  pair_double2 y0 = bitcast<double3,pair_double2>(x0);
 
277
  pair_double2 y1 = bitcast<double3,pair_double2>(x1);
 
278
  pair_double2 r;
 
279
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
280
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
281
  pocl_static_assert(sizeof(pair_double2) == sizeof(double3));
 
282
  return bitcast<pair_double2,double3>(r);
 
283
}
 
284
#endif
 
285
 
 
286
// remainder: VF=double4
 
287
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_4
 
288
// Implement remainder by calling vecmathlib
 
289
double4 _cl_remainder(double4 x0, double4 x1)
 
290
{
 
291
  vecmathlib::realvec<double,4> y0 = bitcast<double4,vecmathlib::realvec<double,4> >(x0);
 
292
  vecmathlib::realvec<double,4> y1 = bitcast<double4,vecmathlib::realvec<double,4> >(x1);
 
293
  vecmathlib::realvec<double,4> r = vecmathlib::remainder(y0, y1);
 
294
  return bitcast<vecmathlib::realvec<double,4>,double4>((r));
 
295
}
 
296
#elif defined VECMATHLIB_HAVE_VEC_DOUBLE_8 || defined VECMATHLIB_HAVE_VEC_DOUBLE_16
 
297
// Implement remainder by using a larger vector size
 
298
double8 _cl_remainder(double8, double8);
 
299
double4 _cl_remainder(double4 x0, double4 x1)
 
300
{
 
301
  double8 y0 = bitcast<double4,double8>(x0);
 
302
  double8 y1 = bitcast<double4,double8>(x1);
 
303
  double8 r = _cl_remainder(y0, y1);
 
304
  return bitcast<double8,double4>(r);
 
305
}
 
306
#else
 
307
// Implement remainder by splitting into a smaller vector size
 
308
double2 _cl_remainder(double2, double2);
 
309
double4 _cl_remainder(double4 x0, double4 x1)
 
310
{
 
311
  pair_double2 y0 = bitcast<double4,pair_double2>(x0);
 
312
  pair_double2 y1 = bitcast<double4,pair_double2>(x1);
 
313
  pair_double2 r;
 
314
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
315
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
316
  pocl_static_assert(sizeof(pair_double2) == sizeof(double4));
 
317
  return bitcast<pair_double2,double4>(r);
 
318
}
 
319
#endif
 
320
 
 
321
// remainder: VF=double8
 
322
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_8
 
323
// Implement remainder by calling vecmathlib
 
324
double8 _cl_remainder(double8 x0, double8 x1)
 
325
{
 
326
  vecmathlib::realvec<double,8> y0 = bitcast<double8,vecmathlib::realvec<double,8> >(x0);
 
327
  vecmathlib::realvec<double,8> y1 = bitcast<double8,vecmathlib::realvec<double,8> >(x1);
 
328
  vecmathlib::realvec<double,8> r = vecmathlib::remainder(y0, y1);
 
329
  return bitcast<vecmathlib::realvec<double,8>,double8>((r));
 
330
}
 
331
#elif defined VECMATHLIB_HAVE_VEC_DOUBLE_16
 
332
// Implement remainder by using a larger vector size
 
333
double16 _cl_remainder(double16, double16);
 
334
double8 _cl_remainder(double8 x0, double8 x1)
 
335
{
 
336
  double16 y0 = bitcast<double8,double16>(x0);
 
337
  double16 y1 = bitcast<double8,double16>(x1);
 
338
  double16 r = _cl_remainder(y0, y1);
 
339
  return bitcast<double16,double8>(r);
 
340
}
 
341
#else
 
342
// Implement remainder by splitting into a smaller vector size
 
343
double4 _cl_remainder(double4, double4);
 
344
double8 _cl_remainder(double8 x0, double8 x1)
 
345
{
 
346
  pair_double4 y0 = bitcast<double8,pair_double4>(x0);
 
347
  pair_double4 y1 = bitcast<double8,pair_double4>(x1);
 
348
  pair_double4 r;
 
349
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
350
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
351
  pocl_static_assert(sizeof(pair_double4) == sizeof(double8));
 
352
  return bitcast<pair_double4,double8>(r);
 
353
}
 
354
#endif
 
355
 
 
356
// remainder: VF=double16
 
357
#if defined VECMATHLIB_HAVE_VEC_DOUBLE_16
 
358
// Implement remainder by calling vecmathlib
 
359
double16 _cl_remainder(double16 x0, double16 x1)
 
360
{
 
361
  vecmathlib::realvec<double,16> y0 = bitcast<double16,vecmathlib::realvec<double,16> >(x0);
 
362
  vecmathlib::realvec<double,16> y1 = bitcast<double16,vecmathlib::realvec<double,16> >(x1);
 
363
  vecmathlib::realvec<double,16> r = vecmathlib::remainder(y0, y1);
 
364
  return bitcast<vecmathlib::realvec<double,16>,double16>((r));
 
365
}
 
366
#else
 
367
// Implement remainder by splitting into a smaller vector size
 
368
double8 _cl_remainder(double8, double8);
 
369
double16 _cl_remainder(double16 x0, double16 x1)
 
370
{
 
371
  pair_double8 y0 = bitcast<double16,pair_double8>(x0);
 
372
  pair_double8 y1 = bitcast<double16,pair_double8>(x1);
 
373
  pair_double8 r;
 
374
  r.lo = _cl_remainder(y0.lo, y1.lo);
 
375
  r.hi = _cl_remainder(y0.hi, y1.hi);
 
376
  pocl_static_assert(sizeof(pair_double8) == sizeof(double16));
 
377
  return bitcast<pair_double8,double16>(r);
 
378
}
 
379
#endif
 
380
 
 
381
#endif // #ifdef cl_khr_fp64