• 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 #ifndef FUNCTIONLIST_H
17 #define FUNCTIONLIST_H
18 
19 #include "harness/compat.h"
20 
21 #ifndef WIN32
22 #include <unistd.h>
23 #endif
24 
25 #if defined( __APPLE__ )
26     #include <OpenCL/opencl.h>
27 #else
28     #include <CL/cl.h>
29 #endif
30 
31 #include "harness/mt19937.h"
32 
33 typedef union fptr
34 {
35     void    *p;
36     double  (*f_f)(double);
37     double  (*f_u)(cl_uint);
38     int     (*i_f)(double);
39     int     (*i_f_f)(float);
40     float   (*f_ff_f)(float, float);
41     double  (*f_ff)(double, double);
42     int     (*i_ff)(double, double);
43     double  (*f_fi)(double, int);
44     double  (*f_fpf)(double, double*);
45     double  (*f_fpI)(double, int*);
46     double  (*f_ffpI)(double, double, int*);
47     double  (*f_fff)(double, double, double );
48     float   (*f_fma)(float, float, float, int);
49 }fptr;
50 
51 typedef union dptr
52 {
53     void            *p;
54     long double     (*f_f)(long double);
55     long double     (*f_u)(cl_ulong);
56     int             (*i_f)(long double);
57     long double     (*f_ff)(long double, long double);
58     int             (*i_ff)(long double, long double);
59     long double     (*f_fi)(long double, int);
60     long double     (*f_fpf)(long double, long double*);
61     long double     (*f_fpI)(long double, int*);
62     long double     (*f_ffpI)(long double, long double, int*);
63     long double     (*f_fff)(long double, long double, long double);
64 }dptr;
65 
66 struct Func;
67 
68 typedef struct vtbl
69 {
70     const char  *type_name;
71     int         (*TestFunc)( const struct Func *, MTdata );
72     int         (*DoubleTestFunc)( const struct Func *, MTdata);        // may be NULL if function is single precision only
73 }vtbl;
74 
75 typedef struct Func
76 {
77   const char      *name;              // common name, to be used as an argument in the shell
78   const char      *nameInCode;        // name as it appears in the __kernel, usually the same as name, but different for multiplication
79   fptr            func;
80   dptr            dfunc;
81   fptr            rfunc;
82   float           float_ulps;
83   float           double_ulps;
84   float           float_embedded_ulps;
85   float           relaxed_error;
86   int             ftz;
87   int             relaxed;
88   const vtbl      *vtbl_ptr;
89 }Func;
90 
91 
92 extern const Func  functionList[];
93 
94 extern const size_t functionListCount;
95 
96 #endif
97 
98 
99