• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //    http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "harness/compat.h"
17 
18 #include "basic_test_conversions.h"
19 #include <limits.h>
20 #include <string.h>
21 
22 #include "harness/mt19937.h"
23 
24 #if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__)
25 #include "fplib.h"
26 #endif
27 
28 #if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__)
29 /* Rounding modes and saturation for use with qcom 64 bit to float conversion library */
30     bool            qcom_sat;
31     roundingMode    qcom_rm;
32 #endif
33 
34 static inline cl_ulong random64( MTdata d );
35 
36 #if defined (_WIN32)
37     #include <mmintrin.h>
38     #include <emmintrin.h>
39 #else // !_WIN32
40 #if defined (__SSE__ )
41     #include <xmmintrin.h>
42 #endif
43 #if defined (__SSE2__ )
44     #include <emmintrin.h>
45 #endif
46 #endif // _WIN32
47 
48 const char *gTypeNames[ kTypeCount ] = {
49                                             "uchar", "char",
50                                             "ushort", "short",
51                                             "uint",   "int",
52                                             "float", "double",
53                                             "ulong", "long"
54                                         };
55 
56 const char *gRoundingModeNames[ kRoundingModeCount ] = {
57                                                             "",
58                                                             "_rte",
59                                                             "_rtp",
60                                                             "_rtn",
61                                                             "_rtz"
62                                                         };
63 
64 const char *gSaturationNames[ 2 ] = { "", "_sat" };
65 
66 size_t gTypeSizes[ kTypeCount ] = {
67                                     sizeof( cl_uchar ), sizeof( cl_char ),
68                                     sizeof( cl_ushort ), sizeof( cl_short ),
69                                     sizeof( cl_uint ), sizeof( cl_int ),
70                                     sizeof( cl_float ), sizeof( cl_double ),
71                                     sizeof( cl_ulong ), sizeof( cl_long ),
72                                 };
73 
74 long lrintf_clamped( float f );
lrintf_clamped(float f)75 long lrintf_clamped( float f )
76 {
77     static const float magic[2] = { MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23), - MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23) };
78 
79     if( f >= -(float) LONG_MIN )
80         return LONG_MAX;
81 
82     if( f <= (float) LONG_MIN )
83         return LONG_MIN;
84 
85     // Round fractional values to integer in round towards nearest mode
86     if( fabsf(f) < MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23 ) )
87     {
88         volatile float x = f;
89         float magicVal = magic[ f < 0 ];
90 
91 #if defined( __SSE__ ) || defined (_WIN32)
92         // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly
93         __m128 v = _mm_set_ss( x );
94         __m128 m = _mm_set_ss( magicVal );
95         v = _mm_add_ss( v, m );
96         v = _mm_sub_ss( v, m );
97         _mm_store_ss( (float*) &x, v );
98 #else
99         x += magicVal;
100         x -= magicVal;
101 #endif
102         f = x;
103     }
104 
105     return (long) f;
106 }
107 
108 long long llrintf_clamped( float f );
llrintf_clamped(float f)109 long long llrintf_clamped( float f )
110 {
111     static const float magic[2] = { MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23), - MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23) };
112 
113     if( f >= -(float) LLONG_MIN )
114         return LLONG_MAX;
115 
116     if( f <= (float) LLONG_MIN )
117         return LLONG_MIN;
118 
119     // Round fractional values to integer in round towards nearest mode
120     if( fabsf(f) < MAKE_HEX_FLOAT(0x1.0p23f, 0x1L, 23) )
121     {
122         volatile float x = f;
123         float magicVal = magic[ f < 0 ];
124 #if defined( __SSE__ ) || defined (_WIN32)
125         // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly
126         __m128 v = _mm_set_ss( x );
127         __m128 m = _mm_set_ss( magicVal );
128         v = _mm_add_ss( v, m );
129         v = _mm_sub_ss( v, m );
130         _mm_store_ss( (float*) &x, v );
131 #else
132         x += magicVal;
133         x -= magicVal;
134 #endif
135         f = x;
136     }
137 
138     return (long long) f;
139 }
140 
141 long lrint_clamped( double f );
lrint_clamped(double f)142 long lrint_clamped( double f )
143 {
144     static const double magic[2] = { MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52), MAKE_HEX_DOUBLE(-0x1.0p52, -0x1LL, 52) };
145 
146     if( sizeof( long ) > 4 )
147     {
148         if( f >= -(double) LONG_MIN )
149             return LONG_MAX;
150     }
151     else
152     {
153         if( f >= LONG_MAX )
154             return LONG_MAX;
155     }
156 
157     if( f <= (double) LONG_MIN )
158         return LONG_MIN;
159 
160     // Round fractional values to integer in round towards nearest mode
161     if( fabs(f) < MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52) )
162     {
163         volatile double x = f;
164         double magicVal = magic[ f < 0 ];
165 #if defined( __SSE2__ ) || defined (_MSC_VER)
166         // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly
167         __m128d v = _mm_set_sd( x );
168         __m128d m = _mm_set_sd( magicVal );
169         v = _mm_add_sd( v, m );
170         v = _mm_sub_sd( v, m );
171         _mm_store_sd( (double*) &x, v );
172 #else
173         x += magicVal;
174         x -= magicVal;
175 #endif
176         f = x;
177     }
178 
179     return (long) f;
180 }
181 
182 long long llrint_clamped( double f );
llrint_clamped(double f)183 long long llrint_clamped( double f )
184 {
185     static const double magic[2] = { MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52), MAKE_HEX_DOUBLE(-0x1.0p52, -0x1LL, 52) };
186 
187     if( f >= -(double) LLONG_MIN )
188         return LLONG_MAX;
189 
190     if( f <= (double) LLONG_MIN )
191         return LLONG_MIN;
192 
193     // Round fractional values to integer in round towards nearest mode
194     if( fabs(f) < MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52) )
195     {
196         volatile double x = f;
197         double magicVal = magic[ f < 0 ];
198 #if defined( __SSE2__ ) || defined (_MSC_VER)
199         // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly
200         __m128d v = _mm_set_sd( x );
201         __m128d m = _mm_set_sd( magicVal );
202         v = _mm_add_sd( v, m );
203         v = _mm_sub_sd( v, m );
204         _mm_store_sd( (double*) &x, v );
205 #else
206         x += magicVal;
207         x -= magicVal;
208 #endif
209         f = x;
210     }
211 
212     return (long long) f;
213 }
214 
215 
216 /*
217     Names created as:
218 
219     #include <stdio.h>
220 
221     const char *names[] = { "uchar", "char", "ushort", "short", "uint", "int", "float", "double", "ulong", "long" };
222 
223     int main( void )
224     {
225 
226         int i,j;
227 
228         for( i = 0; i < sizeof( names ) / sizeof( names[0] ); i++ )
229             for( j = 0; j < sizeof( names ) / sizeof( names[0] ); j++ )
230             {
231                 if( j == i )
232                     continue;
233 
234                 vlog( "void %s2%s( void *, void *);\n", names[i], names[j] );
235             }
236 
237 
238         return 0;
239     }
240 */
241 
242 static float my_fabsf( float x );
243 static double my_fabs( double x );
244 
245 
246 
247 static void uchar2char( void *, void *);
248 static void uchar2ushort( void *, void *);
249 static void uchar2short( void *, void *);
250 static void uchar2uint( void *, void *);
251 static void uchar2int( void *, void *);
252 static void uchar2float( void *, void *);
253 static void uchar2double( void *, void *);
254 static void uchar2ulong( void *, void *);
255 static void uchar2long( void *, void *);
256 static void char2uchar( void *, void *);
257 static void char2ushort( void *, void *);
258 static void char2short( void *, void *);
259 static void char2uint( void *, void *);
260 static void char2int( void *, void *);
261 static void char2float( void *, void *);
262 static void char2double( void *, void *);
263 static void char2ulong( void *, void *);
264 static void char2long( void *, void *);
265 static void ushort2uchar( void *, void *);
266 static void ushort2char( void *, void *);
267 static void ushort2short( void *, void *);
268 static void ushort2uint( void *, void *);
269 static void ushort2int( void *, void *);
270 static void ushort2float( void *, void *);
271 static void ushort2double( void *, void *);
272 static void ushort2ulong( void *, void *);
273 static void ushort2long( void *, void *);
274 static void short2uchar( void *, void *);
275 static void short2char( void *, void *);
276 static void short2ushort( void *, void *);
277 static void short2uint( void *, void *);
278 static void short2int( void *, void *);
279 static void short2float( void *, void *);
280 static void short2double( void *, void *);
281 static void short2ulong( void *, void *);
282 static void short2long( void *, void *);
283 static void uint2uchar( void *, void *);
284 static void uint2char( void *, void *);
285 static void uint2ushort( void *, void *);
286 static void uint2short( void *, void *);
287 static void uint2int( void *, void *);
288 static void uint2float( void *, void *);
289 static void uint2double( void *, void *);
290 static void uint2ulong( void *, void *);
291 static void uint2long( void *, void *);
292 static void int2uchar( void *, void *);
293 static void int2char( void *, void *);
294 static void int2ushort( void *, void *);
295 static void int2short( void *, void *);
296 static void int2uint( void *, void *);
297 static void int2float( void *, void *);
298 static void int2double( void *, void *);
299 static void int2ulong( void *, void *);
300 static void int2long( void *, void *);
301 static void float2uchar( void *, void *);
302 static void float2char( void *, void *);
303 static void float2ushort( void *, void *);
304 static void float2short( void *, void *);
305 static void float2uint( void *, void *);
306 static void float2int( void *, void *);
307 static void float2double( void *, void *);
308 static void float2ulong( void *, void *);
309 static void float2long( void *, void *);
310 static void double2uchar( void *, void *);
311 static void double2char( void *, void *);
312 static void double2ushort( void *, void *);
313 static void double2short( void *, void *);
314 static void double2uint( void *, void *);
315 static void double2int( void *, void *);
316 static void double2float( void *, void *);
317 static void double2ulong( void *, void *);
318 static void double2long( void *, void *);
319 static void ulong2uchar( void *, void *);
320 static void ulong2char( void *, void *);
321 static void ulong2ushort( void *, void *);
322 static void ulong2short( void *, void *);
323 static void ulong2uint( void *, void *);
324 static void ulong2int( void *, void *);
325 static void ulong2float( void *, void *);
326 static void ulong2double( void *, void *);
327 static void ulong2long( void *, void *);
328 static void long2uchar( void *, void *);
329 static void long2char( void *, void *);
330 static void long2ushort( void *, void *);
331 static void long2short( void *, void *);
332 static void long2uint( void *, void *);
333 static void long2int( void *, void *);
334 static void long2float( void *, void *);
335 static void long2double( void *, void *);
336 static void long2ulong( void *, void *);
337 
338 /*
339     Conversion list created as
340 
341     #include <stdio.h>
342 
343     const char *names[] = { "uchar", "char", "ushort", "short", "uint", "int", "float", "double", "ulong", "long" };
344 
345     int main( void )
346     {
347 
348         int i,j;
349 
350         for( i = 0; i < sizeof( names ) / sizeof( names[0] ); i++ )
351         {
352             vlog( "{ " );
353             for( j = 0; j < sizeof( names ) / sizeof( names[0] ); j++ )
354             {
355                 if( j == i )
356                     vlog( "          NULL, " );
357                 else
358                 {
359                     char s[64];
360                     sprintf( s, "%s2%s,", names[j], names[i] );
361                     vlog( "%15s ", s );
362                 }
363             }
364             vlog( "},\n" );
365         }
366 
367         return 0;
368     }
369 
370  */
371 /*
372 Convert gConversions[kTypeCount][kTypeCount] = {
373 {           NULL,     char2uchar,   ushort2uchar,    short2uchar,     uint2uchar,      int2uchar,    float2uchar,   double2uchar,    ulong2uchar,     long2uchar, },
374 {     uchar2char,           NULL,    ushort2char,     short2char,      uint2char,       int2char,     float2char,    double2char,     ulong2char,      long2char, },
375 {   uchar2ushort,    char2ushort,           NULL,   short2ushort,    uint2ushort,     int2ushort,   float2ushort,  double2ushort,   ulong2ushort,    long2ushort, },
376 {    uchar2short,     char2short,   ushort2short,           NULL,     uint2short,      int2short,    float2short,   double2short,    ulong2short,     long2short, },
377 {     uchar2uint,      char2uint,    ushort2uint,     short2uint,           NULL,       int2uint,     float2uint,    double2uint,     ulong2uint,      long2uint, },
378 {      uchar2int,       char2int,     ushort2int,      short2int,       uint2int,           NULL,      float2int,     double2int,      ulong2int,       long2int, },
379 {    uchar2float,     char2float,   ushort2float,    short2float,     uint2float,      int2float,           NULL,   double2float,    ulong2float,     long2float, },
380 {   uchar2double,    char2double,  ushort2double,   short2double,    uint2double,     int2double,   float2double,           NULL,   ulong2double,    long2double, },
381 {    uchar2ulong,     char2ulong,   ushort2ulong,    short2ulong,     uint2ulong,      int2ulong,    float2ulong,   double2ulong,           NULL,     long2ulong, },
382 {     uchar2long,      char2long,    ushort2long,     short2long,      uint2long,       int2long,     float2long,    double2long,     ulong2long,           NULL, } };
383 */
384 
385 static void uchar2char_sat( void *, void *);
386 static void uchar2ushort_sat( void *, void *);
387 static void uchar2short_sat( void *, void *);
388 static void uchar2uint_sat( void *, void *);
389 static void uchar2int_sat( void *, void *);
390 static void uchar2float_sat( void *, void *);
391 static void uchar2double_sat( void *, void *);
392 static void uchar2ulong_sat( void *, void *);
393 static void uchar2long_sat( void *, void *);
394 static void char2uchar_sat( void *, void *);
395 static void char2ushort_sat( void *, void *);
396 static void char2short_sat( void *, void *);
397 static void char2uint_sat( void *, void *);
398 static void char2int_sat( void *, void *);
399 static void char2float_sat( void *, void *);
400 static void char2double_sat( void *, void *);
401 static void char2ulong_sat( void *, void *);
402 static void char2long_sat( void *, void *);
403 static void ushort2uchar_sat( void *, void *);
404 static void ushort2char_sat( void *, void *);
405 static void ushort2short_sat( void *, void *);
406 static void ushort2uint_sat( void *, void *);
407 static void ushort2int_sat( void *, void *);
408 static void ushort2float_sat( void *, void *);
409 static void ushort2double_sat( void *, void *);
410 static void ushort2ulong_sat( void *, void *);
411 static void ushort2long_sat( void *, void *);
412 static void short2uchar_sat( void *, void *);
413 static void short2char_sat( void *, void *);
414 static void short2ushort_sat( void *, void *);
415 static void short2uint_sat( void *, void *);
416 static void short2int_sat( void *, void *);
417 static void short2float_sat( void *, void *);
418 static void short2double_sat( void *, void *);
419 static void short2ulong_sat( void *, void *);
420 static void short2long_sat( void *, void *);
421 static void uint2uchar_sat( void *, void *);
422 static void uint2char_sat( void *, void *);
423 static void uint2ushort_sat( void *, void *);
424 static void uint2short_sat( void *, void *);
425 static void uint2int_sat( void *, void *);
426 static void uint2float_sat( void *, void *);
427 static void uint2double_sat( void *, void *);
428 static void uint2ulong_sat( void *, void *);
429 static void uint2long_sat( void *, void *);
430 static void int2uchar_sat( void *, void *);
431 static void int2char_sat( void *, void *);
432 static void int2ushort_sat( void *, void *);
433 static void int2short_sat( void *, void *);
434 static void int2uint_sat( void *, void *);
435 static void int2float_sat( void *, void *);
436 static void int2double_sat( void *, void *);
437 static void int2ulong_sat( void *, void *);
438 static void int2long_sat( void *, void *);
439 static void float2uchar_sat( void *, void *);
440 static void float2char_sat( void *, void *);
441 static void float2ushort_sat( void *, void *);
442 static void float2short_sat( void *, void *);
443 static void float2uint_sat( void *, void *);
444 static void float2int_sat( void *, void *);
445 static void float2double_sat( void *, void *);
446 static void float2ulong_sat( void *, void *);
447 static void float2long_sat( void *, void *);
448 static void double2uchar_sat( void *, void *);
449 static void double2char_sat( void *, void *);
450 static void double2ushort_sat( void *, void *);
451 static void double2short_sat( void *, void *);
452 static void double2uint_sat( void *, void *);
453 static void double2int_sat( void *, void *);
454 static void double2float_sat( void *, void *);
455 static void double2ulong_sat( void *, void *);
456 static void double2long_sat( void *, void *);
457 static void ulong2uchar_sat( void *, void *);
458 static void ulong2char_sat( void *, void *);
459 static void ulong2ushort_sat( void *, void *);
460 static void ulong2short_sat( void *, void *);
461 static void ulong2uint_sat( void *, void *);
462 static void ulong2int_sat( void *, void *);
463 static void ulong2float_sat( void *, void *);
464 static void ulong2double_sat( void *, void *);
465 static void ulong2long_sat( void *, void *);
466 static void long2uchar_sat( void *, void *);
467 static void long2char_sat( void *, void *);
468 static void long2ushort_sat( void *, void *);
469 static void long2short_sat( void *, void *);
470 static void long2uint_sat( void *, void *);
471 static void long2int_sat( void *, void *);
472 static void long2float_sat( void *, void *);
473 static void long2double_sat( void *, void *);
474 static void long2ulong_sat( void *, void *);
475 /*
476     #include <stdio.h>
477 
478     const char *names[] = { "uchar", "char", "ushort", "short", "uint", "int", "float", "double", "ulong", "long" };
479 
480     int main( void )
481     {
482 
483         int i,j;
484 
485         for( i = 0; i < sizeof( names ) / sizeof( names[0] ); i++ )
486         {
487             vlog( "{ " );
488             for( j = 0; j < sizeof( names ) / sizeof( names[0] ); j++ )
489             {
490                 if( j == i )
491                     vlog( "             NULL, " );
492                 else
493                 {
494                     char s[64];
495                     sprintf( s, "%s2%s_sat,", names[j], names[i] );
496                     vlog( "%18s ", s );
497                 }
498             }
499             vlog( "},\n" );
500         }
501 
502         return 0;
503     }
504 
505 Convert gSaturatedConversions[kTypeCount][kTypeCount] = {
506 {              NULL,    char2uchar_sat,  ushort2uchar_sat,   short2uchar_sat,    uint2uchar_sat,     int2uchar_sat,   float2uchar_sat,  double2uchar_sat,   ulong2uchar_sat,    long2uchar_sat, },
507 {    uchar2char_sat,              NULL,   ushort2char_sat,    short2char_sat,     uint2char_sat,      int2char_sat,    float2char_sat,   double2char_sat,    ulong2char_sat,     long2char_sat, },
508 {  uchar2ushort_sat,   char2ushort_sat,              NULL,  short2ushort_sat,   uint2ushort_sat,    int2ushort_sat,  float2ushort_sat, double2ushort_sat,  ulong2ushort_sat,   long2ushort_sat, },
509 {   uchar2short_sat,    char2short_sat,  ushort2short_sat,              NULL,    uint2short_sat,     int2short_sat,   float2short_sat,  double2short_sat,   ulong2short_sat,    long2short_sat, },
510 {    uchar2uint_sat,     char2uint_sat,   ushort2uint_sat,    short2uint_sat,              NULL,      int2uint_sat,    float2uint_sat,   double2uint_sat,    ulong2uint_sat,     long2uint_sat, },
511 {     uchar2int_sat,      char2int_sat,    ushort2int_sat,     short2int_sat,      uint2int_sat,              NULL,     float2int_sat,    double2int_sat,     ulong2int_sat,      long2int_sat, },
512 {   uchar2float_sat,    char2float_sat,  ushort2float_sat,   short2float_sat,    uint2float_sat,     int2float_sat,              NULL,  double2float_sat,   ulong2float_sat,    long2float_sat, },
513 {  uchar2double_sat,   char2double_sat, ushort2double_sat,  short2double_sat,   uint2double_sat,    int2double_sat,  float2double_sat,              NULL,  ulong2double_sat,   long2double_sat, },
514 {   uchar2ulong_sat,    char2ulong_sat,  ushort2ulong_sat,   short2ulong_sat,    uint2ulong_sat,     int2ulong_sat,   float2ulong_sat,  double2ulong_sat,              NULL,    long2ulong_sat, },
515 {    uchar2long_sat,     char2long_sat,   ushort2long_sat,    short2long_sat,     uint2long_sat,      int2long_sat,    float2long_sat,   double2long_sat,    ulong2long_sat,              NULL, }
516 };
517 */
518 
519 /*
520     #include <stdio.h>
521 
522     const char *names[] = { "uchar", "char", "ushort", "short", "uint", "int", "float", "double", "ulong", "long" };
523     const char *types[] = { "uchar", "char", "ushort", "short", "uint", "int", "float", "double", "ulong", "llong" };
524 
525     int main( void )
526     {
527 
528         int i,j;
529 
530         for( i = 0; i < sizeof( names ) / sizeof( names[0] ); i++ )
531             for( j = 0; j < sizeof( names ) / sizeof( names[0] ); j++ )
532             {
533                 if( j == i )
534                     continue;
535 
536                 switch( i )
537                 {
538                     case 6: //float
539                         if( j == 7 )
540                             vlog( "void %s2%s( void *out, void *in){ ((%s*) out)[0] = (%s) ((%s*) in)[0]; }\n", names[i], names[i], names[j], types[j], types[i] );
541                         else
542                             vlog( "void %s2%s( void *out, void *in){ ((%s*) out)[0] = (%s) my_rintf(((%s*) in)[0]); }\n", names[i], names[i], names[j], types[j], types[i] );
543                         break;
544                     case 7: //double
545                         if( j == 6 )
546                             vlog( "void %s2%s( void *out, void *in){ ((%s*) out)[0] = (%s) ((%s*) in)[0]; }\n", names[i], names[i], names[j], types[j], types[i] );
547                         else
548                             vlog( "void %s2%s( void *out, void *in){ ((%s*) out)[0] = (%s) rint(((%s*) in)[0]); }\n", names[i], names[i], names[j], types[j], types[i] );
549                         break;
550                     default:
551                         vlog( "void %s2%s( void *out, void *in){ ((%s*) out)[0] = (%s)
552                         ((%s*) in)[0]; }\n", names[i], names[i], names[j], types[j], types[i] );
553                         break;
554                 }
555             }
556 
557 
558         return 0;
559     }
560 */
561 
my_fabsf(float x)562 float my_fabsf( float x )
563 {
564     union{ cl_uint u; float f; }u;
565     u.f = x;
566     u.u &= 0x7fffffff;
567     return u.f;
568 }
569 
my_fabs(double x)570 double my_fabs( double x )
571 {
572     union{ cl_ulong u; double f; }u;
573     u.f = x;
574     u.u &= 0x7fffffffffffffffULL;
575     return u.f;
576 }
577 
578 static float my_rintf( float f );
my_rintf(float f)579 static float my_rintf( float f )
580 {
581     static const float magic[2] = { MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23), - MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23) };
582 
583     // Round fractional values to integer in round towards nearest mode
584     if( fabsf(f) < MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23 ) )
585     {
586         volatile float x = f;
587         float magicVal = magic[ f < 0 ];
588 
589 #if defined( __SSE__ )
590         // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly
591         __m128 v = _mm_set_ss( x );
592         __m128 m = _mm_set_ss( magicVal );
593         v = _mm_add_ss( v, m );
594         v = _mm_sub_ss( v, m );
595         _mm_store_ss( (float*) &x, v );
596 #else
597         x += magicVal;
598         x -= magicVal;
599 #endif
600         f = x;
601     }
602 
603     return f;
604 }
605 
uchar2char(void * out,void * in)606 static void uchar2char( void *out, void *in){ ((char*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2ushort(void * out,void * in)607 static void uchar2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2short(void * out,void * in)608 static void uchar2short( void *out, void *in){ ((short*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2uint(void * out,void * in)609 static void uchar2uint( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2int(void * out,void * in)610 static void uchar2int( void *out, void *in){ ((int*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2float(void * out,void * in)611 static void uchar2float( void *out, void *in)
612 {
613     cl_uchar l = ((cl_uchar*) in)[0];
614     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
615 }
uchar2double(void * out,void * in)616 static void uchar2double( void *out, void *in)
617 {
618     cl_uchar l = ((cl_uchar*) in)[0];
619     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
620 }
uchar2ulong(void * out,void * in)621 static void uchar2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2long(void * out,void * in)622 static void uchar2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_uchar*) in)[0]; }
char2uchar(void * out,void * in)623 static void char2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = ((cl_char*) in)[0]; }
char2ushort(void * out,void * in)624 static void char2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_char*) in)[0]; }
char2short(void * out,void * in)625 static void char2short( void *out, void *in){ ((short*) out)[0] = ((cl_char*) in)[0]; }
char2uint(void * out,void * in)626 static void char2uint( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_char*) in)[0]; }
char2int(void * out,void * in)627 static void char2int( void *out, void *in){ ((int*) out)[0] = ((cl_char*) in)[0]; }
char2float(void * out,void * in)628 static void char2float( void *out, void *in)
629 {
630     cl_char l = ((cl_char*) in)[0];
631     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
632 }
char2double(void * out,void * in)633 static void char2double( void *out, void *in)
634 {
635     cl_char l = ((cl_char*) in)[0];
636     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
637 }
char2ulong(void * out,void * in)638 static void char2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_char*) in)[0]; }
char2long(void * out,void * in)639 static void char2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_char*) in)[0]; }
ushort2uchar(void * out,void * in)640 static void ushort2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2char(void * out,void * in)641 static void ushort2char( void *out, void *in){ ((char*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2short(void * out,void * in)642 static void ushort2short( void *out, void *in){ ((short*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2uint(void * out,void * in)643 static void ushort2uint( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2int(void * out,void * in)644 static void ushort2int( void *out, void *in){ ((int*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2float(void * out,void * in)645 static void ushort2float( void *out, void *in)
646 {
647     cl_ushort l = ((cl_ushort*) in)[0];
648     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
649 }
ushort2double(void * out,void * in)650 static void ushort2double( void *out, void *in)
651 {
652     cl_ushort l = ((cl_ushort*) in)[0];
653     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
654 }
ushort2ulong(void * out,void * in)655 static void ushort2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2long(void * out,void * in)656 static void ushort2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_ushort*) in)[0]; }
short2uchar(void * out,void * in)657 static void short2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = ((cl_short*) in)[0]; }
short2char(void * out,void * in)658 static void short2char( void *out, void *in){ ((cl_char*) out)[0] = ((cl_short*) in)[0]; }
short2ushort(void * out,void * in)659 static void short2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_short*) in)[0]; }
short2uint(void * out,void * in)660 static void short2uint( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_short*) in)[0]; }
short2int(void * out,void * in)661 static void short2int( void *out, void *in){ ((cl_int*) out)[0] = ((cl_short*) in)[0]; }
short2float(void * out,void * in)662 static void short2float( void *out, void *in)
663 {
664     cl_short l = ((cl_short*) in)[0];
665     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
666 }
short2double(void * out,void * in)667 static void short2double( void *out, void *in)
668 {
669     cl_short l = ((cl_short*) in)[0];
670     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
671 }
short2ulong(void * out,void * in)672 static void short2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_short*) in)[0]; }
short2long(void * out,void * in)673 static void short2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_short*) in)[0]; }
uint2uchar(void * out,void * in)674 static void uint2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = ((cl_uint*) in)[0]; }
uint2char(void * out,void * in)675 static void uint2char( void *out, void *in){ ((cl_char*) out)[0] = ((cl_uint*) in)[0]; }
uint2ushort(void * out,void * in)676 static void uint2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_uint*) in)[0]; }
uint2short(void * out,void * in)677 static void uint2short( void *out, void *in){ ((short*) out)[0] = ((cl_uint*) in)[0]; }
uint2int(void * out,void * in)678 static void uint2int( void *out, void *in){ ((cl_int*) out)[0] = ((cl_uint*) in)[0]; }
uint2float(void * out,void * in)679 static void uint2float( void *out, void *in)
680 {
681     // Use volatile to prevent optimization by Clang compiler
682     volatile cl_uint l = ((cl_uint *)in)[0];
683     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
684 }
uint2double(void * out,void * in)685 static void uint2double( void *out, void *in)
686 {
687     cl_uint l = ((cl_uint*) in)[0];
688     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
689 }
uint2ulong(void * out,void * in)690 static void uint2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_uint*) in)[0]; }
uint2long(void * out,void * in)691 static void uint2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_uint*) in)[0]; }
int2uchar(void * out,void * in)692 static void int2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = ((cl_int*) in)[0]; }
int2char(void * out,void * in)693 static void int2char( void *out, void *in){ ((cl_char*) out)[0] = ((cl_int*) in)[0]; }
int2ushort(void * out,void * in)694 static void int2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_int*) in)[0]; }
int2short(void * out,void * in)695 static void int2short( void *out, void *in){ ((cl_short*) out)[0] = ((cl_int*) in)[0]; }
int2uint(void * out,void * in)696 static void int2uint( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_int*) in)[0]; }
int2float(void * out,void * in)697 static void int2float( void *out, void *in)
698 {
699     cl_int l = ((cl_int*) in)[0];
700     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
701 }
int2double(void * out,void * in)702 static void int2double( void *out, void *in)
703 {
704     cl_int l = ((cl_int*) in)[0];
705     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
706 }
int2ulong(void * out,void * in)707 static void int2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_int*) in)[0]; }
int2long(void * out,void * in)708 static void int2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_int*) in)[0]; }
float2uchar(void * out,void * in)709 static void float2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2char(void * out,void * in)710 static void float2char( void *out, void *in){ ((cl_char*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2ushort(void * out,void * in)711 static void float2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2short(void * out,void * in)712 static void float2short( void *out, void *in){ ((cl_short*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2uint(void * out,void * in)713 static void float2uint( void *out, void *in){ ((cl_uint*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2int(void * out,void * in)714 static void float2int( void *out, void *in){ ((cl_int*) out)[0] = my_rintf(((cl_float*) in)[0]); }
float2double(void * out,void * in)715 static void float2double( void *out, void *in){ ((cl_double*) out)[0] = ((cl_float*) in)[0]; }
float2ulong(void * out,void * in)716 static void float2ulong( void *out, void *in)
717 {
718 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
719     // VS2005 (at least) on x86 uses fistp to store the float as a 64-bit int.
720     // However, fistp stores it as a signed int, and some of the test values won't
721     // fit into a signed int. (These test values are >= 2^63.) The result on VS2005
722     // is that these end up silently (at least by default settings) clamped to
723     // the max lowest ulong.
724     cl_float x = my_rintf(((cl_float *)in)[0]);
725     if (x >= 9223372036854775808.0f) {
726         x -= 9223372036854775808.0f;
727         ((cl_ulong*) out)[0] = x;
728         ((cl_ulong*) out)[0] += 9223372036854775808ULL;
729     } else {
730         ((cl_ulong*) out)[0] = x;
731     }
732 #else
733     ((cl_ulong*) out)[0] = my_rintf(((cl_float*) in)[0]);
734 #endif
735 }
736 
float2long(void * out,void * in)737 static void float2long( void *out, void *in){ ((cl_long*) out)[0] =  llrint_clamped( ((cl_float*) in)[0] ); }
double2uchar(void * out,void * in)738 static void double2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = rint(((cl_double*) in)[0]); }
double2char(void * out,void * in)739 static void double2char( void *out, void *in){ ((cl_char*) out)[0] = rint(((cl_double*) in)[0]); }
double2ushort(void * out,void * in)740 static void double2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = rint(((cl_double*) in)[0]); }
double2short(void * out,void * in)741 static void double2short( void *out, void *in){ ((cl_short*) out)[0] = rint(((cl_double*) in)[0]); }
double2uint(void * out,void * in)742 static void double2uint( void *out, void *in){ ((cl_uint*) out)[0] = (cl_uint) rint(((cl_double*) in)[0]); }
double2int(void * out,void * in)743 static void double2int( void *out, void *in){ ((cl_int*) out)[0] = (int) rint(((cl_double*) in)[0]); }
double2float(void * out,void * in)744 static void double2float( void *out, void *in){ ((cl_float*) out)[0] = (float) ((cl_double*) in)[0]; }
double2ulong(void * out,void * in)745 static void double2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = (cl_ulong) rint(((cl_double*) in)[0]); }
double2long(void * out,void * in)746 static void double2long( void *out, void *in){ ((cl_long*) out)[0] = (cl_long) rint(((cl_double*) in)[0]); }
ulong2uchar(void * out,void * in)747 static void ulong2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = (cl_uchar) ((cl_ulong*) in)[0]; }
ulong2char(void * out,void * in)748 static void ulong2char( void *out, void *in){ ((cl_char*) out)[0] = (cl_char) ((cl_ulong*) in)[0]; }
ulong2ushort(void * out,void * in)749 static void ulong2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = (cl_ushort) ((cl_ulong*) in)[0]; }
ulong2short(void * out,void * in)750 static void ulong2short( void *out, void *in){ ((cl_short*) out)[0] = (cl_short)((cl_ulong*) in)[0]; }
ulong2uint(void * out,void * in)751 static void ulong2uint( void *out, void *in){ ((cl_uint*) out)[0] = (cl_uint) ((cl_ulong*) in)[0]; }
ulong2int(void * out,void * in)752 static void ulong2int( void *out, void *in){ ((cl_int*) out)[0] = (cl_int) ((cl_ulong*) in)[0]; }
ulong2float(void * out,void * in)753 static void ulong2float( void *out, void *in)
754 {
755 #if defined(_MSC_VER) && defined(_M_X64)
756     cl_ulong l = ((cl_ulong*) in)[0];
757     float result;
758     cl_long sl = ((cl_long)l < 0) ? (cl_long)((l >> 1) | (l & 1)) : (cl_long)l;
759     _mm_store_ss(&result, _mm_cvtsi64_ss(_mm_setzero_ps(), sl));
760     ((float*) out)[0] = (l == 0 ? 0.0f : (((cl_long)l < 0) ? result * 2.0f : result));
761 #else
762     cl_ulong l = ((cl_ulong*) in)[0];
763 #if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__)
764     /* ARM VFP doesn't have hardware instruction for converting from 64-bit
765      * integer to float types, hence GCC ARM uses the floating-point emulation
766      * code despite which -mfloat-abi setting it is. But the emulation code in
767      * libgcc.a has only one rounding mode (round to nearest even in this case)
768      * and ignores the user rounding mode setting in hardware.
769      * As a result setting rounding modes in hardware won't give correct
770      * rounding results for type covert from 64-bit integer to float using GCC
771      * for ARM compiler so for testing different rounding modes, we need to use
772      * alternative reference function. ARM64 does have an instruction, however
773      * we cannot guarantee the compiler will use it.  On all ARM architechures
774      * use emulation to calculate reference.*/
775     ((float*) out)[0] = qcom_u64_2_f32(l, qcom_sat, qcom_rm);
776 #else
777     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
778 #endif
779 #endif
780 }
ulong2double(void * out,void * in)781 static void ulong2double( void *out, void *in)
782 {
783 #if defined(_MSC_VER)
784     cl_ulong l = ((cl_ulong*) in)[0];
785     double result;
786 
787     cl_long sl = ((cl_long)l < 0) ? (cl_long)((l >> 1) | (l & 1)) : (cl_long)l;
788 #if defined(_M_X64)
789     _mm_store_sd(&result, _mm_cvtsi64_sd(_mm_setzero_pd(), sl));
790 #else
791     result = sl;
792 #endif
793     ((double*) out)[0] = (l == 0 ? 0.0 : (((cl_long)l < 0) ? result * 2.0 : result));
794 #else
795     // Use volatile to prevent optimization by Clang compiler
796     volatile cl_ulong l = ((cl_ulong *)in)[0];
797     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
798 #endif
799 }
ulong2long(void * out,void * in)800 static void ulong2long( void *out, void *in){ ((cl_long*) out)[0] = ((cl_ulong*) in)[0]; }
long2uchar(void * out,void * in)801 static void long2uchar( void *out, void *in){ ((cl_uchar*) out)[0] = (cl_uchar) ((cl_long*) in)[0]; }
long2char(void * out,void * in)802 static void long2char( void *out, void *in){ ((cl_char*) out)[0] = (cl_char) ((cl_long*) in)[0]; }
long2ushort(void * out,void * in)803 static void long2ushort( void *out, void *in){ ((cl_ushort*) out)[0] = (cl_ushort) ((cl_long*) in)[0]; }
long2short(void * out,void * in)804 static void long2short( void *out, void *in){ ((cl_short*) out)[0] = (cl_short) ((cl_long*) in)[0]; }
long2uint(void * out,void * in)805 static void long2uint( void *out, void *in){ ((cl_uint*) out)[0] = (cl_uint) ((cl_long*) in)[0]; }
long2int(void * out,void * in)806 static void long2int( void *out, void *in){ ((cl_int*) out)[0] = (cl_int) ((cl_long*) in)[0]; }
long2float(void * out,void * in)807 static void long2float( void *out, void *in)
808 {
809 #if defined(_MSC_VER) && defined(_M_X64)
810     cl_long l = ((cl_long*) in)[0];
811     float result;
812 
813     _mm_store_ss(&result, _mm_cvtsi64_ss(_mm_setzero_ps(), l));
814     ((float*) out)[0] = (l == 0 ? 0.0f : result);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
815 #else
816     cl_long l = ((cl_long*) in)[0];
817 #if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__)
818     /* ARM VFP doesn't have hardware instruction for converting from 64-bit
819      * integer to float types, hence GCC ARM uses the floating-point emulation
820      * code despite which -mfloat-abi setting it is. But the emulation code in
821      * libgcc.a has only one rounding mode (round to nearest even in this case)
822      * and ignores the user rounding mode setting in hardware.
823      * As a result setting rounding modes in hardware won't give correct
824      * rounding results for type covert from 64-bit integer to float using GCC
825      * for ARM compiler so for testing different rounding modes, we need to use
826      * alternative reference function. ARM64 does have an instruction, however
827      * we cannot guarantee the compiler will use it.  On all ARM architechures
828      * use emulation to calculate reference.*/
829     ((float*) out)[0] = (l == 0 ? 0.0f : qcom_s64_2_f32(l, qcom_sat, qcom_rm));
830 #else
831     ((float*) out)[0] = (l == 0 ? 0.0f : (float) l);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
832 #endif
833 #endif
834 }
long2double(void * out,void * in)835 static void long2double( void *out, void *in)
836 {
837 #if defined(_MSC_VER) && defined(_M_X64)
838     cl_long l = ((cl_long*) in)[0];
839     double result;
840 
841     _mm_store_sd(&result, _mm_cvtsi64_sd(_mm_setzero_pd(), l));
842     ((double*) out)[0] = (l == 0 ? 0.0 : result);        // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
843 #else
844     cl_long l = ((cl_long*) in)[0];
845     ((double*) out)[0] = (l == 0 ? 0.0 : (double) l);      // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0
846 #endif
847 }
long2ulong(void * out,void * in)848 static void long2ulong( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_long*) in)[0]; }
849 
850 #define CLAMP( _lo, _x, _hi )   ( (_x) < (_lo) ? (_lo) : ((_x) > (_hi) ? (_hi) : (_x)))
851 
852 // Done by hand
uchar2char_sat(void * out,void * in)853 static void uchar2char_sat( void *out, void *in){ cl_uchar c = ((cl_uchar*) in)[0]; ((cl_char*) out)[0] = c > 0x7f ? 0x7f : c; }
uchar2ushort_sat(void * out,void * in)854 static void uchar2ushort_sat( void *out, void *in){ ((cl_ushort*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2short_sat(void * out,void * in)855 static void uchar2short_sat( void *out, void *in){ ((cl_short*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2uint_sat(void * out,void * in)856 static void uchar2uint_sat( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2int_sat(void * out,void * in)857 static void uchar2int_sat( void *out, void *in){ ((cl_int*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2float_sat(void * out,void * in)858 static void uchar2float_sat( void *out, void *in){ ((cl_float*) out)[0] = my_fabsf( (cl_float) ((cl_uchar*) in)[0]); } // my_fabs workaround for <rdar://problem/5965527>
uchar2double_sat(void * out,void * in)859 static void uchar2double_sat( void *out, void *in){ ((cl_double*) out)[0] = my_fabs( (cl_double) ((cl_uchar*) in)[0]); } // my_fabs workaround for <rdar://problem/5965527>
uchar2ulong_sat(void * out,void * in)860 static void uchar2ulong_sat( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_uchar*) in)[0]; }
uchar2long_sat(void * out,void * in)861 static void uchar2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_uchar*) in)[0]; }
char2uchar_sat(void * out,void * in)862 static void char2uchar_sat( void *out, void *in){ cl_char c = ((cl_char*) in)[0]; ((cl_uchar*) out)[0] = c < 0 ? 0 : c; }
char2ushort_sat(void * out,void * in)863 static void char2ushort_sat( void *out, void *in){ cl_char c = ((cl_char*) in)[0]; ((cl_ushort*) out)[0] = c < 0 ? 0 : c; }
char2short_sat(void * out,void * in)864 static void char2short_sat( void *out, void *in){ ((cl_short*) out)[0] = ((cl_char*) in)[0]; }
char2uint_sat(void * out,void * in)865 static void char2uint_sat( void *out, void *in){ cl_char c = ((cl_char*) in)[0]; ((cl_uint*) out)[0] = c < 0 ? 0 : c; }
char2int_sat(void * out,void * in)866 static void char2int_sat( void *out, void *in){ ((cl_int*) out)[0] = ((cl_char*) in)[0]; }
char2float_sat(void * out,void * in)867 static void char2float_sat( void *out, void *in){ ((cl_float*) out)[0] = ((cl_char*) in)[0]; }
char2double_sat(void * out,void * in)868 static void char2double_sat( void *out, void *in){ ((cl_double*) out)[0] = ((cl_char*) in)[0]; }
char2ulong_sat(void * out,void * in)869 static void char2ulong_sat( void *out, void *in){ cl_char c = ((cl_char*) in)[0]; ((cl_ulong*) out)[0] = c < 0 ? 0 : c; }
char2long_sat(void * out,void * in)870 static void char2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_char*) in)[0]; }
ushort2uchar_sat(void * out,void * in)871 static void ushort2uchar_sat( void *out, void *in){ cl_ushort u = ((cl_ushort*) in)[0]; ((cl_uchar*) out)[0] = u > 0xff ? 0xFF : u; }
ushort2char_sat(void * out,void * in)872 static void ushort2char_sat( void *out, void *in){ cl_ushort u = ((cl_ushort*) in)[0]; ((cl_char*) out)[0] = u > 0x7f ? 0x7F : u; }
ushort2short_sat(void * out,void * in)873 static void ushort2short_sat( void *out, void *in){ cl_ushort u = ((cl_ushort*) in)[0]; ((cl_short*) out)[0] = u > 0x7fff ? 0x7fFF : u; }
ushort2uint_sat(void * out,void * in)874 static void ushort2uint_sat( void *out, void *in){ ((cl_uint*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2int_sat(void * out,void * in)875 static void ushort2int_sat( void *out, void *in){ ((cl_int*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2float_sat(void * out,void * in)876 static void ushort2float_sat( void *out, void *in){ ((cl_float*) out)[0] = my_fabsf((cl_float)((cl_ushort*) in)[0]); }     // my_fabs workaround for <rdar://problem/5965527>
ushort2double_sat(void * out,void * in)877 static void ushort2double_sat( void *out, void *in){ ((cl_double*) out)[0] = my_fabs( (cl_double) ((cl_ushort*) in)[0]); } // my_fabs workaround for <rdar://problem/5965527>
ushort2ulong_sat(void * out,void * in)878 static void ushort2ulong_sat( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_ushort*) in)[0]; }
ushort2long_sat(void * out,void * in)879 static void ushort2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_ushort*) in)[0]; }
short2uchar_sat(void * out,void * in)880 static void short2uchar_sat( void *out, void *in){ cl_short s = ((cl_short*) in)[0]; ((cl_uchar*) out)[0] = CLAMP( 0, s, CL_UCHAR_MAX ); }
short2char_sat(void * out,void * in)881 static void short2char_sat( void *out, void *in){ cl_short s = ((cl_short*) in)[0]; ((cl_char*) out)[0] = CLAMP( CL_CHAR_MIN, s, CL_CHAR_MAX ); }
short2ushort_sat(void * out,void * in)882 static void short2ushort_sat( void *out, void *in){ cl_short s = ((cl_short*) in)[0]; ((cl_ushort*) out)[0] = s < 0 ? 0 : s; }
short2uint_sat(void * out,void * in)883 static void short2uint_sat( void *out, void *in){ cl_short s = ((cl_short*) in)[0]; ((cl_uint*) out)[0] = s < 0 ? 0 : s; }
short2int_sat(void * out,void * in)884 static void short2int_sat( void *out, void *in){ ((cl_int*) out)[0] = ((cl_short*) in)[0]; }
short2float_sat(void * out,void * in)885 static void short2float_sat( void *out, void *in){ ((cl_float*) out)[0] = ((cl_short*) in)[0]; }
short2double_sat(void * out,void * in)886 static void short2double_sat( void *out, void *in){ ((cl_double*) out)[0] = ((cl_short*) in)[0]; }
short2ulong_sat(void * out,void * in)887 static void short2ulong_sat( void *out, void *in){ cl_short s = ((cl_short*) in)[0]; ((cl_ulong*) out)[0] = s < 0 ? 0 : s; }
short2long_sat(void * out,void * in)888 static void short2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_short*) in)[0]; }
uint2uchar_sat(void * out,void * in)889 static void uint2uchar_sat( void *out, void *in){ cl_uint u = ((cl_uint*) in)[0]; ((cl_uchar*) out)[0] = CLAMP( 0, u, CL_UCHAR_MAX); }
uint2char_sat(void * out,void * in)890 static void uint2char_sat( void *out, void *in){  cl_uint u = ((cl_uint*) in)[0]; ((cl_char*) out)[0] = CLAMP( 0, u, CL_CHAR_MAX ); }
uint2ushort_sat(void * out,void * in)891 static void uint2ushort_sat( void *out, void *in){  cl_uint u = ((cl_uint*) in)[0]; ((cl_ushort*) out)[0] = CLAMP( 0, u, CL_USHRT_MAX); }
uint2short_sat(void * out,void * in)892 static void uint2short_sat( void *out, void *in){  cl_uint u = ((cl_uint*) in)[0]; ((cl_short*) out)[0] = CLAMP( 0, u, CL_SHRT_MAX); }
uint2int_sat(void * out,void * in)893 static void uint2int_sat( void *out, void *in){  cl_uint u = ((cl_uint*) in)[0]; ((cl_int*) out)[0] = CLAMP( 0, u, CL_INT_MAX); }
uint2float_sat(void * out,void * in)894 static void uint2float_sat( void *out, void *in){ ((cl_float*) out)[0] = my_fabsf( (cl_float) ((cl_uint*) in)[0] ); }  // my_fabs workaround for <rdar://problem/5965527>
uint2double_sat(void * out,void * in)895 static void uint2double_sat( void *out, void *in){ ((cl_double*) out)[0] = my_fabs( (cl_double) ((cl_uint*) in)[0]); } // my_fabs workaround for <rdar://problem/5965527>
uint2ulong_sat(void * out,void * in)896 static void uint2ulong_sat( void *out, void *in){ ((cl_ulong*) out)[0] = ((cl_uint*) in)[0]; }
uint2long_sat(void * out,void * in)897 static void uint2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_uint*) in)[0]; }
int2uchar_sat(void * out,void * in)898 static void int2uchar_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_uchar*) out)[0] = CLAMP( 0, i, CL_UCHAR_MAX); }
int2char_sat(void * out,void * in)899 static void int2char_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_char*) out)[0] = CLAMP( CL_CHAR_MIN, i, CL_CHAR_MAX); }
int2ushort_sat(void * out,void * in)900 static void int2ushort_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_ushort*) out)[0] = CLAMP( 0, i, CL_USHRT_MAX); }
int2short_sat(void * out,void * in)901 static void int2short_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_short*) out)[0] = CLAMP( CL_SHRT_MIN, i, CL_SHRT_MAX); }
int2uint_sat(void * out,void * in)902 static void int2uint_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_uint*) out)[0] = CLAMP( 0, i, CL_INT_MAX); }
int2float_sat(void * out,void * in)903 static void int2float_sat( void *out, void *in){ ((cl_float*) out)[0] = ((cl_int*) in)[0]; }
int2double_sat(void * out,void * in)904 static void int2double_sat( void *out, void *in){ ((cl_double*) out)[0] = ((cl_int*) in)[0]; }
int2ulong_sat(void * out,void * in)905 static void int2ulong_sat( void *out, void *in){ cl_int i = ((cl_int*) in)[0]; ((cl_ulong*) out)[0] = i < 0 ? 0 : i; }
int2long_sat(void * out,void * in)906 static void int2long_sat( void *out, void *in){ ((cl_long*) out)[0] = ((cl_int*) in)[0]; }
float2uchar_sat(void * out,void * in)907 static void float2uchar_sat( void *out, void *in){ ((cl_uchar*) out)[0] = CLAMP( 0, lrintf_clamped(((cl_float*) in)[0]), CL_UCHAR_MAX ); }
float2char_sat(void * out,void * in)908 static void float2char_sat( void *out, void *in){ ((cl_char*) out)[0] = CLAMP( CL_CHAR_MIN, lrintf_clamped(((cl_float*) in)[0]), CL_CHAR_MAX); }
float2ushort_sat(void * out,void * in)909 static void float2ushort_sat( void *out, void *in){ ((cl_ushort*) out)[0] = CLAMP( 0, lrintf_clamped(((cl_float*) in)[0]), CL_USHRT_MAX ); }
float2short_sat(void * out,void * in)910 static void float2short_sat( void *out, void *in){ ((cl_short*) out)[0] = CLAMP( CL_SHRT_MIN, lrintf_clamped(((cl_float*) in)[0]), CL_SHRT_MAX ); }
float2uint_sat(void * out,void * in)911 static void float2uint_sat( void *out, void *in){ ((cl_uint*) out)[0] = (cl_uint) CLAMP( 0, llrintf_clamped(((cl_float*) in)[0]), CL_UINT_MAX ); }
float2int_sat(void * out,void * in)912 static void float2int_sat( void *out, void *in){ ((cl_int*) out)[0] = (cl_int) CLAMP( CL_INT_MIN, lrintf_clamped(((cl_float*) in)[0]), CL_INT_MAX ); }
float2double_sat(void * out,void * in)913 static void float2double_sat( void *out, void *in){ ((cl_double*) out)[0] = ((cl_float*) in)[0]; }
float2ulong_sat(void * out,void * in)914 static void float2ulong_sat( void *out, void *in)
915 {
916 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
917     // VS2005 (at least) on x86 uses fistp to store the float as a 64-bit int.
918     // However, fistp stores it as a signed int, and some of the test values won't
919     // fit into a signed int. (These test values are >= 2^63.) The result on VS2005
920     // is that these end up silently (at least by default settings) clamped to
921     // the max lowest ulong.
922     cl_float x = my_rintf(((cl_float *)in)[0]);
923     if (x >= 18446744073709551616.0f) {         // 2^64
924         ((cl_ulong*) out)[0] = 0xFFFFFFFFFFFFFFFFULL;
925     } else if (x < 0) {
926         ((cl_ulong*) out)[0] = 0;
927     } else if (x >= 9223372036854775808.0f) {   // 2^63
928         x -= 9223372036854775808.0f;
929         ((cl_ulong*) out)[0] = x;
930         ((cl_ulong*) out)[0] += 9223372036854775808ULL;
931     } else {
932         ((cl_ulong*) out)[0] = x;
933     }
934 #else
935     float f = my_rintf(((float*) in)[0]); ((cl_ulong*) out)[0] = f >= MAKE_HEX_DOUBLE(0x1.0p64, 0x1LL, 64) ? 0xFFFFFFFFFFFFFFFFULL : f < 0 ? 0 : (cl_ulong) f;
936 #endif
937 }
938 // The final cast used to be (cl_ulong) f, but on Linux (RHEL5 at least)
939 // if f = -1.0f, then (cl_ulong) f = 0xffffffff, which clearly isn't right.
940 // Switching it to (cl_long) f seems to fix that.
float2long_sat(void * out,void * in)941 static void float2long_sat( void *out, void *in){ float f = my_rintf(((float*) in)[0]); ((cl_long*) out)[0] = f >= MAKE_HEX_DOUBLE(0x1.0p63, 0x1LL, 63) ? 0x7FFFFFFFFFFFFFFFULL : f < MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63) ? 0x8000000000000000LL : (cl_long) f; }
double2uchar_sat(void * out,void * in)942 static void double2uchar_sat( void *out, void *in){ ((cl_uchar*) out)[0] = CLAMP( 0, lrint_clamped(((cl_double*) in)[0]), CL_UCHAR_MAX ); }
double2char_sat(void * out,void * in)943 static void double2char_sat( void *out, void *in){ ((cl_char*) out)[0] = CLAMP( CL_CHAR_MIN, lrint_clamped(((cl_double*) in)[0]), CL_CHAR_MAX); }
double2ushort_sat(void * out,void * in)944 static void double2ushort_sat( void *out, void *in){ ((cl_ushort*) out)[0] = CLAMP( 0, lrint_clamped(((cl_double*) in)[0]), CL_USHRT_MAX ); }
double2short_sat(void * out,void * in)945 static void double2short_sat( void *out, void *in){ ((cl_short*) out)[0] = CLAMP( CL_SHRT_MIN, lrint_clamped(((cl_double*) in)[0]), CL_SHRT_MAX ); }
double2uint_sat(void * out,void * in)946 static void double2uint_sat( void *out, void *in){ ((cl_uint*) out)[0] = (cl_uint) CLAMP( 0, llrint_clamped(((cl_double*) in)[0]), CL_UINT_MAX ); }
double2int_sat(void * out,void * in)947 static void double2int_sat( void *out, void *in){ ((cl_int*) out)[0] = (cl_int) CLAMP( CL_INT_MIN, lrint_clamped(((cl_double*) in)[0]), CL_INT_MAX ); }
double2float_sat(void * out,void * in)948 static void double2float_sat( void *out, void *in){ ((cl_float*) out)[0] = (cl_float) ((double*) in)[0]; }
double2ulong_sat(void * out,void * in)949 static void double2ulong_sat( void *out, void *in){ double f = rint(((double*) in)[0]); ((cl_ulong*) out)[0] = f >= MAKE_HEX_DOUBLE(0x1.0p64, 0x1LL, 64) ? 0xFFFFFFFFFFFFFFFFULL : f < 0 ? 0 : (cl_ulong) f; }
double2long_sat(void * out,void * in)950 static void double2long_sat( void *out, void *in){ double f = rint(((double*) in)[0]); ((cl_long*) out)[0] = f >= MAKE_HEX_DOUBLE(0x1.0p63, 0x1LL, 63) ? 0x7FFFFFFFFFFFFFFFULL : f < MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63) ? 0x8000000000000000LL : (cl_long) f; }
ulong2uchar_sat(void * out,void * in)951 static void ulong2uchar_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_uchar*) out)[0] = CLAMP( 0, u, CL_UCHAR_MAX ); }
ulong2char_sat(void * out,void * in)952 static void ulong2char_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_char*) out)[0] = CLAMP( 0, u, CL_CHAR_MAX ); }
ulong2ushort_sat(void * out,void * in)953 static void ulong2ushort_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_ushort*) out)[0] = CLAMP( 0, u, CL_USHRT_MAX ); }
ulong2short_sat(void * out,void * in)954 static void ulong2short_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_short*) out)[0] = CLAMP( 0, u, CL_SHRT_MAX ); }
ulong2uint_sat(void * out,void * in)955 static void ulong2uint_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_uint*) out)[0] = (cl_uint) CLAMP( 0, u, CL_UINT_MAX ); }
ulong2int_sat(void * out,void * in)956 static void ulong2int_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_int*) out)[0] = (cl_int) CLAMP( 0, u, CL_INT_MAX ); }
ulong2float_sat(void * out,void * in)957 static void ulong2float_sat( void *out, void *in){ ((float*) out)[0] = my_fabsf((float) ((cl_ulong*) in)[0]); }  // my_fabs workaround for <rdar://problem/5965527>
ulong2double_sat(void * out,void * in)958 static void ulong2double_sat( void *out, void *in){ ((double*) out)[0] = my_fabs( ((cl_ulong*) in)[0]); }        // my_fabs workaround for <rdar://problem/5965527>
ulong2long_sat(void * out,void * in)959 static void ulong2long_sat( void *out, void *in){ cl_ulong u = ((cl_ulong*) in)[0]; ((cl_long*) out)[0] = CLAMP( 0, u, CL_LONG_MAX ); }
long2uchar_sat(void * out,void * in)960 static void long2uchar_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_uchar*) out)[0] = CLAMP( 0, u, CL_UCHAR_MAX ); }
long2char_sat(void * out,void * in)961 static void long2char_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_char*) out)[0] = CLAMP( CL_CHAR_MIN, u, CL_CHAR_MAX ); }
long2ushort_sat(void * out,void * in)962 static void long2ushort_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_ushort*) out)[0] = CLAMP( 0, u, CL_USHRT_MAX ); }
long2short_sat(void * out,void * in)963 static void long2short_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_short*) out)[0] = CLAMP( CL_SHRT_MIN, u, CL_SHRT_MAX ); }
long2uint_sat(void * out,void * in)964 static void long2uint_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_uint*) out)[0] = (cl_uint) CLAMP( 0, u, CL_UINT_MAX ); }
long2int_sat(void * out,void * in)965 static void long2int_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_int*) out)[0] = (int) CLAMP( CL_INT_MIN, u, CL_INT_MAX ); }
long2float_sat(void * out,void * in)966 static void long2float_sat( void *out, void *in){ ((float*) out)[0] = (float) ((cl_long*) in)[0]; }
long2double_sat(void * out,void * in)967 static void long2double_sat( void *out, void *in){ ((double*) out)[0] = ((cl_long*) in)[0]; }
long2ulong_sat(void * out,void * in)968 static void long2ulong_sat( void *out, void *in){ cl_long u = ((cl_long*) in)[0]; ((cl_ulong*) out)[0] = CLAMP( 0, u, CL_LONG_MAX ); }
969 
970 /*
971 #include <stdio.h>
972 
973 char *ground[] = {   "",
974                                                             "_rte",
975                                                             "_rtp",
976                                                             "_rtn",
977                                                             "_rtz"
978                     };
979 
980 const char *gTypeNames[  ] = {
981                                             "uchar", "char",
982                                             "ushort", "short",
983                                             "uint",   "int",
984                                             "float", "double",
985                                             "ulong", "long"
986                                         };
987 
988 
989 int main( void )
990 {
991     int i, j;
992 
993     for( i = 0; i < sizeof( gTypeNames ) / sizeof( gTypeNames[0] ); i++ )
994         for( j = 0; j < sizeof( ground ) / sizeof( ground[0] ); j++ )
995         {
996             vlog( "float clampf_%s%s( float );\n", gTypeNames[i], ground[j] );
997             vlog( "double clampd_%s%s( double );\n", gTypeNames[i], ground[j] );
998         }
999 
1000     return 0;
1001 
1002 }
1003 */
1004 
1005 
1006 float clampf_uchar( float );
1007 double clampd_uchar( double );
1008 float clampf_uchar_rte( float );
1009 double clampd_uchar_rte( double );
1010 float clampf_uchar_rtp( float );
1011 double clampd_uchar_rtp( double );
1012 float clampf_uchar_rtn( float );
1013 double clampd_uchar_rtn( double );
1014 float clampf_uchar_rtz( float );
1015 double clampd_uchar_rtz( double );
1016 float clampf_char( float );
1017 double clampd_char( double );
1018 float clampf_char_rte( float );
1019 double clampd_char_rte( double );
1020 float clampf_char_rtp( float );
1021 double clampd_char_rtp( double );
1022 float clampf_char_rtn( float );
1023 double clampd_char_rtn( double );
1024 float clampf_char_rtz( float );
1025 double clampd_char_rtz( double );
1026 float clampf_ushort( float );
1027 double clampd_ushort( double );
1028 float clampf_ushort_rte( float );
1029 double clampd_ushort_rte( double );
1030 float clampf_ushort_rtp( float );
1031 double clampd_ushort_rtp( double );
1032 float clampf_ushort_rtn( float );
1033 double clampd_ushort_rtn( double );
1034 float clampf_ushort_rtz( float );
1035 double clampd_ushort_rtz( double );
1036 float clampf_short( float );
1037 double clampd_short( double );
1038 float clampf_short_rte( float );
1039 double clampd_short_rte( double );
1040 float clampf_short_rtp( float );
1041 double clampd_short_rtp( double );
1042 float clampf_short_rtn( float );
1043 double clampd_short_rtn( double );
1044 float clampf_short_rtz( float );
1045 double clampd_short_rtz( double );
1046 float clampf_uint( float );
1047 double clampd_uint( double );
1048 float clampf_uint_rte( float );
1049 double clampd_uint_rte( double );
1050 float clampf_uint_rtp( float );
1051 double clampd_uint_rtp( double );
1052 float clampf_uint_rtn( float );
1053 double clampd_uint_rtn( double );
1054 float clampf_uint_rtz( float );
1055 double clampd_uint_rtz( double );
1056 float clampf_int( float );
1057 double clampd_int( double );
1058 float clampf_int_rte( float );
1059 double clampd_int_rte( double );
1060 float clampf_int_rtp( float );
1061 double clampd_int_rtp( double );
1062 float clampf_int_rtn( float );
1063 double clampd_int_rtn( double );
1064 float clampf_int_rtz( float );
1065 double clampd_int_rtz( double );
1066 float clampf_float( float );
1067 double clampd_float( double );
1068 float clampf_float_rte( float );
1069 double clampd_float_rte( double );
1070 float clampf_float_rtp( float );
1071 double clampd_float_rtp( double );
1072 float clampf_float_rtn( float );
1073 double clampd_float_rtn( double );
1074 float clampf_float_rtz( float );
1075 double clampd_float_rtz( double );
1076 float clampf_double( float );
1077 double clampd_double( double );
1078 float clampf_double_rte( float );
1079 double clampd_double_rte( double );
1080 float clampf_double_rtp( float );
1081 double clampd_double_rtp( double );
1082 float clampf_double_rtn( float );
1083 double clampd_double_rtn( double );
1084 float clampf_double_rtz( float );
1085 double clampd_double_rtz( double );
1086 float clampf_ulong( float );
1087 double clampd_ulong( double );
1088 float clampf_ulong_rte( float );
1089 double clampd_ulong_rte( double );
1090 float clampf_ulong_rtp( float );
1091 double clampd_ulong_rtp( double );
1092 float clampf_ulong_rtn( float );
1093 double clampd_ulong_rtn( double );
1094 float clampf_ulong_rtz( float );
1095 double clampd_ulong_rtz( double );
1096 float clampf_long( float );
1097 double clampd_long( double );
1098 float clampf_long_rte( float );
1099 double clampd_long_rte( double );
1100 float clampf_long_rtp( float );
1101 double clampd_long_rtp( double );
1102 float clampf_long_rtn( float );
1103 double clampd_long_rtn( double );
1104 float clampf_long_rtz( float );
1105 double clampd_long_rtz( double );
1106 
1107 /*
1108 #include <stdio.h>
1109 
1110 char *ground[] = {   "",
1111                                                             "_rte",
1112                                                             "_rtp",
1113                                                             "_rtn",
1114                                                             "_rtz"
1115                     };
1116 
1117 const char *gTypeNames[  ] = {
1118                                             "uchar", "char",
1119                                             "ushort", "short",
1120                                             "uint",   "int",
1121                                             "float", "double",
1122                                             "ulong", "long"
1123                                         };
1124 
1125 
1126 int main( void )
1127 {
1128     int i, j;
1129 
1130     for( i = 0; i < sizeof( gTypeNames ) / sizeof( gTypeNames[0] ); i++ )
1131     {
1132         vlog( "{\t" );
1133         for( j = 0; j < sizeof( ground ) / sizeof( ground[0] ); j++ )
1134             vlog( "clampf_%s%s,\t", gTypeNames[i], ground[j] );
1135 
1136         vlog( "\t},\n" );
1137     }
1138 
1139     return 0;
1140 
1141 }
1142 */
1143 clampf gClampFloat[ kTypeCount ][kRoundingModeCount] = {
1144     {    clampf_uchar,    clampf_uchar_rte,    clampf_uchar_rtp,    clampf_uchar_rtn,    clampf_uchar_rtz,        },
1145     {    clampf_char,    clampf_char_rte,    clampf_char_rtp,    clampf_char_rtn,    clampf_char_rtz,        },
1146     {    clampf_ushort,    clampf_ushort_rte,    clampf_ushort_rtp,    clampf_ushort_rtn,    clampf_ushort_rtz,        },
1147     {    clampf_short,    clampf_short_rte,    clampf_short_rtp,    clampf_short_rtn,    clampf_short_rtz,        },
1148     {    clampf_uint,    clampf_uint_rte,    clampf_uint_rtp,    clampf_uint_rtn,    clampf_uint_rtz,        },
1149     {    clampf_int,     clampf_int_rte,     clampf_int_rtp,     clampf_int_rtn,     clampf_int_rtz,         },
1150     {    clampf_float,    clampf_float_rte,    clampf_float_rtp,    clampf_float_rtn,    clampf_float_rtz,        },
1151     {    clampf_double,    clampf_double_rte,    clampf_double_rtp,    clampf_double_rtn,    clampf_double_rtz,        },
1152     {    clampf_ulong,    clampf_ulong_rte,    clampf_ulong_rtp,    clampf_ulong_rtn,    clampf_ulong_rtz,        },
1153     {    clampf_long,    clampf_long_rte,    clampf_long_rtp,    clampf_long_rtn,    clampf_long_rtz,        }
1154 };
1155 
1156 clampd gClampDouble[ kTypeCount ][kRoundingModeCount] = {
1157     {    clampd_uchar,    clampd_uchar_rte,    clampd_uchar_rtp,    clampd_uchar_rtn,    clampd_uchar_rtz,        },
1158     {    clampd_char,    clampd_char_rte,    clampd_char_rtp,    clampd_char_rtn,    clampd_char_rtz,        },
1159     {    clampd_ushort,    clampd_ushort_rte,    clampd_ushort_rtp,    clampd_ushort_rtn,    clampd_ushort_rtz,        },
1160     {    clampd_short,    clampd_short_rte,    clampd_short_rtp,    clampd_short_rtn,    clampd_short_rtz,        },
1161     {    clampd_uint,    clampd_uint_rte,    clampd_uint_rtp,    clampd_uint_rtn,    clampd_uint_rtz,        },
1162     {    clampd_int,     clampd_int_rte,     clampd_int_rtp,     clampd_int_rtn,     clampd_int_rtz,         },
1163     {    clampd_float,    clampd_float_rte,    clampd_float_rtp,    clampd_float_rtn,    clampd_float_rtz,        },
1164     {    clampd_double,    clampd_double_rte,    clampd_double_rtp,    clampd_double_rtn,    clampd_double_rtz,        },
1165     {    clampd_ulong,    clampd_ulong_rte,    clampd_ulong_rtp,    clampd_ulong_rtn,    clampd_ulong_rtz,        },
1166     {    clampd_long,    clampd_long_rte,    clampd_long_rtp,    clampd_long_rtn,    clampd_long_rtz,        }
1167 };
1168 
1169 #if defined (_WIN32)
1170 #define __attribute__(X)
1171 #endif
1172 
1173 static inline float fclamp( float lo, float v, float hi ) __attribute__ ((always_inline));
1174 static inline double dclamp( double lo, double v, double hi ) __attribute__ ((always_inline));
1175 
fclamp(float lo,float v,float hi)1176 static inline float fclamp( float lo, float v, float hi ){ v = v < lo ? lo : v; return v < hi ? v : hi; }
dclamp(double lo,double v,double hi)1177 static inline double dclamp( double lo, double v, double hi ){ v = v < lo ? lo : v; return v < hi ? v : hi; }
1178 
1179 // Clamp unsaturated inputs into range so we don't get test errors:
clampf_uchar(float f)1180 float clampf_uchar( float f )       { return fclamp( -0.5f, f, 255.5f - 128.0f * FLT_EPSILON ); }
clampd_uchar(double f)1181 double clampd_uchar( double f )     { return dclamp( -0.5, f, 255.5 - 128.0 * DBL_EPSILON ); }
clampf_uchar_rte(float f)1182 float clampf_uchar_rte( float f )   { return fclamp( -0.5f, f, 255.5f - 128.0f * FLT_EPSILON ); }
clampd_uchar_rte(double f)1183 double clampd_uchar_rte( double f ) { return dclamp( -0.5, f, 255.5 - 128.0 * DBL_EPSILON ); }
clampf_uchar_rtp(float f)1184 float clampf_uchar_rtp( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, 255.0f ); }
clampd_uchar_rtp(double f)1185 double clampd_uchar_rtp( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, 255.0 ); }
clampf_uchar_rtn(float f)1186 float clampf_uchar_rtn( float f )   { return fclamp( -0.0f, f, 256.0f - 128.0f * FLT_EPSILON); }
clampd_uchar_rtn(double f)1187 double clampd_uchar_rtn( double f ) { return dclamp( -0.0, f, 256.0 - 128.0 * DBL_EPSILON); }
clampf_uchar_rtz(float f)1188 float clampf_uchar_rtz( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, 256.0f - 128.0f * FLT_EPSILON); }
clampd_uchar_rtz(double f)1189 double clampd_uchar_rtz( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, 256.0 - 128.0f * DBL_EPSILON); }
1190 
clampf_char(float f)1191 float clampf_char( float f )        { return fclamp( -128.5f, f, 127.5f - 64.f * FLT_EPSILON ); }
clampd_char(double f)1192 double clampd_char( double f )      { return dclamp( -128.5, f, 127.5 - 64. * DBL_EPSILON ); }
clampf_char_rte(float f)1193 float clampf_char_rte( float f )    { return fclamp( -128.5f, f, 127.5f - 64.f * FLT_EPSILON ); }
clampd_char_rte(double f)1194 double clampd_char_rte( double f )  { return dclamp( -128.5, f, 127.5 - 64. * DBL_EPSILON ); }
clampf_char_rtp(float f)1195 float clampf_char_rtp( float f )    { return fclamp( -129.0f + 128.f*FLT_EPSILON, f, 127.f ); }
clampd_char_rtp(double f)1196 double clampd_char_rtp( double f )  { return dclamp( -129.0 + 128.*DBL_EPSILON, f, 127. ); }
clampf_char_rtn(float f)1197 float clampf_char_rtn( float f )    { return fclamp( -128.0f, f, 128.f - 64.0f*FLT_EPSILON ); }
clampd_char_rtn(double f)1198 double clampd_char_rtn( double f )  { return dclamp( -128.0, f, 128. - 64.0*DBL_EPSILON ); }
clampf_char_rtz(float f)1199 float clampf_char_rtz( float f )    { return fclamp( -129.0f + 128.f*FLT_EPSILON, f, 128.f - 64.0f*FLT_EPSILON ); }
clampd_char_rtz(double f)1200 double clampd_char_rtz( double f )  { return dclamp( -129.0 + 128.*DBL_EPSILON, f, 128. - 64.0*DBL_EPSILON ); }
1201 
clampf_ushort(float f)1202 float clampf_ushort( float f )       { return fclamp( -0.5f, f, 65535.5f - 32768.0f * FLT_EPSILON ); }
clampd_ushort(double f)1203 double clampd_ushort( double f )     { return dclamp( -0.5, f, 65535.5 - 32768.0 * DBL_EPSILON ); }
clampf_ushort_rte(float f)1204 float clampf_ushort_rte( float f )   { return fclamp( -0.5f, f, 65535.5f - 32768.0f * FLT_EPSILON ); }
clampd_ushort_rte(double f)1205 double clampd_ushort_rte( double f ) { return dclamp( -0.5, f, 65535.5 - 32768.0 * DBL_EPSILON ); }
clampf_ushort_rtp(float f)1206 float clampf_ushort_rtp( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, 65535.0f ); }
clampd_ushort_rtp(double f)1207 double clampd_ushort_rtp( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, 65535.0 ); }
clampf_ushort_rtn(float f)1208 float clampf_ushort_rtn( float f )   { return fclamp( -0.0f, f, 65536.0f - 32768.0f * FLT_EPSILON); }
clampd_ushort_rtn(double f)1209 double clampd_ushort_rtn( double f ) { return dclamp( -0.0, f, 65536.0 - 32768.0 * DBL_EPSILON); }
clampf_ushort_rtz(float f)1210 float clampf_ushort_rtz( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, 65536.0f - 32768.0f * FLT_EPSILON); }
clampd_ushort_rtz(double f)1211 double clampd_ushort_rtz( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, 65536.0 - 32768.0f * DBL_EPSILON); }
1212 
clampf_short(float f)1213 float clampf_short( float f )        { return fclamp( -32768.5f, f, 32767.5f - 16384.f * FLT_EPSILON ); }
clampd_short(double f)1214 double clampd_short( double f )      { return dclamp( -32768.5, f, 32767.5 - 16384. * DBL_EPSILON ); }
clampf_short_rte(float f)1215 float clampf_short_rte( float f )    { return fclamp( -32768.5f, f, 32767.5f - 16384.f * FLT_EPSILON ); }
clampd_short_rte(double f)1216 double clampd_short_rte( double f )  { return dclamp( -32768.5, f, 32767.5 - 16384. * DBL_EPSILON ); }
clampf_short_rtp(float f)1217 float clampf_short_rtp( float f )    { return fclamp( -32769.0f + 32768.f*FLT_EPSILON, f, 32767.f ); }
clampd_short_rtp(double f)1218 double clampd_short_rtp( double f )  { return dclamp( -32769.0 + 32768.*DBL_EPSILON, f, 32767. ); }
clampf_short_rtn(float f)1219 float clampf_short_rtn( float f )    { return fclamp( -32768.0f, f, 32768.f - 16384.0f*FLT_EPSILON ); }
clampd_short_rtn(double f)1220 double clampd_short_rtn( double f )  { return dclamp( -32768.0, f, 32768. - 16384.0*DBL_EPSILON ); }
clampf_short_rtz(float f)1221 float clampf_short_rtz( float f )    { return fclamp( -32769.0f + 32768.f*FLT_EPSILON, f, 32768.f - 16384.0f*FLT_EPSILON ); }
clampd_short_rtz(double f)1222 double clampd_short_rtz( double f )  { return dclamp( -32769.0 + 32768.*DBL_EPSILON, f, 32768. - 16384.0*DBL_EPSILON ); }
1223 
clampf_uint(float f)1224 float clampf_uint( float f )        { return fclamp( -0.5f, f, MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffeL, 7) ); }
clampd_uint(double f)1225 double clampd_uint( double f )      { return dclamp( -0.5, f, CL_UINT_MAX + 0.5 - MAKE_HEX_DOUBLE(0x1.0p31, 0x1LL, 31) * DBL_EPSILON ); }
clampf_uint_rte(float f)1226 float clampf_uint_rte( float f )    { return fclamp( -0.5f, f, MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffeL, 7) ); }
clampd_uint_rte(double f)1227 double clampd_uint_rte( double f )  { return dclamp( -0.5, f, CL_UINT_MAX + 0.5 - MAKE_HEX_DOUBLE(0x1.0p31, 0x1LL, 31) * DBL_EPSILON ); }
clampf_uint_rtp(float f)1228 float clampf_uint_rtp( float f )    { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffeL, 7) ); }
clampd_uint_rtp(double f)1229 double clampd_uint_rtp( double f )  { return dclamp( -1.0 + DBL_EPSILON/2.0, f, CL_UINT_MAX ); }
clampf_uint_rtn(float f)1230 float clampf_uint_rtn( float f )    { return fclamp( -0.0f, f, MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffeL, 7)); }
clampd_uint_rtn(double f)1231 double clampd_uint_rtn( double f )  { return dclamp( -0.0, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp31, 0x1fffffffffffffLL, -21) ); }
clampf_uint_rtz(float f)1232 float clampf_uint_rtz( float f )    { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffeL, 7)); }
clampd_uint_rtz(double f)1233 double clampd_uint_rtz( double f )  { return dclamp( -1.0 + DBL_EPSILON/2.0, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp31, 0x1fffffffffffffLL, -21)); }
1234 
clampf_int(float f)1235 float clampf_int( float f )         { return fclamp( INT_MIN, f, MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffeL, 6) ); }
clampd_int(double f)1236 double clampd_int( double f )       { return dclamp( INT_MIN - 0.5, f, CL_INT_MAX + 0.5 - MAKE_HEX_DOUBLE(0x1.0p30, 0x1LL, 30) * DBL_EPSILON ); }
clampf_int_rte(float f)1237 float clampf_int_rte( float f )     { return fclamp( INT_MIN, f, MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffeL, 6) ); }
clampd_int_rte(double f)1238 double clampd_int_rte( double f )   { return dclamp( INT_MIN - 0.5, f, CL_INT_MAX + 0.5 - MAKE_HEX_DOUBLE(0x1.0p30, 0x1LL, 30) * DBL_EPSILON ); }
clampf_int_rtp(float f)1239 float clampf_int_rtp( float f )     { return fclamp( INT_MIN, f, MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffeL, 6) ); }
clampd_int_rtp(double f)1240 double clampd_int_rtp( double f )   { return dclamp( INT_MIN - 1.0 + DBL_EPSILON * MAKE_HEX_DOUBLE(0x1.0p31, 0x1LL, 31), f, CL_INT_MAX ); }
clampf_int_rtn(float f)1241 float clampf_int_rtn( float f )     { return fclamp( INT_MIN, f, MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffeL, 6) ); }
clampd_int_rtn(double f)1242 double clampd_int_rtn( double f )   { return dclamp( INT_MIN, f, CL_INT_MAX + 1.0 - MAKE_HEX_DOUBLE(0x1.0p30, 0x1LL, 30) * DBL_EPSILON ); }
clampf_int_rtz(float f)1243 float clampf_int_rtz( float f )     { return fclamp( INT_MIN, f, MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffeL, 6) ); }
clampd_int_rtz(double f)1244 double clampd_int_rtz( double f )   { return dclamp( INT_MIN - 1.0 + DBL_EPSILON * MAKE_HEX_DOUBLE(0x1.0p31, 0x1LL, 31), f, CL_INT_MAX + 1.0 - MAKE_HEX_DOUBLE(0x1.0p30, 0x1LL, 30) * DBL_EPSILON ); }
1245 
clampf_float(float f)1246 float clampf_float( float f ){ return f; }
clampd_float(double f)1247 double clampd_float( double f ){ return f; }
clampf_float_rte(float f)1248 float clampf_float_rte( float f ){ return f; }
clampd_float_rte(double f)1249 double clampd_float_rte( double f ){ return f; }
clampf_float_rtp(float f)1250 float clampf_float_rtp( float f ){ return f; }
clampd_float_rtp(double f)1251 double clampd_float_rtp( double f ){ return f; }
clampf_float_rtn(float f)1252 float clampf_float_rtn( float f ){ return f; }
clampd_float_rtn(double f)1253 double clampd_float_rtn( double f ){ return f; }
clampf_float_rtz(float f)1254 float clampf_float_rtz( float f ){ return f; }
clampd_float_rtz(double f)1255 double clampd_float_rtz( double f ){ return f; }
1256 
clampf_double(float f)1257 float clampf_double( float f ){ return f; }
clampd_double(double f)1258 double clampd_double( double f ){ return f; }
clampf_double_rte(float f)1259 float clampf_double_rte( float f ){ return f; }
clampd_double_rte(double f)1260 double clampd_double_rte( double f ){ return f; }
clampf_double_rtp(float f)1261 float clampf_double_rtp( float f ){ return f; }
clampd_double_rtp(double f)1262 double clampd_double_rtp( double f ){ return f; }
clampf_double_rtn(float f)1263 float clampf_double_rtn( float f ){ return f; }
clampd_double_rtn(double f)1264 double clampd_double_rtn( double f ){ return f; }
clampf_double_rtz(float f)1265 float clampf_double_rtz( float f ){ return f; }
clampd_double_rtz(double f)1266 double clampd_double_rtz( double f ){ return f; }
1267 
clampf_ulong(float f)1268 float clampf_ulong( float f )       { return fclamp( -0.5f, f, MAKE_HEX_FLOAT(0x1.fffffep63f, 0x1fffffeL, 39) ); }
clampd_ulong(double f)1269 double clampd_ulong( double f )     { return dclamp( -0.5, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp63, 0x1fffffffffffffLL, 11) ); }
clampf_ulong_rte(float f)1270 float clampf_ulong_rte( float f )   { return fclamp( -0.5f, f, MAKE_HEX_FLOAT(0x1.fffffep63f, 0x1fffffeL, 39) ); }
clampd_ulong_rte(double f)1271 double clampd_ulong_rte( double f ) { return dclamp( -0.5, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp63, 0x1fffffffffffffLL, 11) ); }
clampf_ulong_rtp(float f)1272 float clampf_ulong_rtp( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, MAKE_HEX_FLOAT(0x1.fffffep63f, 0x1fffffeL, 39) ); }
clampd_ulong_rtp(double f)1273 double clampd_ulong_rtp( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp63, 0x1fffffffffffffLL, 11) ); }
clampf_ulong_rtn(float f)1274 float clampf_ulong_rtn( float f )   { return fclamp( -0.0f, f, MAKE_HEX_FLOAT(0x1.fffffep63f, 0x1fffffeL, 39) ); }
clampd_ulong_rtn(double f)1275 double clampd_ulong_rtn( double f ) { return dclamp( -0.0, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp63, 0x1fffffffffffffLL, 11) ); }
clampf_ulong_rtz(float f)1276 float clampf_ulong_rtz( float f )   { return fclamp( -1.0f + FLT_EPSILON/2.0f, f, MAKE_HEX_FLOAT(0x1.fffffep63f, 0x1fffffeL, 39) ); }
clampd_ulong_rtz(double f)1277 double clampd_ulong_rtz( double f ) { return dclamp( -1.0 + DBL_EPSILON/2.0, f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp63, 0x1fffffffffffffLL, 11) ); }
1278 
clampf_long(float f)1279 float clampf_long( float f )        { return fclamp( MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), f, MAKE_HEX_FLOAT(0x1.fffffep62f, 0x1fffffeL, 38) ); }
clampd_long(double f)1280 double clampd_long( double f )      { return dclamp( MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp62, 0x1fffffffffffffLL, 10) ); }
clampf_long_rte(float f)1281 float clampf_long_rte( float f )    { return fclamp( MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), f, MAKE_HEX_FLOAT(0x1.fffffep62f, 0x1fffffeL, 38) ); }
clampd_long_rte(double f)1282 double clampd_long_rte( double f )  { return dclamp( MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp62, 0x1fffffffffffffLL, 10) ); }
clampf_long_rtp(float f)1283 float clampf_long_rtp( float f )    { return fclamp( MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), f, MAKE_HEX_FLOAT(0x1.fffffep62f, 0x1fffffeL, 38) ); }
clampd_long_rtp(double f)1284 double clampd_long_rtp( double f )  { return dclamp( MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp62, 0x1fffffffffffffLL, 10) ); }
clampf_long_rtn(float f)1285 float clampf_long_rtn( float f )    { return fclamp( MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), f, MAKE_HEX_FLOAT(0x1.fffffep62f, 0x1fffffeL, 38) ); }
clampd_long_rtn(double f)1286 double clampd_long_rtn( double f )  { return dclamp( MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp62, 0x1fffffffffffffLL, 10) ); }
clampf_long_rtz(float f)1287 float clampf_long_rtz( float f )    { return fclamp( MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), f, MAKE_HEX_FLOAT(0x1.fffffep62f, 0x1fffffeL, 38) ); }
clampd_long_rtz(double f)1288 double clampd_long_rtz( double f )  { return dclamp( MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), f, MAKE_HEX_DOUBLE(0x1.fffffffffffffp62, 0x1fffffffffffffLL, 10) ); }
1289 
1290 #pragma mark -
1291 
1292 int alwaysPass( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1293 int alwaysFail( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1294 int check_uchar( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1295 int check_char( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1296 int check_ushort( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1297 int check_short( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1298 int check_uint( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1299 int check_int( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1300 int check_ulong( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1301 int check_long( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1302 int check_float( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1303 int check_double( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
1304 
1305 void init_uchar( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1306 void init_char( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1307 void init_ushort( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1308 void init_short( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1309 void init_uint( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1310 void init_int( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1311 void init_float( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1312 void init_double( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1313 void init_ulong( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1314 void init_long( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
1315 
1316 InitDataFunc gInitFunctions[ kTypeCount ] = {
1317                                                 init_uchar, init_char,
1318                                                 init_ushort, init_short,
1319                                                 init_uint, init_int,
1320                                                 init_float, init_double,
1321                                                 init_ulong, init_long
1322                                             };
1323 
1324 
1325 CheckResults gCheckResults[ kTypeCount ] = {
1326                                                 check_uchar, check_char, check_ushort, check_short, check_uint,
1327                                                 check_int, check_float, check_double, check_ulong, check_long
1328                                             };
1329 #if !defined (__APPLE__)
1330 #define UNUSED
1331 #else
1332 #define UNUSED  __attribute__((unused))
1333 #endif
1334 
alwaysPass(void UNUSED * out1,void UNUSED * out2,void UNUSED * allowZ,uint32_t UNUSED count,int UNUSED vectorSize)1335 int alwaysPass( void UNUSED *out1, void UNUSED *out2, void UNUSED *allowZ, uint32_t UNUSED count, int UNUSED vectorSize){ return 0; }
alwaysFail(void UNUSED * out1,void UNUSED * out2,void UNUSED * allowZ,uint32_t UNUSED count,int UNUSED vectorSize)1336 int alwaysFail( void UNUSED *out1, void UNUSED *out2, void UNUSED *allowZ, uint32_t UNUSED count, int UNUSED vectorSize ){ return -1; }
1337 
check_uchar(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1338 int check_uchar( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1339 {
1340     const cl_uchar *t = (const cl_uchar*)test;
1341     const cl_uchar *c = (const cl_uchar*)correct;
1342     const cl_uchar *a = (const cl_uchar*)allowZ;
1343     uint32_t i;
1344 
1345     for( i = 0; i < count; i++ )
1346         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_uchar)0))
1347         {
1348             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%2.2x vs 0x%2.2x\n", vectorSize, i, c[i], t[i] );
1349             return i + 1;
1350         }
1351 
1352     return 0;
1353 }
1354 
check_char(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1355 int check_char( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1356 {
1357     const cl_char *t = (const cl_char*)test;
1358     const cl_char *c = (const cl_char*)correct;
1359     const cl_uchar *a = (const cl_uchar*)allowZ;
1360     uint32_t i;
1361 
1362     for( i = 0; i < count; i++ )
1363         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_char)0))
1364         {
1365             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%2.2x vs 0x%2.2x\n", vectorSize, i, c[i], t[i] );
1366             return i + 1;
1367         }
1368 
1369     return 0;
1370 }
1371 
check_ushort(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1372 int check_ushort( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1373 {
1374     const cl_ushort *t = (const cl_ushort*)test;
1375     const cl_ushort *c = (const cl_ushort*)correct;
1376     const cl_uchar *a = (const cl_uchar*)allowZ;
1377     uint32_t i;
1378 
1379     for( i = 0; i < count; i++ )
1380         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_ushort)0))
1381         {
1382             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%4.4x vs 0x%4.4x\n", vectorSize, i, c[i], t[i] );
1383             return i + 1;
1384         }
1385 
1386     return 0;
1387 }
1388 
check_short(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1389 int check_short( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1390 {
1391     const cl_short *t = (const cl_short*)test;
1392     const cl_short *c = (const cl_short*)correct;
1393     const cl_uchar *a = (const cl_uchar*)allowZ;
1394     uint32_t i;
1395 
1396     for( i = 0; i < count; i++ )
1397         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_short)0))
1398         {
1399             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%4.4x vs 0x%4.4x\n", vectorSize, i, c[i], t[i] );
1400             return i + 1;
1401         }
1402 
1403     return 0;
1404 }
1405 
check_uint(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1406 int check_uint( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1407 {
1408     const cl_uint *t = (const cl_uint*)test;
1409     const cl_uint *c = (const cl_uint*)correct;
1410     const cl_uchar *a = (const cl_uchar*)allowZ;
1411     uint32_t i;
1412 
1413     for( i = 0; i < count; i++ )
1414         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_uint)0))
1415         {
1416             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%8.8x vs 0x%8.8x\n", vectorSize, i, c[i], t[i] );
1417             return i + 1;
1418         }
1419 
1420     return 0;
1421 }
1422 
check_int(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1423 int check_int( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1424 {
1425     const cl_int *t = (const cl_int*)test;
1426     const cl_int *c = (const cl_int*)correct;
1427     const cl_uchar *a = (const cl_uchar*)allowZ;
1428     uint32_t i;
1429 
1430     for( i = 0; i < count; i++ )
1431         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_int)0))
1432         {
1433             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%8.8x vs 0x%8.8x\n", vectorSize, i, c[i], t[i] );
1434             return i + 1;
1435         }
1436 
1437     return 0;
1438 }
1439 
check_ulong(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1440 int check_ulong( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1441 {
1442     const cl_ulong *t = (const cl_ulong*)test;
1443     const cl_ulong *c = (const cl_ulong*)correct;
1444     const cl_uchar *a = (const cl_uchar*)allowZ;
1445     uint32_t i;
1446 
1447     for( i = 0; i < count; i++ )
1448         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_ulong)0))
1449         {
1450             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%16.16llx vs 0x%16.16llx\n", vectorSize, i, c[i], t[i] );
1451             return i + 1;
1452         }
1453 
1454     return 0;
1455 }
1456 
check_long(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1457 int check_long( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1458 {
1459     const cl_long *t = (const cl_long*)test;
1460     const cl_long *c = (const cl_long*)correct;
1461     const cl_uchar *a = (const cl_uchar*)allowZ;
1462     uint32_t i;
1463 
1464     for( i = 0; i < count; i++ )
1465         if( t[i] != c[i] && !(a[i] != (cl_uchar)0 && t[i] == (cl_long)0))
1466         {
1467             vlog( "\nError for vector size %d found at 0x%8.8x:  *0x%16.16llx vs 0x%16.16llx\n", vectorSize, i, c[i], t[i] );
1468             return i + 1;
1469         }
1470 
1471     return 0;
1472 }
1473 
check_float(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1474 int check_float( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1475 {
1476     const cl_uint *t = (const cl_uint*)test;
1477     const cl_uint *c = (const cl_uint*)correct;
1478     const cl_uchar *a = (const cl_uchar*)allowZ;
1479     uint32_t i;
1480 
1481     for( i = 0; i < count; i++ )
1482         if (t[i] != c[i] &&
1483             // Allow nan's to be binary different
1484             !((t[i] & 0x7fffffffU) > 0x7f800000U &&
1485               (c[i] & 0x7fffffffU) > 0x7f800000U) &&
1486             !(a[i] != (cl_uchar)0 &&
1487               t[i] == (c[i] & 0x80000000U))) {
1488             vlog( "\nError for vector size %d found at 0x%8.8x:  *%a vs %a\n",
1489                     vectorSize, i, ((float*)correct)[i], ((float*)test)[i] );
1490             return i + 1;
1491         }
1492 
1493     return 0;
1494 }
1495 
check_double(void * test,void * correct,void * allowZ,uint32_t count,int vectorSize)1496 int check_double( void *test, void *correct, void *allowZ, uint32_t count, int vectorSize )
1497 {
1498     const cl_ulong *t = (const cl_ulong*)test;
1499     const cl_ulong *c = (const cl_ulong*)correct;
1500     const cl_uchar *a = (const cl_uchar*)allowZ;
1501     uint32_t i;
1502 
1503     for( i = 0; i < count; i++ )
1504         if (t[i] != c[i] &&
1505             // Allow nan's to be binary different
1506             !((t[i] & 0x7fffffffffffffffULL) > 0x7ff0000000000000ULL &&
1507               (c[i] & 0x7fffffffffffffffULL) > 0x7f80000000000000ULL) &&
1508             !(a[i] != (cl_uchar)0 &&
1509               t[i] == (c[i] & 0x8000000000000000ULL))) {
1510             vlog( "\nError for vector size %d found at 0x%8.8x:  *%a vs %a\n",
1511                   vectorSize, i, ((double*)correct)[i], ((double*)test)[i] );
1512             return i + 1;
1513         }
1514 
1515     return 0;
1516 }
1517 
1518 
init_uchar(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata UNUSED d)1519 void init_uchar( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata UNUSED d )
1520 {
1521     cl_uchar *o = (cl_uchar *)out;
1522     int i;
1523 
1524     for( i = 0; i < count; i++ )
1525         o[i] = start++;
1526 }
1527 
init_char(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata UNUSED d)1528 void init_char( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata UNUSED d )
1529 {
1530     char *o = (char *)out;
1531     int i;
1532 
1533     for( i = 0; i < count; i++ )
1534         o[i] = start++;
1535 }
1536 
init_ushort(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata UNUSED d)1537 void init_ushort( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata UNUSED d )
1538 {
1539     cl_ushort *o = (cl_ushort *)out;
1540     int i;
1541 
1542     for( i = 0; i < count; i++ )
1543         o[i] = start++;
1544 }
1545 
init_short(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,UNUSED Type destType,uint64_t start,int count,MTdata UNUSED d)1546 void init_short( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, UNUSED Type destType, uint64_t start, int count, MTdata UNUSED d )
1547 {
1548     short *o = (short *)out;
1549     int i;
1550 
1551     for( i = 0; i < count; i++ )
1552         o[i] = start++;
1553 }
1554 
init_uint(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata d)1555 void init_uint( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata d )
1556 {
1557     static const unsigned int specialValuesUInt[] = {
1558     INT_MIN, INT_MIN + 1, INT_MIN + 2,
1559     -(1<<30)-3,-(1<<30)-2,-(1<<30)-1, -(1<<30), -(1<<30)+1, -(1<<30)+2, -(1<<30)+3,
1560     -(1<<24)-3,-(1<<24)-2,-(1<<24)-1, -(1<<24), -(1<<24)+1, -(1<<24)+2, -(1<<24)+3,
1561     -(1<<23)-3,-(1<<23)-2,-(1<<23)-1, -(1<<23), -(1<<23)+1, -(1<<23)+2, -(1<<23)+3,
1562     -(1<<22)-3,-(1<<22)-2,-(1<<22)-1, -(1<<22), -(1<<22)+1, -(1<<22)+2, -(1<<22)+3,
1563     -(1<<21)-3,-(1<<21)-2,-(1<<21)-1, -(1<<21), -(1<<21)+1, -(1<<21)+2, -(1<<21)+3,
1564     -(1<<16)-3,-(1<<16)-2,-(1<<16)-1, -(1<<16), -(1<<16)+1, -(1<<16)+2, -(1<<16)+3,
1565     -(1<<15)-3,-(1<<15)-2,-(1<<15)-1, -(1<<15), -(1<<15)+1, -(1<<15)+2, -(1<<15)+3,
1566     -(1<<8)-3,-(1<<8)-2,-(1<<8)-1, -(1<<8), -(1<<8)+1, -(1<<8)+2, -(1<<8)+3,
1567     -(1<<7)-3,-(1<<7)-2,-(1<<7)-1, -(1<<7), -(1<<7)+1, -(1<<7)+2, -(1<<7)+3,
1568     -4, -3, -2, -1, 0, 1, 2, 3, 4,
1569     (1<<7)-3,(1<<7)-2,(1<<7)-1, (1<<7), (1<<7)+1, (1<<7)+2, (1<<7)+3,
1570     (1<<8)-3,(1<<8)-2,(1<<8)-1, (1<<8), (1<<8)+1, (1<<8)+2, (1<<8)+3,
1571     (1<<15)-3,(1<<15)-2,(1<<15)-1, (1<<15), (1<<15)+1, (1<<15)+2, (1<<15)+3,
1572     (1<<16)-3,(1<<16)-2,(1<<16)-1, (1<<16), (1<<16)+1, (1<<16)+2, (1<<16)+3,
1573     (1<<21)-3,(1<<21)-2,(1<<21)-1, (1<<21), (1<<21)+1, (1<<21)+2, (1<<21)+3,
1574     (1<<22)-3,(1<<22)-2,(1<<22)-1, (1<<22), (1<<22)+1, (1<<22)+2, (1<<22)+3,
1575     (1<<23)-3,(1<<23)-2,(1<<23)-1, (1<<23), (1<<23)+1, (1<<23)+2, (1<<23)+3,
1576     (1<<24)-3,(1<<24)-2,(1<<24)-1, (1<<24), (1<<24)+1, (1<<24)+2, (1<<24)+3,
1577     (1<<30)-3,(1<<30)-2,(1<<30)-1, (1<<30), (1<<30)+1, (1<<30)+2, (1<<30)+3,
1578     INT_MAX-3, INT_MAX-2, INT_MAX-1, INT_MAX, // 0x80000000, 0x80000001 0x80000002 already covered above
1579     UINT_MAX-3, UINT_MAX-2, UINT_MAX-1, UINT_MAX
1580     };
1581 
1582     cl_uint *o = (cl_uint *)out;
1583     int i;
1584 
1585     for( i = 0; i < count; i++) {
1586     if( gIsEmbedded )
1587         o[i] = (cl_uint) genrand_int32(d);
1588     else
1589         o[i] = (cl_uint)i + start;
1590     }
1591 
1592     if( 0 == start )
1593     {
1594     size_t tableSize = sizeof( specialValuesUInt );
1595     if( sizeof( cl_uint) * count < tableSize )
1596         tableSize = sizeof( cl_uint) * count;
1597     memcpy( (char*)(o + i) - tableSize, specialValuesUInt, tableSize );
1598     }
1599 }
1600 
init_int(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata d)1601 void init_int( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata d )
1602 {
1603     static const unsigned int specialValuesInt[] = {
1604     INT_MIN, INT_MIN + 1, INT_MIN + 2,
1605     -(1<<30)-3,-(1<<30)-2,-(1<<30)-1, -(1<<30), -(1<<30)+1, -(1<<30)+2, -(1<<30)+3,
1606     -(1<<24)-3,-(1<<24)-2,-(1<<24)-1, -(1<<24), -(1<<24)+1, -(1<<24)+2, -(1<<24)+3,
1607     -(1<<23)-3,-(1<<23)-2,-(1<<23)-1, -(1<<23), -(1<<23)+1, -(1<<23)+2, -(1<<23)+3,
1608     -(1<<22)-3,-(1<<22)-2,-(1<<22)-1, -(1<<22), -(1<<22)+1, -(1<<22)+2, -(1<<22)+3,
1609     -(1<<21)-3,-(1<<21)-2,-(1<<21)-1, -(1<<21), -(1<<21)+1, -(1<<21)+2, -(1<<21)+3,
1610     -(1<<16)-3,-(1<<16)-2,-(1<<16)-1, -(1<<16), -(1<<16)+1, -(1<<16)+2, -(1<<16)+3,
1611     -(1<<15)-3,-(1<<15)-2,-(1<<15)-1, -(1<<15), -(1<<15)+1, -(1<<15)+2, -(1<<15)+3,
1612     -(1<<8)-3,-(1<<8)-2,-(1<<8)-1, -(1<<8), -(1<<8)+1, -(1<<8)+2, -(1<<8)+3,
1613     -(1<<7)-3,-(1<<7)-2,-(1<<7)-1, -(1<<7), -(1<<7)+1, -(1<<7)+2, -(1<<7)+3,
1614     -4, -3, -2, -1, 0, 1, 2, 3, 4,
1615     (1<<7)-3,(1<<7)-2,(1<<7)-1, (1<<7), (1<<7)+1, (1<<7)+2, (1<<7)+3,
1616     (1<<8)-3,(1<<8)-2,(1<<8)-1, (1<<8), (1<<8)+1, (1<<8)+2, (1<<8)+3,
1617     (1<<15)-3,(1<<15)-2,(1<<15)-1, (1<<15), (1<<15)+1, (1<<15)+2, (1<<15)+3,
1618     (1<<16)-3,(1<<16)-2,(1<<16)-1, (1<<16), (1<<16)+1, (1<<16)+2, (1<<16)+3,
1619     (1<<21)-3,(1<<21)-2,(1<<21)-1, (1<<21), (1<<21)+1, (1<<21)+2, (1<<21)+3,
1620     (1<<22)-3,(1<<22)-2,(1<<22)-1, (1<<22), (1<<22)+1, (1<<22)+2, (1<<22)+3,
1621     (1<<23)-3,(1<<23)-2,(1<<23)-1, (1<<23), (1<<23)+1, (1<<23)+2, (1<<23)+3,
1622     (1<<24)-3,(1<<24)-2,(1<<24)-1, (1<<24), (1<<24)+1, (1<<24)+2, (1<<24)+3,
1623     (1<<30)-3,(1<<30)-2,(1<<30)-1, (1<<30), (1<<30)+1, (1<<30)+2, (1<<30)+3,
1624     INT_MAX-3, INT_MAX-2, INT_MAX-1, INT_MAX, // 0x80000000, 0x80000001 0x80000002 already covered above
1625     UINT_MAX-3, UINT_MAX-2, UINT_MAX-1, UINT_MAX
1626     };
1627 
1628     int *o = (int *)out;
1629     int i;
1630 
1631     for( i = 0; i < count; i++ ) {
1632     if( gIsEmbedded ) {
1633         o[i] = (int) genrand_int32(d);
1634     }
1635     else {
1636         o[i] = (int) i + start;
1637     }
1638     }
1639 
1640     if( 0 == start )
1641     {
1642     size_t tableSize = sizeof( specialValuesInt );
1643     if( sizeof( int) * count < tableSize )
1644         tableSize = sizeof( int) * count;
1645     memcpy( (char*)(o + i) - tableSize, specialValuesInt, tableSize );
1646     }
1647 }
1648 
init_float(void * out,SaturationMode sat,RoundingMode round,Type destType,uint64_t start,int count,MTdata d)1649 void init_float( void *out, SaturationMode sat, RoundingMode round, Type destType, uint64_t start, int count, MTdata d )
1650 {
1651     static const float specialValuesFloat[] = {
1652     -NAN, -INFINITY, -FLT_MAX, MAKE_HEX_FLOAT(-0x1.000002p64f, -0x1000002L, 40), MAKE_HEX_FLOAT(-0x1.0p64f, -0x1L, 64), MAKE_HEX_FLOAT(-0x1.fffffep63f, -0x1fffffeL, 39), MAKE_HEX_FLOAT(-0x1.000002p63f, -0x1000002L, 39), MAKE_HEX_FLOAT(-0x1.0p63f, -0x1L, 63), MAKE_HEX_FLOAT(-0x1.fffffep62f, -0x1fffffeL, 38),
1653     MAKE_HEX_FLOAT(-0x1.000002p32f, -0x1000002L, 8), MAKE_HEX_FLOAT(-0x1.0p32f, -0x1L, 32), MAKE_HEX_FLOAT(-0x1.fffffep31f, -0x1fffffeL, 7), MAKE_HEX_FLOAT(-0x1.000002p31f, -0x1000002L, 7), MAKE_HEX_FLOAT(-0x1.0p31f, -0x1L, 31), MAKE_HEX_FLOAT(-0x1.fffffep30f, -0x1fffffeL, 6), -1000.f, -100.f, -4.0f, -3.5f,
1654     -3.0f, MAKE_HEX_FLOAT(-0x1.800002p1f, -0x1800002L, -23), -2.5f, MAKE_HEX_FLOAT(-0x1.7ffffep1f, -0x17ffffeL, -23), -2.0f, MAKE_HEX_FLOAT(-0x1.800002p0f, -0x1800002L, -24), -1.5f, MAKE_HEX_FLOAT(-0x1.7ffffep0f, -0x17ffffeL, -24),MAKE_HEX_FLOAT(-0x1.000002p0f, -0x1000002L, -24), -1.0f, MAKE_HEX_FLOAT(-0x1.fffffep-1f, -0x1fffffeL, -25),
1655     MAKE_HEX_FLOAT(-0x1.000002p-1f, -0x1000002L, -25), -0.5f, MAKE_HEX_FLOAT(-0x1.fffffep-2f, -0x1fffffeL, -26), MAKE_HEX_FLOAT(-0x1.000002p-2f, -0x1000002L, -26), -0.25f, MAKE_HEX_FLOAT(-0x1.fffffep-3f, -0x1fffffeL, -27),
1656     MAKE_HEX_FLOAT(-0x1.000002p-126f, -0x1000002L, -150), -FLT_MIN, MAKE_HEX_FLOAT(-0x0.fffffep-126f, -0x0fffffeL, -150), MAKE_HEX_FLOAT(-0x0.000ffep-126f, -0x0000ffeL, -150), MAKE_HEX_FLOAT(-0x0.0000fep-126f, -0x00000feL, -150), MAKE_HEX_FLOAT(-0x0.00000ep-126f, -0x000000eL, -150), MAKE_HEX_FLOAT(-0x0.00000cp-126f, -0x000000cL, -150), MAKE_HEX_FLOAT(-0x0.00000ap-126f, -0x000000aL, -150),
1657     MAKE_HEX_FLOAT(-0x0.000008p-126f, -0x0000008L, -150), MAKE_HEX_FLOAT(-0x0.000006p-126f, -0x0000006L, -150), MAKE_HEX_FLOAT(-0x0.000004p-126f, -0x0000004L, -150), MAKE_HEX_FLOAT(-0x0.000002p-126f, -0x0000002L, -150), -0.0f,
1658     +NAN, +INFINITY, +FLT_MAX, MAKE_HEX_FLOAT(+0x1.000002p64f, +0x1000002L, 40), MAKE_HEX_FLOAT(+0x1.0p64f, +0x1L, 64), MAKE_HEX_FLOAT(+0x1.fffffep63f, +0x1fffffeL, 39), MAKE_HEX_FLOAT(+0x1.000002p63f, +0x1000002L, 39), MAKE_HEX_FLOAT(+0x1.0p63f, +0x1L, 63), MAKE_HEX_FLOAT(+0x1.fffffep62f, +0x1fffffeL, 38),
1659     MAKE_HEX_FLOAT(+0x1.000002p32f, +0x1000002L, 8), MAKE_HEX_FLOAT(+0x1.0p32f, +0x1L, 32), MAKE_HEX_FLOAT(+0x1.fffffep31f, +0x1fffffeL, 7), MAKE_HEX_FLOAT(+0x1.000002p31f, +0x1000002L, 7), MAKE_HEX_FLOAT(+0x1.0p31f, +0x1L, 31), MAKE_HEX_FLOAT(+0x1.fffffep30f, +0x1fffffeL, 6), +1000.f, +100.f, +4.0f, +3.5f,
1660     +3.0f, MAKE_HEX_FLOAT(+0x1.800002p1f, +0x1800002L, -23), 2.5f, MAKE_HEX_FLOAT(+0x1.7ffffep1f, +0x17ffffeL, -23),+2.0f, MAKE_HEX_FLOAT(+0x1.800002p0f, +0x1800002L, -24), 1.5f, MAKE_HEX_FLOAT(+0x1.7ffffep0f, +0x17ffffeL, -24), MAKE_HEX_FLOAT(+0x1.000002p0f, +0x1000002L, -24), +1.0f, MAKE_HEX_FLOAT(+0x1.fffffep-1f, +0x1fffffeL, -25),
1661     MAKE_HEX_FLOAT(+0x1.000002p-1f, +0x1000002L, -25), +0.5f, MAKE_HEX_FLOAT(+0x1.fffffep-2f, +0x1fffffeL, -26), MAKE_HEX_FLOAT(+0x1.000002p-2f, +0x1000002L, -26), +0.25f, MAKE_HEX_FLOAT(+0x1.fffffep-3f, +0x1fffffeL, -27),
1662     MAKE_HEX_FLOAT(0x1.000002p-126f, 0x1000002L, -150), +FLT_MIN, MAKE_HEX_FLOAT(+0x0.fffffep-126f, +0x0fffffeL, -150), MAKE_HEX_FLOAT(+0x0.000ffep-126f, +0x0000ffeL, -150), MAKE_HEX_FLOAT(+0x0.0000fep-126f, +0x00000feL, -150), MAKE_HEX_FLOAT(+0x0.00000ep-126f, +0x000000eL, -150), MAKE_HEX_FLOAT(+0x0.00000cp-126f, +0x000000cL, -150), MAKE_HEX_FLOAT(+0x0.00000ap-126f, +0x000000aL, -150),
1663     MAKE_HEX_FLOAT(+0x0.000008p-126f, +0x0000008L, -150), MAKE_HEX_FLOAT(+0x0.000006p-126f, +0x0000006L, -150), MAKE_HEX_FLOAT(+0x0.000004p-126f, +0x0000004L, -150), MAKE_HEX_FLOAT(+0x0.000002p-126f, +0x0000002L, -150), +0.0f
1664     };
1665 
1666     cl_uint *o = (cl_uint *)out;
1667     int i;
1668 
1669     for( i = 0; i < count; i++ ) {
1670     if( gIsEmbedded )
1671         o[i] = (cl_uint) genrand_int32(d);
1672     else
1673         o[i] = (cl_uint) i + start;
1674     }
1675 
1676     if( 0 == start )
1677     {
1678     size_t tableSize = sizeof( specialValuesFloat );
1679     if( sizeof( float) * count < tableSize )
1680         tableSize = sizeof( float) * count;
1681     memcpy( (char*)(o + i) - tableSize, specialValuesFloat, tableSize );
1682     }
1683 
1684     if( kUnsaturated == sat )
1685     {
1686         clampf func = gClampFloat[ destType ][round];
1687         float *f = (float *)out;
1688 
1689         for( i = 0; i < count; i++ )
1690             f[i] = func( f[i] );
1691     }
1692 }
1693 
1694 // used to convert a bucket of bits into a search pattern through double
1695 static inline double DoubleFromUInt32( uint32_t bits );
DoubleFromUInt32(uint32_t bits)1696 static inline double DoubleFromUInt32( uint32_t bits )
1697 {
1698     union{ uint64_t u; double d;} u;
1699 
1700     // split 0x89abcdef to 0x89abc00000000def
1701     u.u = bits & 0xfffU;
1702     u.u |= (uint64_t) (bits & ~0xfffU) << 32;
1703 
1704     // sign extend the leading bit of def segment as sign bit so that the middle region consists of either all 1s or 0s
1705     u.u -= (bits & 0x800U) << 1;
1706 
1707     // return result
1708     return u.d;
1709 }
1710 
1711 // A table of more difficult cases to get right
1712 static const double specialValuesDouble[] = {
1713     -NAN, -INFINITY, -DBL_MAX, MAKE_HEX_DOUBLE(-0x1.0000000000001p64, -0x10000000000001LL, 12), MAKE_HEX_DOUBLE(-0x1.0p64, -0x1LL, 64), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp63, -0x1fffffffffffffLL, 11), MAKE_HEX_DOUBLE(-0x1.80000000000001p64, -0x180000000000001LL, 8),
1714     MAKE_HEX_DOUBLE(-0x1.8p64, -0x18LL, 60), MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp64, -0x17ffffffffffffLL, 12),     MAKE_HEX_DOUBLE(-0x1.80000000000001p63, -0x180000000000001LL, 7), MAKE_HEX_DOUBLE(-0x1.8p63, -0x18LL, 59), MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp63, -0x17ffffffffffffLL, 11),
1715      MAKE_HEX_DOUBLE(-0x1.0000000000001p63, -0x10000000000001LL, 11), MAKE_HEX_DOUBLE(-0x1.0p63, -0x1LL, 63), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp62, -0x1fffffffffffffLL, 10), MAKE_HEX_DOUBLE(-0x1.80000000000001p32, -0x180000000000001LL, -24), MAKE_HEX_DOUBLE(-0x1.8p32, -0x18LL, 28), MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp32, -0x17ffffffffffffLL, -20),
1716     MAKE_HEX_DOUBLE(-0x1.000002p32, -0x1000002LL, 8), MAKE_HEX_DOUBLE(-0x1.0p32, -0x1LL, 32), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp31, -0x1fffffffffffffLL, -21), MAKE_HEX_DOUBLE(-0x1.80000000000001p31, -0x180000000000001LL, -25), MAKE_HEX_DOUBLE(-0x1.8p31, -0x18LL, 27), MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp31, -0x17ffffffffffffLL, -21), MAKE_HEX_DOUBLE(-0x1.0000000000001p31, -0x10000000000001LL, -21), MAKE_HEX_DOUBLE(-0x1.0p31, -0x1LL, 31), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp30, -0x1fffffffffffffLL, -22), -1000., -100.,  -4.0, -3.5,
1717     -3.0, MAKE_HEX_DOUBLE(-0x1.8000000000001p1, -0x18000000000001LL, -51), -2.5, MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp1, -0x17ffffffffffffLL, -51), -2.0, MAKE_HEX_DOUBLE(-0x1.8000000000001p0, -0x18000000000001LL, -52), -1.5, MAKE_HEX_DOUBLE(-0x1.7ffffffffffffp0, -0x17ffffffffffffLL, -52),MAKE_HEX_DOUBLE(-0x1.0000000000001p0, -0x10000000000001LL, -52), -1.0, MAKE_HEX_DOUBLE(-0x1.fffffffffffffp-1, -0x1fffffffffffffLL, -53),
1718     MAKE_HEX_DOUBLE(-0x1.0000000000001p-1, -0x10000000000001LL, -53), -0.5, MAKE_HEX_DOUBLE(-0x1.fffffffffffffp-2, -0x1fffffffffffffLL, -54),  MAKE_HEX_DOUBLE(-0x1.0000000000001p-2, -0x10000000000001LL, -54), -0.25, MAKE_HEX_DOUBLE(-0x1.fffffffffffffp-3, -0x1fffffffffffffLL, -55),
1719     MAKE_HEX_DOUBLE(-0x1.0000000000001p-1022, -0x10000000000001LL, -1074), -DBL_MIN, MAKE_HEX_DOUBLE(-0x0.fffffffffffffp-1022, -0x0fffffffffffffLL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000fffp-1022, -0x00000000000fffLL, -1074), MAKE_HEX_DOUBLE(-0x0.00000000000fep-1022, -0x000000000000feLL, -1074), MAKE_HEX_DOUBLE(-0x0.000000000000ep-1022, -0x0000000000000eLL, -1074), MAKE_HEX_DOUBLE(-0x0.000000000000cp-1022, -0x0000000000000cLL, -1074), MAKE_HEX_DOUBLE(-0x0.000000000000ap-1022, -0x0000000000000aLL, -1074),
1720     MAKE_HEX_DOUBLE(-0x0.0000000000008p-1022, -0x00000000000008LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000007p-1022, -0x00000000000007LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000006p-1022, -0x00000000000006LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000005p-1022, -0x00000000000005LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000004p-1022, -0x00000000000004LL, -1074),
1721     MAKE_HEX_DOUBLE(-0x0.0000000000003p-1022, -0x00000000000003LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000002p-1022, -0x00000000000002LL, -1074), MAKE_HEX_DOUBLE(-0x0.0000000000001p-1022, -0x00000000000001LL, -1074), -0.0,
1722 
1723     MAKE_HEX_DOUBLE(+0x1.fffffffffffffp63, +0x1fffffffffffffLL, 11), MAKE_HEX_DOUBLE(0x1.80000000000001p63, 0x180000000000001LL, 7), MAKE_HEX_DOUBLE(0x1.8p63, 0x18LL, 59), MAKE_HEX_DOUBLE(0x1.7ffffffffffffp63, 0x17ffffffffffffLL, 11),  MAKE_HEX_DOUBLE(+0x1.0000000000001p63, +0x10000000000001LL, 11), MAKE_HEX_DOUBLE(+0x1.0p63, +0x1LL, 63), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp62, +0x1fffffffffffffLL, 10),
1724      MAKE_HEX_DOUBLE(+0x1.80000000000001p32, +0x180000000000001LL, -24), MAKE_HEX_DOUBLE(+0x1.8p32, +0x18LL, 28), MAKE_HEX_DOUBLE(+0x1.7ffffffffffffp32, +0x17ffffffffffffLL, -20),
1725     MAKE_HEX_DOUBLE(+0x1.000002p32, +0x1000002LL, 8), MAKE_HEX_DOUBLE(+0x1.0p32, +0x1LL, 32), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp31, +0x1fffffffffffffLL, -21), MAKE_HEX_DOUBLE(+0x1.80000000000001p31, +0x180000000000001LL, -25), MAKE_HEX_DOUBLE(+0x1.8p31, +0x18LL, 27), MAKE_HEX_DOUBLE(+0x1.7ffffffffffffp31, +0x17ffffffffffffLL, -21), MAKE_HEX_DOUBLE(+0x1.0000000000001p31, +0x10000000000001LL, -21), MAKE_HEX_DOUBLE(+0x1.0p31, +0x1LL, 31), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp30, +0x1fffffffffffffLL, -22), +1000., +100.,  +4.0, +3.5,
1726     +3.0, MAKE_HEX_DOUBLE(+0x1.8000000000001p1, +0x18000000000001LL, -51), +2.5, MAKE_HEX_DOUBLE(+0x1.7ffffffffffffp1, +0x17ffffffffffffLL, -51), +2.0, MAKE_HEX_DOUBLE(+0x1.8000000000001p0, +0x18000000000001LL, -52), +1.5, MAKE_HEX_DOUBLE(+0x1.7ffffffffffffp0, +0x17ffffffffffffLL, -52),MAKE_HEX_DOUBLE(-0x1.0000000000001p0, -0x10000000000001LL, -52), +1.0, MAKE_HEX_DOUBLE(+0x1.fffffffffffffp-1, +0x1fffffffffffffLL, -53),
1727     MAKE_HEX_DOUBLE(+0x1.0000000000001p-1, +0x10000000000001LL, -53), +0.5, MAKE_HEX_DOUBLE(+0x1.fffffffffffffp-2, +0x1fffffffffffffLL, -54),  MAKE_HEX_DOUBLE(+0x1.0000000000001p-2, +0x10000000000001LL, -54), +0.25, MAKE_HEX_DOUBLE(+0x1.fffffffffffffp-3, +0x1fffffffffffffLL, -55),
1728     MAKE_HEX_DOUBLE(+0x1.0000000000001p-1022, +0x10000000000001LL, -1074), +DBL_MIN, MAKE_HEX_DOUBLE(+0x0.fffffffffffffp-1022, +0x0fffffffffffffLL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000fffp-1022, +0x00000000000fffLL, -1074), MAKE_HEX_DOUBLE(+0x0.00000000000fep-1022, +0x000000000000feLL, -1074), MAKE_HEX_DOUBLE(+0x0.000000000000ep-1022, +0x0000000000000eLL, -1074), MAKE_HEX_DOUBLE(+0x0.000000000000cp-1022, +0x0000000000000cLL, -1074), MAKE_HEX_DOUBLE(+0x0.000000000000ap-1022, +0x0000000000000aLL, -1074),
1729     MAKE_HEX_DOUBLE(+0x0.0000000000008p-1022, +0x00000000000008LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000007p-1022, +0x00000000000007LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000006p-1022, +0x00000000000006LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000005p-1022, +0x00000000000005LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000004p-1022, +0x00000000000004LL, -1074),
1730     MAKE_HEX_DOUBLE(+0x0.0000000000003p-1022, +0x00000000000003LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000002p-1022, +0x00000000000002LL, -1074), MAKE_HEX_DOUBLE(+0x0.0000000000001p-1022, +0x00000000000001LL, -1074), +0.0,
1731 
1732     MAKE_HEX_DOUBLE(-0x1.ffffffffffffep62, -0x1ffffffffffffeLL, 10), MAKE_HEX_DOUBLE(-0x1.ffffffffffffcp62, -0x1ffffffffffffcLL, 10), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp62, -0x1fffffffffffffLL, 10), MAKE_HEX_DOUBLE(+0x1.ffffffffffffep62, +0x1ffffffffffffeLL, 10), MAKE_HEX_DOUBLE(+0x1.ffffffffffffcp62, +0x1ffffffffffffcLL, 10), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp62, +0x1fffffffffffffLL, 10),
1733     MAKE_HEX_DOUBLE(-0x1.ffffffffffffep51, -0x1ffffffffffffeLL, -1), MAKE_HEX_DOUBLE(-0x1.ffffffffffffcp51, -0x1ffffffffffffcLL, -1), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp51, -0x1fffffffffffffLL, -1), MAKE_HEX_DOUBLE(+0x1.ffffffffffffep51, +0x1ffffffffffffeLL, -1), MAKE_HEX_DOUBLE(+0x1.ffffffffffffcp51, +0x1ffffffffffffcLL, -1), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp51, +0x1fffffffffffffLL, -1),
1734     MAKE_HEX_DOUBLE(-0x1.ffffffffffffep52, -0x1ffffffffffffeLL, 0), MAKE_HEX_DOUBLE(-0x1.ffffffffffffcp52, -0x1ffffffffffffcLL, 0), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp52, -0x1fffffffffffffLL, 0), MAKE_HEX_DOUBLE(+0x1.ffffffffffffep52, +0x1ffffffffffffeLL, 0), MAKE_HEX_DOUBLE(+0x1.ffffffffffffcp52, +0x1ffffffffffffcLL, 0), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp52, +0x1fffffffffffffLL, 0),
1735     MAKE_HEX_DOUBLE(-0x1.ffffffffffffep53, -0x1ffffffffffffeLL, 1), MAKE_HEX_DOUBLE(-0x1.ffffffffffffcp53, -0x1ffffffffffffcLL, 1), MAKE_HEX_DOUBLE(-0x1.fffffffffffffp53, -0x1fffffffffffffLL, 1), MAKE_HEX_DOUBLE(+0x1.ffffffffffffep53, +0x1ffffffffffffeLL, 1), MAKE_HEX_DOUBLE(+0x1.ffffffffffffcp53, +0x1ffffffffffffcLL, 1), MAKE_HEX_DOUBLE(+0x1.fffffffffffffp53, +0x1fffffffffffffLL, 1),
1736     MAKE_HEX_DOUBLE(-0x1.0000000000002p52, -0x10000000000002LL, 0), MAKE_HEX_DOUBLE(-0x1.0000000000001p52, -0x10000000000001LL, 0), MAKE_HEX_DOUBLE(-0x1.0p52, -0x1LL, 52), MAKE_HEX_DOUBLE(+0x1.0000000000002p52, +0x10000000000002LL, 0), MAKE_HEX_DOUBLE(+0x1.0000000000001p52, +0x10000000000001LL, 0), MAKE_HEX_DOUBLE(+0x1.0p52, +0x1LL, 52),
1737     MAKE_HEX_DOUBLE(-0x1.0000000000002p53, -0x10000000000002LL, 1), MAKE_HEX_DOUBLE(-0x1.0000000000001p53, -0x10000000000001LL, 1), MAKE_HEX_DOUBLE(-0x1.0p53, -0x1LL, 53), MAKE_HEX_DOUBLE(+0x1.0000000000002p53, +0x10000000000002LL, 1), MAKE_HEX_DOUBLE(+0x1.0000000000001p53, +0x10000000000001LL, 1), MAKE_HEX_DOUBLE(+0x1.0p53, +0x1LL, 53),
1738     MAKE_HEX_DOUBLE(-0x1.0000000000002p54, -0x10000000000002LL, 2), MAKE_HEX_DOUBLE(-0x1.0000000000001p54, -0x10000000000001LL, 2), MAKE_HEX_DOUBLE(-0x1.0p54, -0x1LL, 54), MAKE_HEX_DOUBLE(+0x1.0000000000002p54, +0x10000000000002LL, 2), MAKE_HEX_DOUBLE(+0x1.0000000000001p54, +0x10000000000001LL, 2), MAKE_HEX_DOUBLE(+0x1.0p54, +0x1LL, 54),
1739     MAKE_HEX_DOUBLE(-0x1.fffffffefffffp62, -0x1fffffffefffffLL, 10), MAKE_HEX_DOUBLE(-0x1.ffffffffp62, -0x1ffffffffLL, 30), MAKE_HEX_DOUBLE(-0x1.ffffffff00001p62, -0x1ffffffff00001LL, 10), MAKE_HEX_DOUBLE(0x1.fffffffefffffp62, 0x1fffffffefffffLL, 10), MAKE_HEX_DOUBLE(0x1.ffffffffp62, 0x1ffffffffLL, 30), MAKE_HEX_DOUBLE(0x1.ffffffff00001p62, 0x1ffffffff00001LL, 10),
1740 };
1741 
1742 
init_double(void * out,SaturationMode sat,RoundingMode round,Type destType,uint64_t start,int count,MTdata UNUSED d)1743 void init_double( void *out, SaturationMode sat, RoundingMode round, Type destType, uint64_t start, int count, MTdata UNUSED d )
1744 {
1745     double *o = (double*)out;
1746     int i;
1747 
1748     for( i = 0; i < count; i++ )
1749     {
1750         uint64_t z = i + start;
1751         o[i] = DoubleFromUInt32( (uint32_t) z ^ (uint32_t) (z >> 32));
1752     }
1753 
1754     if( 0 == start )
1755     {
1756         size_t tableSize = sizeof( specialValuesDouble );
1757         if( sizeof( cl_double) * count < tableSize )
1758             tableSize = sizeof( cl_double) * count;
1759         memcpy( (char*)(o + i) - tableSize, specialValuesDouble, tableSize );
1760     }
1761 
1762     if( 0 == sat )
1763     {
1764         clampd func = gClampDouble[ destType ][round];
1765 
1766         for( i = 0; i < count; i++ )
1767             o[i] = func( o[i] );
1768     }
1769 }
1770 
random64(MTdata d)1771 cl_ulong random64( MTdata d )
1772 {
1773     return (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32);
1774 }
1775 
init_ulong(void * out,SaturationMode UNUSED sat,RoundingMode UNUSED round,Type UNUSED destType,uint64_t start,int count,MTdata d)1776 void init_ulong( void *out, SaturationMode UNUSED sat, RoundingMode UNUSED round, Type UNUSED destType, uint64_t start, int count, MTdata d )
1777 {
1778     cl_ulong *o = (cl_ulong *)out;
1779     cl_ulong i, j, k;
1780 
1781     i = 0;
1782     if( start == 0 )
1783     {
1784         //Try various powers of two
1785         for( j = 0; j < (cl_ulong) count && j < 8 * sizeof(cl_ulong); j++ )
1786             o[j] = (cl_ulong) 1 << j;
1787         i = j;
1788 
1789         // try the complement of those
1790         for( j = 0; i < (cl_ulong) count && j < 8 * sizeof(cl_ulong); j++ )
1791             o[i++] = ~((cl_ulong) 1 << j);
1792 
1793         //Try various negative powers of two
1794         for( j = 0; i < (cl_ulong) count && j < 8 * sizeof(cl_ulong); j++ )
1795             o[i++] = (cl_ulong) 0xFFFFFFFFFFFFFFFEULL << j;
1796 
1797         //try various powers of two plus 1, shifted by various amounts
1798         for( j = 0; i < (cl_ulong)count && j < 8 * sizeof(cl_ulong); j++ )
1799             for( k = 0; i < (cl_ulong)count && k < 8 * sizeof(cl_ulong) - j; k++ )
1800                 o[i++] = (((cl_ulong) 1 << j) + 1) << k;
1801 
1802         //try various powers of two minus 1
1803         for( j = 0; i < (cl_ulong)count && j < 8 * sizeof(cl_ulong); j++ )
1804             for( k = 0; i < (cl_ulong)count && k < 8 * sizeof(cl_ulong) - j; k++ )
1805                 o[i++] = (((cl_ulong) 1 << j) - 1) << k;
1806 
1807         // Other patterns
1808         cl_ulong pattern[] = { 0x3333333333333333ULL, 0x5555555555555555ULL, 0x9999999999999999ULL, 0x6666666666666666ULL, 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL };
1809         cl_ulong mask[] = { 0xffffffffffffffffULL, 0xff00ff00ff00ff00ULL, 0xffff0000ffff0000ULL, 0xffffffff00000000ULL };
1810         for( j = 0; i < (cl_ulong) count && j < sizeof(pattern) / sizeof( pattern[0]); j++ )
1811             for( k = 0; i + 2 <= (cl_ulong) count && k < sizeof(mask) / sizeof( mask[0]); k++ )
1812             {
1813                 o[i++] = pattern[j] & mask[k];
1814                 o[i++] = pattern[j] & ~mask[k];
1815             }
1816     }
1817 
1818     for( ; i < (cl_ulong) count; i++ )
1819         o[i] = random64(d);
1820 }
1821 
init_long(void * out,SaturationMode sat,RoundingMode round,Type destType,uint64_t start,int count,MTdata d)1822 void init_long( void *out, SaturationMode sat, RoundingMode round, Type destType, uint64_t start, int count, MTdata d )
1823 {
1824     init_ulong( out, sat, round, destType, start, count, d );
1825 }
1826 
1827 // ======
1828 
1829 void uchar2uchar_many( void *out, void *in, size_t n);
1830 void uchar2uchar_sat_many( void *out, void *in, size_t n);
1831 void char2uchar_many( void *out, void *in, size_t n);
1832 void char2uchar_sat_many( void *out, void *in, size_t n);
1833 void ushort2uchar_many( void *out, void *in, size_t n);
1834 void ushort2uchar_sat_many( void *out, void *in, size_t n);
1835 void short2uchar_many( void *out, void *in, size_t n);
1836 void short2uchar_sat_many( void *out, void *in, size_t n);
1837 void uint2uchar_many( void *out, void *in, size_t n);
1838 void uint2uchar_sat_many( void *out, void *in, size_t n);
1839 void int2uchar_many( void *out, void *in, size_t n);
1840 void int2uchar_sat_many( void *out, void *in, size_t n);
1841 void float2uchar_many( void *out, void *in, size_t n);
1842 void float2uchar_sat_many( void *out, void *in, size_t n);
1843 void double2uchar_many( void *out, void *in, size_t n);
1844 void double2uchar_sat_many( void *out, void *in, size_t n);
1845 void ulong2uchar_many( void *out, void *in, size_t n);
1846 void ulong2uchar_sat_many( void *out, void *in, size_t n);
1847 void long2uchar_many( void *out, void *in, size_t n);
1848 void long2uchar_sat_many( void *out, void *in, size_t n);
1849 void uchar2char_many( void *out, void *in, size_t n);
1850 void uchar2char_sat_many( void *out, void *in, size_t n);
1851 void char2char_many( void *out, void *in, size_t n);
1852 void char2char_sat_many( void *out, void *in, size_t n);
1853 void ushort2char_many( void *out, void *in, size_t n);
1854 void ushort2char_sat_many( void *out, void *in, size_t n);
1855 void short2char_many( void *out, void *in, size_t n);
1856 void short2char_sat_many( void *out, void *in, size_t n);
1857 void uint2char_many( void *out, void *in, size_t n);
1858 void uint2char_sat_many( void *out, void *in, size_t n);
1859 void int2char_many( void *out, void *in, size_t n);
1860 void int2char_sat_many( void *out, void *in, size_t n);
1861 void float2char_many( void *out, void *in, size_t n);
1862 void float2char_sat_many( void *out, void *in, size_t n);
1863 void double2char_many( void *out, void *in, size_t n);
1864 void double2char_sat_many( void *out, void *in, size_t n);
1865 void ulong2char_many( void *out, void *in, size_t n);
1866 void ulong2char_sat_many( void *out, void *in, size_t n);
1867 void long2char_many( void *out, void *in, size_t n);
1868 void long2char_sat_many( void *out, void *in, size_t n);
1869 void uchar2ushort_many( void *out, void *in, size_t n);
1870 void uchar2ushort_sat_many( void *out, void *in, size_t n);
1871 void char2ushort_many( void *out, void *in, size_t n);
1872 void char2ushort_sat_many( void *out, void *in, size_t n);
1873 void ushort2ushort_many( void *out, void *in, size_t n);
1874 void ushort2ushort_sat_many( void *out, void *in, size_t n);
1875 void short2ushort_many( void *out, void *in, size_t n);
1876 void short2ushort_sat_many( void *out, void *in, size_t n);
1877 void uint2ushort_many( void *out, void *in, size_t n);
1878 void uint2ushort_sat_many( void *out, void *in, size_t n);
1879 void int2ushort_many( void *out, void *in, size_t n);
1880 void int2ushort_sat_many( void *out, void *in, size_t n);
1881 void float2ushort_many( void *out, void *in, size_t n);
1882 void float2ushort_sat_many( void *out, void *in, size_t n);
1883 void double2ushort_many( void *out, void *in, size_t n);
1884 void double2ushort_sat_many( void *out, void *in, size_t n);
1885 void ulong2ushort_many( void *out, void *in, size_t n);
1886 void ulong2ushort_sat_many( void *out, void *in, size_t n);
1887 void long2ushort_many( void *out, void *in, size_t n);
1888 void long2ushort_sat_many( void *out, void *in, size_t n);
1889 void uchar2short_many( void *out, void *in, size_t n);
1890 void uchar2short_sat_many( void *out, void *in, size_t n);
1891 void char2short_many( void *out, void *in, size_t n);
1892 void char2short_sat_many( void *out, void *in, size_t n);
1893 void ushort2short_many( void *out, void *in, size_t n);
1894 void ushort2short_sat_many( void *out, void *in, size_t n);
1895 void short2short_many( void *out, void *in, size_t n);
1896 void short2short_sat_many( void *out, void *in, size_t n);
1897 void uint2short_many( void *out, void *in, size_t n);
1898 void uint2short_sat_many( void *out, void *in, size_t n);
1899 void int2short_many( void *out, void *in, size_t n);
1900 void int2short_sat_many( void *out, void *in, size_t n);
1901 void float2short_many( void *out, void *in, size_t n);
1902 void float2short_sat_many( void *out, void *in, size_t n);
1903 void double2short_many( void *out, void *in, size_t n);
1904 void double2short_sat_many( void *out, void *in, size_t n);
1905 void ulong2short_many( void *out, void *in, size_t n);
1906 void ulong2short_sat_many( void *out, void *in, size_t n);
1907 void long2short_many( void *out, void *in, size_t n);
1908 void long2short_sat_many( void *out, void *in, size_t n);
1909 void uchar2uint_many( void *out, void *in, size_t n);
1910 void uchar2uint_sat_many( void *out, void *in, size_t n);
1911 void char2uint_many( void *out, void *in, size_t n);
1912 void char2uint_sat_many( void *out, void *in, size_t n);
1913 void ushort2uint_many( void *out, void *in, size_t n);
1914 void ushort2uint_sat_many( void *out, void *in, size_t n);
1915 void short2uint_many( void *out, void *in, size_t n);
1916 void short2uint_sat_many( void *out, void *in, size_t n);
1917 void uint2uint_many( void *out, void *in, size_t n);
1918 void uint2uint_sat_many( void *out, void *in, size_t n);
1919 void int2uint_many( void *out, void *in, size_t n);
1920 void int2uint_sat_many( void *out, void *in, size_t n);
1921 void float2uint_many( void *out, void *in, size_t n);
1922 void float2uint_sat_many( void *out, void *in, size_t n);
1923 void double2uint_many( void *out, void *in, size_t n);
1924 void double2uint_sat_many( void *out, void *in, size_t n);
1925 void ulong2uint_many( void *out, void *in, size_t n);
1926 void ulong2uint_sat_many( void *out, void *in, size_t n);
1927 void long2uint_many( void *out, void *in, size_t n);
1928 void long2uint_sat_many( void *out, void *in, size_t n);
1929 void uchar2int_many( void *out, void *in, size_t n);
1930 void uchar2int_sat_many( void *out, void *in, size_t n);
1931 void char2int_many( void *out, void *in, size_t n);
1932 void char2int_sat_many( void *out, void *in, size_t n);
1933 void ushort2int_many( void *out, void *in, size_t n);
1934 void ushort2int_sat_many( void *out, void *in, size_t n);
1935 void short2int_many( void *out, void *in, size_t n);
1936 void short2int_sat_many( void *out, void *in, size_t n);
1937 void uint2int_many( void *out, void *in, size_t n);
1938 void uint2int_sat_many( void *out, void *in, size_t n);
1939 void int2int_many( void *out, void *in, size_t n);
1940 void int2int_sat_many( void *out, void *in, size_t n);
1941 void float2int_many( void *out, void *in, size_t n);
1942 void float2int_sat_many( void *out, void *in, size_t n);
1943 void double2int_many( void *out, void *in, size_t n);
1944 void double2int_sat_many( void *out, void *in, size_t n);
1945 void ulong2int_many( void *out, void *in, size_t n);
1946 void ulong2int_sat_many( void *out, void *in, size_t n);
1947 void long2int_many( void *out, void *in, size_t n);
1948 void long2int_sat_many( void *out, void *in, size_t n);
1949 void uchar2float_many( void *out, void *in, size_t n);
1950 void uchar2float_sat_many( void *out, void *in, size_t n);
1951 void char2float_many( void *out, void *in, size_t n);
1952 void char2float_sat_many( void *out, void *in, size_t n);
1953 void ushort2float_many( void *out, void *in, size_t n);
1954 void ushort2float_sat_many( void *out, void *in, size_t n);
1955 void short2float_many( void *out, void *in, size_t n);
1956 void short2float_sat_many( void *out, void *in, size_t n);
1957 void uint2float_many( void *out, void *in, size_t n);
1958 void uint2float_sat_many( void *out, void *in, size_t n);
1959 void int2float_many( void *out, void *in, size_t n);
1960 void int2float_sat_many( void *out, void *in, size_t n);
1961 void float2float_many( void *out, void *in, size_t n);
1962 void float2float_sat_many( void *out, void *in, size_t n);
1963 void double2float_many( void *out, void *in, size_t n);
1964 void double2float_sat_many( void *out, void *in, size_t n);
1965 void ulong2float_many( void *out, void *in, size_t n);
1966 void ulong2float_sat_many( void *out, void *in, size_t n);
1967 void long2float_many( void *out, void *in, size_t n);
1968 void long2float_sat_many( void *out, void *in, size_t n);
1969 void uchar2double_many( void *out, void *in, size_t n);
1970 void uchar2double_sat_many( void *out, void *in, size_t n);
1971 void char2double_many( void *out, void *in, size_t n);
1972 void char2double_sat_many( void *out, void *in, size_t n);
1973 void ushort2double_many( void *out, void *in, size_t n);
1974 void ushort2double_sat_many( void *out, void *in, size_t n);
1975 void short2double_many( void *out, void *in, size_t n);
1976 void short2double_sat_many( void *out, void *in, size_t n);
1977 void uint2double_many( void *out, void *in, size_t n);
1978 void uint2double_sat_many( void *out, void *in, size_t n);
1979 void int2double_many( void *out, void *in, size_t n);
1980 void int2double_sat_many( void *out, void *in, size_t n);
1981 void float2double_many( void *out, void *in, size_t n);
1982 void float2double_sat_many( void *out, void *in, size_t n);
1983 void double2double_many( void *out, void *in, size_t n);
1984 void double2double_sat_many( void *out, void *in, size_t n);
1985 void ulong2double_many( void *out, void *in, size_t n);
1986 void ulong2double_sat_many( void *out, void *in, size_t n);
1987 void long2double_many( void *out, void *in, size_t n);
1988 void long2double_sat_many( void *out, void *in, size_t n);
1989 void uchar2ulong_many( void *out, void *in, size_t n);
1990 void uchar2ulong_sat_many( void *out, void *in, size_t n);
1991 void char2ulong_many( void *out, void *in, size_t n);
1992 void char2ulong_sat_many( void *out, void *in, size_t n);
1993 void ushort2ulong_many( void *out, void *in, size_t n);
1994 void ushort2ulong_sat_many( void *out, void *in, size_t n);
1995 void short2ulong_many( void *out, void *in, size_t n);
1996 void short2ulong_sat_many( void *out, void *in, size_t n);
1997 void uint2ulong_many( void *out, void *in, size_t n);
1998 void uint2ulong_sat_many( void *out, void *in, size_t n);
1999 void int2ulong_many( void *out, void *in, size_t n);
2000 void int2ulong_sat_many( void *out, void *in, size_t n);
2001 void float2ulong_many( void *out, void *in, size_t n);
2002 void float2ulong_sat_many( void *out, void *in, size_t n);
2003 void double2ulong_many( void *out, void *in, size_t n);
2004 void double2ulong_sat_many( void *out, void *in, size_t n);
2005 void ulong2ulong_many( void *out, void *in, size_t n);
2006 void ulong2ulong_sat_many( void *out, void *in, size_t n);
2007 void long2ulong_many( void *out, void *in, size_t n);
2008 void long2ulong_sat_many( void *out, void *in, size_t n);
2009 void uchar2long_many( void *out, void *in, size_t n);
2010 void uchar2long_sat_many( void *out, void *in, size_t n);
2011 void char2long_many( void *out, void *in, size_t n);
2012 void char2long_sat_many( void *out, void *in, size_t n);
2013 void ushort2long_many( void *out, void *in, size_t n);
2014 void ushort2long_sat_many( void *out, void *in, size_t n);
2015 void short2long_many( void *out, void *in, size_t n);
2016 void short2long_sat_many( void *out, void *in, size_t n);
2017 void uint2long_many( void *out, void *in, size_t n);
2018 void uint2long_sat_many( void *out, void *in, size_t n);
2019 void int2long_many( void *out, void *in, size_t n);
2020 void int2long_sat_many( void *out, void *in, size_t n);
2021 void float2long_many( void *out, void *in, size_t n);
2022 void float2long_sat_many( void *out, void *in, size_t n);
2023 void double2long_many( void *out, void *in, size_t n);
2024 void double2long_sat_many( void *out, void *in, size_t n);
2025 void ulong2long_many( void *out, void *in, size_t n);
2026 void ulong2long_sat_many( void *out, void *in, size_t n);
2027 void long2long_many( void *out, void *in, size_t n);
2028 void long2long_sat_many( void *out, void *in, size_t n);
2029 
uchar2uchar_many(void * out,void * in,size_t n)2030 void uchar2uchar_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_uchar )); }
uchar2uchar_sat_many(void * out,void * in,size_t n)2031 void uchar2uchar_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_uchar )); }
char2uchar_many(void * out,void * in,size_t n)2032 void char2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_char)); }}
char2uchar_sat_many(void * out,void * in,size_t n)2033 void char2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_char)); }}
ushort2uchar_many(void * out,void * in,size_t n)2034 void ushort2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_ushort)); }}
ushort2uchar_sat_many(void * out,void * in,size_t n)2035 void ushort2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_ushort)); }}
short2uchar_many(void * out,void * in,size_t n)2036 void short2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_short)); }}
short2uchar_sat_many(void * out,void * in,size_t n)2037 void short2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_short)); }}
uint2uchar_many(void * out,void * in,size_t n)2038 void uint2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_uint)); }}
uint2uchar_sat_many(void * out,void * in,size_t n)2039 void uint2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_uint)); }}
int2uchar_many(void * out,void * in,size_t n)2040 void int2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_int)); }}
int2uchar_sat_many(void * out,void * in,size_t n)2041 void int2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_int)); }}
float2uchar_many(void * out,void * in,size_t n)2042 void float2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_float)); }}
float2uchar_sat_many(void * out,void * in,size_t n)2043 void float2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_float)); }}
double2uchar_many(void * out,void * in,size_t n)2044 void double2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_double)); }}
double2uchar_sat_many(void * out,void * in,size_t n)2045 void double2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_double)); }}
ulong2uchar_many(void * out,void * in,size_t n)2046 void ulong2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_ulong)); }}
ulong2uchar_sat_many(void * out,void * in,size_t n)2047 void ulong2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_ulong)); }}
long2uchar_many(void * out,void * in,size_t n)2048 void long2uchar_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2uchar( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_long)); }}
long2uchar_sat_many(void * out,void * in,size_t n)2049 void long2uchar_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2uchar_sat( (char*) out + i * sizeof(cl_uchar), (char*) in + i * sizeof(cl_long)); }}
uchar2char_many(void * out,void * in,size_t n)2050 void uchar2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_uchar)); }}
uchar2char_sat_many(void * out,void * in,size_t n)2051 void uchar2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_uchar)); }}
char2char_many(void * out,void * in,size_t n)2052 void char2char_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_char )); }
char2char_sat_many(void * out,void * in,size_t n)2053 void char2char_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_char )); }
ushort2char_many(void * out,void * in,size_t n)2054 void ushort2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_ushort)); }}
ushort2char_sat_many(void * out,void * in,size_t n)2055 void ushort2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_ushort)); }}
short2char_many(void * out,void * in,size_t n)2056 void short2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_short)); }}
short2char_sat_many(void * out,void * in,size_t n)2057 void short2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_short)); }}
uint2char_many(void * out,void * in,size_t n)2058 void uint2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_uint)); }}
uint2char_sat_many(void * out,void * in,size_t n)2059 void uint2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_uint)); }}
int2char_many(void * out,void * in,size_t n)2060 void int2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_int)); }}
int2char_sat_many(void * out,void * in,size_t n)2061 void int2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_int)); }}
float2char_many(void * out,void * in,size_t n)2062 void float2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_float)); }}
float2char_sat_many(void * out,void * in,size_t n)2063 void float2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_float)); }}
double2char_many(void * out,void * in,size_t n)2064 void double2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_double)); }}
double2char_sat_many(void * out,void * in,size_t n)2065 void double2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_double)); }}
ulong2char_many(void * out,void * in,size_t n)2066 void ulong2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_ulong)); }}
ulong2char_sat_many(void * out,void * in,size_t n)2067 void ulong2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_ulong)); }}
long2char_many(void * out,void * in,size_t n)2068 void long2char_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2char( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_long)); }}
long2char_sat_many(void * out,void * in,size_t n)2069 void long2char_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2char_sat( (char*) out + i * sizeof(cl_char), (char*) in + i * sizeof(cl_long)); }}
uchar2ushort_many(void * out,void * in,size_t n)2070 void uchar2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_uchar)); }}
uchar2ushort_sat_many(void * out,void * in,size_t n)2071 void uchar2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_uchar)); }}
char2ushort_many(void * out,void * in,size_t n)2072 void char2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_char)); }}
char2ushort_sat_many(void * out,void * in,size_t n)2073 void char2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_char)); }}
ushort2ushort_many(void * out,void * in,size_t n)2074 void ushort2ushort_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_ushort )); }
ushort2ushort_sat_many(void * out,void * in,size_t n)2075 void ushort2ushort_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_ushort )); }
short2ushort_many(void * out,void * in,size_t n)2076 void short2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_short)); }}
short2ushort_sat_many(void * out,void * in,size_t n)2077 void short2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_short)); }}
uint2ushort_many(void * out,void * in,size_t n)2078 void uint2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_uint)); }}
uint2ushort_sat_many(void * out,void * in,size_t n)2079 void uint2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_uint)); }}
int2ushort_many(void * out,void * in,size_t n)2080 void int2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_int)); }}
int2ushort_sat_many(void * out,void * in,size_t n)2081 void int2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_int)); }}
float2ushort_many(void * out,void * in,size_t n)2082 void float2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_float)); }}
float2ushort_sat_many(void * out,void * in,size_t n)2083 void float2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_float)); }}
double2ushort_many(void * out,void * in,size_t n)2084 void double2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_double)); }}
double2ushort_sat_many(void * out,void * in,size_t n)2085 void double2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_double)); }}
ulong2ushort_many(void * out,void * in,size_t n)2086 void ulong2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_ulong)); }}
ulong2ushort_sat_many(void * out,void * in,size_t n)2087 void ulong2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_ulong)); }}
long2ushort_many(void * out,void * in,size_t n)2088 void long2ushort_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2ushort( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_long)); }}
long2ushort_sat_many(void * out,void * in,size_t n)2089 void long2ushort_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2ushort_sat( (char*) out + i * sizeof(cl_ushort), (char*) in + i * sizeof(cl_long)); }}
uchar2short_many(void * out,void * in,size_t n)2090 void uchar2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_uchar)); }}
uchar2short_sat_many(void * out,void * in,size_t n)2091 void uchar2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_uchar)); }}
char2short_many(void * out,void * in,size_t n)2092 void char2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_char)); }}
char2short_sat_many(void * out,void * in,size_t n)2093 void char2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_char)); }}
ushort2short_many(void * out,void * in,size_t n)2094 void ushort2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_ushort)); }}
ushort2short_sat_many(void * out,void * in,size_t n)2095 void ushort2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_ushort)); }}
short2short_many(void * out,void * in,size_t n)2096 void short2short_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_short )); }
short2short_sat_many(void * out,void * in,size_t n)2097 void short2short_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_short )); }
uint2short_many(void * out,void * in,size_t n)2098 void uint2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_uint)); }}
uint2short_sat_many(void * out,void * in,size_t n)2099 void uint2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_uint)); }}
int2short_many(void * out,void * in,size_t n)2100 void int2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_int)); }}
int2short_sat_many(void * out,void * in,size_t n)2101 void int2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_int)); }}
float2short_many(void * out,void * in,size_t n)2102 void float2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_float)); }}
float2short_sat_many(void * out,void * in,size_t n)2103 void float2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_float)); }}
double2short_many(void * out,void * in,size_t n)2104 void double2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_double)); }}
double2short_sat_many(void * out,void * in,size_t n)2105 void double2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_double)); }}
ulong2short_many(void * out,void * in,size_t n)2106 void ulong2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_ulong)); }}
ulong2short_sat_many(void * out,void * in,size_t n)2107 void ulong2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_ulong)); }}
long2short_many(void * out,void * in,size_t n)2108 void long2short_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2short( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_long)); }}
long2short_sat_many(void * out,void * in,size_t n)2109 void long2short_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2short_sat( (char*) out + i * sizeof(cl_short), (char*) in + i * sizeof(cl_long)); }}
uchar2uint_many(void * out,void * in,size_t n)2110 void uchar2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_uchar)); }}
uchar2uint_sat_many(void * out,void * in,size_t n)2111 void uchar2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_uchar)); }}
char2uint_many(void * out,void * in,size_t n)2112 void char2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_char)); }}
char2uint_sat_many(void * out,void * in,size_t n)2113 void char2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_char)); }}
ushort2uint_many(void * out,void * in,size_t n)2114 void ushort2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_ushort)); }}
ushort2uint_sat_many(void * out,void * in,size_t n)2115 void ushort2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_ushort)); }}
short2uint_many(void * out,void * in,size_t n)2116 void short2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_short)); }}
short2uint_sat_many(void * out,void * in,size_t n)2117 void short2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_short)); }}
uint2uint_many(void * out,void * in,size_t n)2118 void uint2uint_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_uint )); }
uint2uint_sat_many(void * out,void * in,size_t n)2119 void uint2uint_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_uint )); }
int2uint_many(void * out,void * in,size_t n)2120 void int2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_int)); }}
int2uint_sat_many(void * out,void * in,size_t n)2121 void int2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_int)); }}
float2uint_many(void * out,void * in,size_t n)2122 void float2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_float)); }}
float2uint_sat_many(void * out,void * in,size_t n)2123 void float2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_float)); }}
double2uint_many(void * out,void * in,size_t n)2124 void double2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_double)); }}
double2uint_sat_many(void * out,void * in,size_t n)2125 void double2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_double)); }}
ulong2uint_many(void * out,void * in,size_t n)2126 void ulong2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_ulong)); }}
ulong2uint_sat_many(void * out,void * in,size_t n)2127 void ulong2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_ulong)); }}
long2uint_many(void * out,void * in,size_t n)2128 void long2uint_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2uint( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_long)); }}
long2uint_sat_many(void * out,void * in,size_t n)2129 void long2uint_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2uint_sat( (char*) out + i * sizeof(cl_uint), (char*) in + i * sizeof(cl_long)); }}
uchar2int_many(void * out,void * in,size_t n)2130 void uchar2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_uchar)); }}
uchar2int_sat_many(void * out,void * in,size_t n)2131 void uchar2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_uchar)); }}
char2int_many(void * out,void * in,size_t n)2132 void char2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_char)); }}
char2int_sat_many(void * out,void * in,size_t n)2133 void char2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_char)); }}
ushort2int_many(void * out,void * in,size_t n)2134 void ushort2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_ushort)); }}
ushort2int_sat_many(void * out,void * in,size_t n)2135 void ushort2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_ushort)); }}
short2int_many(void * out,void * in,size_t n)2136 void short2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_short)); }}
short2int_sat_many(void * out,void * in,size_t n)2137 void short2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_short)); }}
uint2int_many(void * out,void * in,size_t n)2138 void uint2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_uint)); }}
uint2int_sat_many(void * out,void * in,size_t n)2139 void uint2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_uint)); }}
int2int_many(void * out,void * in,size_t n)2140 void int2int_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_int )); }
int2int_sat_many(void * out,void * in,size_t n)2141 void int2int_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_int )); }
float2int_many(void * out,void * in,size_t n)2142 void float2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_float)); }}
float2int_sat_many(void * out,void * in,size_t n)2143 void float2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_float)); }}
double2int_many(void * out,void * in,size_t n)2144 void double2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_double)); }}
double2int_sat_many(void * out,void * in,size_t n)2145 void double2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_double)); }}
ulong2int_many(void * out,void * in,size_t n)2146 void ulong2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_ulong)); }}
ulong2int_sat_many(void * out,void * in,size_t n)2147 void ulong2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_ulong)); }}
long2int_many(void * out,void * in,size_t n)2148 void long2int_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2int( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_long)); }}
long2int_sat_many(void * out,void * in,size_t n)2149 void long2int_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2int_sat( (char*) out + i * sizeof(cl_int), (char*) in + i * sizeof(cl_long)); }}
uchar2float_many(void * out,void * in,size_t n)2150 void uchar2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_uchar)); }}
uchar2float_sat_many(void * out,void * in,size_t n)2151 void uchar2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_uchar)); }}
char2float_many(void * out,void * in,size_t n)2152 void char2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_char)); }}
char2float_sat_many(void * out,void * in,size_t n)2153 void char2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_char)); }}
ushort2float_many(void * out,void * in,size_t n)2154 void ushort2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_ushort)); }}
ushort2float_sat_many(void * out,void * in,size_t n)2155 void ushort2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_ushort)); }}
short2float_many(void * out,void * in,size_t n)2156 void short2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_short)); }}
short2float_sat_many(void * out,void * in,size_t n)2157 void short2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_short)); }}
uint2float_many(void * out,void * in,size_t n)2158 void uint2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_uint)); }}
uint2float_sat_many(void * out,void * in,size_t n)2159 void uint2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_uint)); }}
int2float_many(void * out,void * in,size_t n)2160 void int2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_int)); }}
int2float_sat_many(void * out,void * in,size_t n)2161 void int2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_int)); }}
float2float_many(void * out,void * in,size_t n)2162 void float2float_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_float )); }
float2float_sat_many(void * out,void * in,size_t n)2163 void float2float_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_float )); }
double2float_many(void * out,void * in,size_t n)2164 void double2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_double)); }}
double2float_sat_many(void * out,void * in,size_t n)2165 void double2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_double)); }}
ulong2float_many(void * out,void * in,size_t n)2166 void ulong2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_ulong)); }}
ulong2float_sat_many(void * out,void * in,size_t n)2167 void ulong2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_ulong)); }}
long2float_many(void * out,void * in,size_t n)2168 void long2float_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2float( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_long)); }}
long2float_sat_many(void * out,void * in,size_t n)2169 void long2float_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2float_sat( (char*) out + i * sizeof(cl_float), (char*) in + i * sizeof(cl_long)); }}
uchar2double_many(void * out,void * in,size_t n)2170 void uchar2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_uchar)); }}
uchar2double_sat_many(void * out,void * in,size_t n)2171 void uchar2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_uchar)); }}
char2double_many(void * out,void * in,size_t n)2172 void char2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_char)); }}
char2double_sat_many(void * out,void * in,size_t n)2173 void char2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_char)); }}
ushort2double_many(void * out,void * in,size_t n)2174 void ushort2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_ushort)); }}
ushort2double_sat_many(void * out,void * in,size_t n)2175 void ushort2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_ushort)); }}
short2double_many(void * out,void * in,size_t n)2176 void short2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_short)); }}
short2double_sat_many(void * out,void * in,size_t n)2177 void short2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_short)); }}
uint2double_many(void * out,void * in,size_t n)2178 void uint2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_uint)); }}
uint2double_sat_many(void * out,void * in,size_t n)2179 void uint2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_uint)); }}
int2double_many(void * out,void * in,size_t n)2180 void int2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_int)); }}
int2double_sat_many(void * out,void * in,size_t n)2181 void int2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_int)); }}
float2double_many(void * out,void * in,size_t n)2182 void float2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_float)); }}
float2double_sat_many(void * out,void * in,size_t n)2183 void float2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_float)); }}
double2double_many(void * out,void * in,size_t n)2184 void double2double_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_double )); }
double2double_sat_many(void * out,void * in,size_t n)2185 void double2double_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_double )); }
ulong2double_many(void * out,void * in,size_t n)2186 void ulong2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_ulong)); }}
ulong2double_sat_many(void * out,void * in,size_t n)2187 void ulong2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_ulong)); }}
long2double_many(void * out,void * in,size_t n)2188 void long2double_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2double( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_long)); }}
long2double_sat_many(void * out,void * in,size_t n)2189 void long2double_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2double_sat( (char*) out + i * sizeof(cl_double), (char*) in + i * sizeof(cl_long)); }}
uchar2ulong_many(void * out,void * in,size_t n)2190 void uchar2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_uchar)); }}
uchar2ulong_sat_many(void * out,void * in,size_t n)2191 void uchar2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_uchar)); }}
char2ulong_many(void * out,void * in,size_t n)2192 void char2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_char)); }}
char2ulong_sat_many(void * out,void * in,size_t n)2193 void char2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_char)); }}
ushort2ulong_many(void * out,void * in,size_t n)2194 void ushort2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_ushort)); }}
ushort2ulong_sat_many(void * out,void * in,size_t n)2195 void ushort2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_ushort)); }}
short2ulong_many(void * out,void * in,size_t n)2196 void short2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_short)); }}
short2ulong_sat_many(void * out,void * in,size_t n)2197 void short2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_short)); }}
uint2ulong_many(void * out,void * in,size_t n)2198 void uint2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_uint)); }}
uint2ulong_sat_many(void * out,void * in,size_t n)2199 void uint2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_uint)); }}
int2ulong_many(void * out,void * in,size_t n)2200 void int2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_int)); }}
int2ulong_sat_many(void * out,void * in,size_t n)2201 void int2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_int)); }}
float2ulong_many(void * out,void * in,size_t n)2202 void float2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_float)); }}
float2ulong_sat_many(void * out,void * in,size_t n)2203 void float2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_float)); }}
double2ulong_many(void * out,void * in,size_t n)2204 void double2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_double)); }}
double2ulong_sat_many(void * out,void * in,size_t n)2205 void double2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_double)); }}
ulong2ulong_many(void * out,void * in,size_t n)2206 void ulong2ulong_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_ulong )); }
ulong2ulong_sat_many(void * out,void * in,size_t n)2207 void ulong2ulong_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_ulong )); }
long2ulong_many(void * out,void * in,size_t n)2208 void long2ulong_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2ulong( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_long)); }}
long2ulong_sat_many(void * out,void * in,size_t n)2209 void long2ulong_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ long2ulong_sat( (char*) out + i * sizeof(cl_ulong), (char*) in + i * sizeof(cl_long)); }}
uchar2long_many(void * out,void * in,size_t n)2210 void uchar2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_uchar)); }}
uchar2long_sat_many(void * out,void * in,size_t n)2211 void uchar2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uchar2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_uchar)); }}
char2long_many(void * out,void * in,size_t n)2212 void char2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_char)); }}
char2long_sat_many(void * out,void * in,size_t n)2213 void char2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ char2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_char)); }}
ushort2long_many(void * out,void * in,size_t n)2214 void ushort2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_ushort)); }}
ushort2long_sat_many(void * out,void * in,size_t n)2215 void ushort2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ushort2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_ushort)); }}
short2long_many(void * out,void * in,size_t n)2216 void short2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_short)); }}
short2long_sat_many(void * out,void * in,size_t n)2217 void short2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ short2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_short)); }}
uint2long_many(void * out,void * in,size_t n)2218 void uint2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_uint)); }}
uint2long_sat_many(void * out,void * in,size_t n)2219 void uint2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ uint2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_uint)); }}
int2long_many(void * out,void * in,size_t n)2220 void int2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_int)); }}
int2long_sat_many(void * out,void * in,size_t n)2221 void int2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ int2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_int)); }}
float2long_many(void * out,void * in,size_t n)2222 void float2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_float)); }}
float2long_sat_many(void * out,void * in,size_t n)2223 void float2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ float2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_float)); }}
double2long_many(void * out,void * in,size_t n)2224 void double2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_double)); }}
double2long_sat_many(void * out,void * in,size_t n)2225 void double2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ double2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_double)); }}
ulong2long_many(void * out,void * in,size_t n)2226 void ulong2long_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2long( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_ulong)); }}
ulong2long_sat_many(void * out,void * in,size_t n)2227 void ulong2long_sat_many( void *out, void *in, size_t n){size_t i; for( i = 0; i < n; i++){ ulong2long_sat( (char*) out + i * sizeof(cl_long), (char*) in + i * sizeof(cl_ulong)); }}
long2long_many(void * out,void * in,size_t n)2228 void long2long_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_long )); }
long2long_sat_many(void * out,void * in,size_t n)2229 void long2long_sat_many( void *out, void *in, size_t n){ memcpy( out, in, n * sizeof( cl_long )); }
2230 
2231 Convert gSaturatedConversions[kTypeCount][kTypeCount] = {
2232     {    uchar2uchar_sat_many,    char2uchar_sat_many,    ushort2uchar_sat_many,    short2uchar_sat_many,    uint2uchar_sat_many,    int2uchar_sat_many,    float2uchar_sat_many,    double2uchar_sat_many,    ulong2uchar_sat_many,    long2uchar_sat_many,     },
2233     {    uchar2char_sat_many,    char2char_sat_many,    ushort2char_sat_many,    short2char_sat_many,    uint2char_sat_many,    int2char_sat_many,    float2char_sat_many,    double2char_sat_many,    ulong2char_sat_many, long2char_sat_many,     },
2234     {    uchar2ushort_sat_many,    char2ushort_sat_many,    ushort2ushort_sat_many,    short2ushort_sat_many,    uint2ushort_sat_many,    int2ushort_sat_many,    float2ushort_sat_many,    double2ushort_sat_many,    ulong2ushort_sat_many,    long2ushort_sat_many,     },
2235     {    uchar2short_sat_many,    char2short_sat_many,    ushort2short_sat_many,    short2short_sat_many,    uint2short_sat_many,    int2short_sat_many,    float2short_sat_many,    double2short_sat_many,    ulong2short_sat_many,    long2short_sat_many,     },
2236     {    uchar2uint_sat_many,    char2uint_sat_many,    ushort2uint_sat_many,    short2uint_sat_many,    uint2uint_sat_many,    int2uint_sat_many,    float2uint_sat_many,    double2uint_sat_many,    ulong2uint_sat_many, long2uint_sat_many,     },
2237     {    uchar2int_sat_many,    char2int_sat_many,    ushort2int_sat_many,    short2int_sat_many,    uint2int_sat_many,    int2int_sat_many,    float2int_sat_many,    double2int_sat_many,    ulong2int_sat_many,long2int_sat_many,     },
2238     {    uchar2float_sat_many,    char2float_sat_many,    ushort2float_sat_many,    short2float_sat_many,    uint2float_sat_many,    int2float_sat_many,    float2float_sat_many,    double2float_sat_many,    ulong2float_sat_many,    long2float_sat_many,     },
2239     {    uchar2double_sat_many,    char2double_sat_many,    ushort2double_sat_many,    short2double_sat_many,    uint2double_sat_many,    int2double_sat_many,    float2double_sat_many,    double2double_sat_many,    ulong2double_sat_many,    long2double_sat_many,     },
2240     {    uchar2ulong_sat_many,    char2ulong_sat_many,    ushort2ulong_sat_many,    short2ulong_sat_many,    uint2ulong_sat_many,    int2ulong_sat_many,    float2ulong_sat_many,    double2ulong_sat_many,    ulong2ulong_sat_many,    long2ulong_sat_many,     },
2241     {    uchar2long_sat_many,    char2long_sat_many,    ushort2long_sat_many,    short2long_sat_many,    uint2long_sat_many,    int2long_sat_many,    float2long_sat_many,    double2long_sat_many,    ulong2long_sat_many, long2long_sat_many,     },
2242 };
2243 
2244 Convert gConversions[kTypeCount][kTypeCount] = {
2245     {    uchar2uchar_many,    char2uchar_many,    ushort2uchar_many,    short2uchar_many,    uint2uchar_many,    int2uchar_many,    float2uchar_many,    double2uchar_many,    ulong2uchar_many,    long2uchar_many,     },
2246     {    uchar2char_many,    char2char_many,    ushort2char_many,    short2char_many,    uint2char_many,    int2char_many,    float2char_many,    double2char_many,    ulong2char_many,    long2char_many,     },
2247     {    uchar2ushort_many,    char2ushort_many,    ushort2ushort_many,    short2ushort_many,    uint2ushort_many,    int2ushort_many,    float2ushort_many,    double2ushort_many,    ulong2ushort_many,    long2ushort_many,     },
2248     {    uchar2short_many,    char2short_many,    ushort2short_many,    short2short_many,    uint2short_many,    int2short_many,    float2short_many,    double2short_many,    ulong2short_many,    long2short_many,     },
2249     {    uchar2uint_many,    char2uint_many,    ushort2uint_many,    short2uint_many,    uint2uint_many,    int2uint_many,    float2uint_many,    double2uint_many,    ulong2uint_many,    long2uint_many,     },
2250     {    uchar2int_many,    char2int_many,    ushort2int_many,    short2int_many,    uint2int_many,    int2int_many,    float2int_many,    double2int_many,    ulong2int_many,    long2int_many,     },
2251     {    uchar2float_many,    char2float_many,    ushort2float_many,    short2float_many,    uint2float_many,    int2float_many,    float2float_many,    double2float_many,    ulong2float_many,    long2float_many,     },
2252     {    uchar2double_many,    char2double_many,    ushort2double_many,    short2double_many,    uint2double_many,    int2double_many,    float2double_many,    double2double_many,    ulong2double_many,    long2double_many,     },
2253     {    uchar2ulong_many,    char2ulong_many,    ushort2ulong_many,    short2ulong_many,    uint2ulong_many,    int2ulong_many,    float2ulong_many,    double2ulong_many,    ulong2ulong_many,    long2ulong_many,     },
2254     {    uchar2long_many,    char2long_many,    ushort2long_many,    short2long_many,    uint2long_many,    int2long_many,    float2long_many,    double2long_many,    ulong2long_many,    long2long_many,     },
2255 };
2256