1 /*
2 ** Copyright (c) 2015-2019 The Khronos Group Inc.
3 **
4 ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 ** of this software and/or associated documentation files (the "Materials"),
6 ** to deal in the Materials without restriction, including without limitation
7 ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 ** and/or sell copies of the Materials, and to permit persons to whom the
9 ** Materials are furnished to do so, subject to the following conditions:
10 **
11 ** The above copyright notice and this permission notice shall be included in
12 ** all copies or substantial portions of the Materials.
13 **
14 ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 **
18 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 ** IN THE MATERIALS.
25 */
26 
27 #ifndef OPENCLstd_H
28 #define OPENCLstd_H
29 
30 #ifdef __cplusplus
31 namespace OpenCLLIB {
32 
33 enum Entrypoints {
34 
35     // Section 2.1: Math extended instructions
36     Acos = 0,
37     Acosh = 1,
38     Acospi = 2,
39     Asin = 3,
40     Asinh = 4,
41     Asinpi = 5,
42     Atan = 6,
43     Atan2 = 7,
44     Atanh = 8,
45     Atanpi = 9,
46     Atan2pi = 10,
47     Cbrt = 11,
48     Ceil = 12,
49     Copysign = 13,
50     Cos = 14,
51     Cosh = 15,
52     Cospi = 16,
53     Erfc = 17,
54     Erf = 18,
55     Exp = 19,
56     Exp2 = 20,
57     Exp10 = 21,
58     Expm1 = 22,
59     Fabs = 23,
60     Fdim = 24,
61     Floor = 25,
62     Fma = 26,
63     Fmax = 27,
64     Fmin = 28,
65     Fmod = 29,
66     Fract = 30,
67     Frexp = 31,
68     Hypot = 32,
69     Ilogb = 33,
70     Ldexp = 34,
71     Lgamma = 35,
72     Lgamma_r = 36,
73     Log = 37,
74     Log2 = 38,
75     Log10 = 39,
76     Log1p = 40,
77     Logb = 41,
78     Mad = 42,
79     Maxmag = 43,
80     Minmag = 44,
81     Modf = 45,
82     Nan = 46,
83     Nextafter = 47,
84     Pow = 48,
85     Pown = 49,
86     Powr = 50,
87     Remainder = 51,
88     Remquo = 52,
89     Rint = 53,
90     Rootn = 54,
91     Round = 55,
92     Rsqrt = 56,
93     Sin = 57,
94     Sincos = 58,
95     Sinh = 59,
96     Sinpi = 60,
97     Sqrt = 61,
98     Tan = 62,
99     Tanh = 63,
100     Tanpi = 64,
101     Tgamma = 65,
102     Trunc = 66,
103     Half_cos = 67,
104     Half_divide = 68,
105     Half_exp = 69,
106     Half_exp2 = 70,
107     Half_exp10 = 71,
108     Half_log = 72,
109     Half_log2 = 73,
110     Half_log10 = 74,
111     Half_powr = 75,
112     Half_recip = 76,
113     Half_rsqrt = 77,
114     Half_sin = 78,
115     Half_sqrt = 79,
116     Half_tan = 80,
117     Native_cos = 81,
118     Native_divide = 82,
119     Native_exp = 83,
120     Native_exp2 = 84,
121     Native_exp10 = 85,
122     Native_log = 86,
123     Native_log2 = 87,
124     Native_log10 = 88,
125     Native_powr = 89,
126     Native_recip = 90,
127     Native_rsqrt = 91,
128     Native_sin = 92,
129     Native_sqrt = 93,
130     Native_tan = 94,
131 
132     // Section 2.2: Integer instructions
133     SAbs = 141,
134     SAbs_diff = 142,
135     SAdd_sat = 143,
136     UAdd_sat = 144,
137     SHadd = 145,
138     UHadd = 146,
139     SRhadd = 147,
140     URhadd = 148,
141     SClamp = 149,
142     UClamp = 150,
143     Clz = 151,
144     Ctz = 152,
145     SMad_hi = 153,
146     UMad_sat = 154,
147     SMad_sat = 155,
148     SMax = 156,
149     UMax = 157,
150     SMin = 158,
151     UMin = 159,
152     SMul_hi = 160,
153     Rotate = 161,
154     SSub_sat = 162,
155     USub_sat = 163,
156     U_Upsample = 164,
157     S_Upsample = 165,
158     Popcount = 166,
159     SMad24 = 167,
160     UMad24 = 168,
161     SMul24 = 169,
162     UMul24 = 170,
163     UAbs = 201,
164     UAbs_diff = 202,
165     UMul_hi = 203,
166     UMad_hi = 204,
167 
168     // Section 2.3: Common instructions
169     FClamp = 95,
170     Degrees = 96,
171     FMax_common = 97,
172     FMin_common = 98,
173     Mix = 99,
174     Radians = 100,
175     Step = 101,
176     Smoothstep = 102,
177     Sign = 103,
178 
179     // Section 2.4: Geometric instructions
180     Cross = 104,
181     Distance = 105,
182     Length = 106,
183     Normalize = 107,
184     Fast_distance = 108,
185     Fast_length = 109,
186     Fast_normalize = 110,
187 
188     // Section 2.5: Relational instructions
189     Bitselect = 186,
190     Select = 187,
191 
192     // Section 2.6: Vector Data Load and Store instructions
193     Vloadn = 171,
194     Vstoren = 172,
195     Vload_half = 173,
196     Vload_halfn = 174,
197     Vstore_half = 175,
198     Vstore_half_r = 176,
199     Vstore_halfn = 177,
200     Vstore_halfn_r = 178,
201     Vloada_halfn = 179,
202     Vstorea_halfn = 180,
203     Vstorea_halfn_r = 181,
204 
205     // Section 2.7: Miscellaneous Vector instructions
206     Shuffle = 182,
207     Shuffle2 = 183,
208 
209     // Section 2.8: Misc instructions
210     Printf = 184,
211     Prefetch = 185,
212 };
213 
214 } // end namespace OpenCLLIB
215 
216 #else
217 
218 enum OpenCLstd_Entrypoints {
219 
220     // Section 2.1: Math extended instructions
221     OpenCLstd_Acos = 0,
222     OpenCLstd_Acosh = 1,
223     OpenCLstd_Acospi = 2,
224     OpenCLstd_Asin = 3,
225     OpenCLstd_Asinh = 4,
226     OpenCLstd_Asinpi = 5,
227     OpenCLstd_Atan = 6,
228     OpenCLstd_Atan2 = 7,
229     OpenCLstd_Atanh = 8,
230     OpenCLstd_Atanpi = 9,
231     OpenCLstd_Atan2pi = 10,
232     OpenCLstd_Cbrt = 11,
233     OpenCLstd_Ceil = 12,
234     OpenCLstd_Copysign = 13,
235     OpenCLstd_Cos = 14,
236     OpenCLstd_Cosh = 15,
237     OpenCLstd_Cospi = 16,
238     OpenCLstd_Erfc = 17,
239     OpenCLstd_Erf = 18,
240     OpenCLstd_Exp = 19,
241     OpenCLstd_Exp2 = 20,
242     OpenCLstd_Exp10 = 21,
243     OpenCLstd_Expm1 = 22,
244     OpenCLstd_Fabs = 23,
245     OpenCLstd_Fdim = 24,
246     OpenCLstd_Floor = 25,
247     OpenCLstd_Fma = 26,
248     OpenCLstd_Fmax = 27,
249     OpenCLstd_Fmin = 28,
250     OpenCLstd_Fmod = 29,
251     OpenCLstd_Fract = 30,
252     OpenCLstd_Frexp = 31,
253     OpenCLstd_Hypot = 32,
254     OpenCLstd_Ilogb = 33,
255     OpenCLstd_Ldexp = 34,
256     OpenCLstd_Lgamma = 35,
257     OpenCLstd_Lgamma_r = 36,
258     OpenCLstd_Log = 37,
259     OpenCLstd_Log2 = 38,
260     OpenCLstd_Log10 = 39,
261     OpenCLstd_Log1p = 40,
262     OpenCLstd_Logb = 41,
263     OpenCLstd_Mad = 42,
264     OpenCLstd_Maxmag = 43,
265     OpenCLstd_Minmag = 44,
266     OpenCLstd_Modf = 45,
267     OpenCLstd_Nan = 46,
268     OpenCLstd_Nextafter = 47,
269     OpenCLstd_Pow = 48,
270     OpenCLstd_Pown = 49,
271     OpenCLstd_Powr = 50,
272     OpenCLstd_Remainder = 51,
273     OpenCLstd_Remquo = 52,
274     OpenCLstd_Rint = 53,
275     OpenCLstd_Rootn = 54,
276     OpenCLstd_Round = 55,
277     OpenCLstd_Rsqrt = 56,
278     OpenCLstd_Sin = 57,
279     OpenCLstd_Sincos = 58,
280     OpenCLstd_Sinh = 59,
281     OpenCLstd_Sinpi = 60,
282     OpenCLstd_Sqrt = 61,
283     OpenCLstd_Tan = 62,
284     OpenCLstd_Tanh = 63,
285     OpenCLstd_Tanpi = 64,
286     OpenCLstd_Tgamma = 65,
287     OpenCLstd_Trunc = 66,
288     OpenCLstd_Half_cos = 67,
289     OpenCLstd_Half_divide = 68,
290     OpenCLstd_Half_exp = 69,
291     OpenCLstd_Half_exp2 = 70,
292     OpenCLstd_Half_exp10 = 71,
293     OpenCLstd_Half_log = 72,
294     OpenCLstd_Half_log2 = 73,
295     OpenCLstd_Half_log10 = 74,
296     OpenCLstd_Half_powr = 75,
297     OpenCLstd_Half_recip = 76,
298     OpenCLstd_Half_rsqrt = 77,
299     OpenCLstd_Half_sin = 78,
300     OpenCLstd_Half_sqrt = 79,
301     OpenCLstd_Half_tan = 80,
302     OpenCLstd_Native_cos = 81,
303     OpenCLstd_Native_divide = 82,
304     OpenCLstd_Native_exp = 83,
305     OpenCLstd_Native_exp2 = 84,
306     OpenCLstd_Native_exp10 = 85,
307     OpenCLstd_Native_log = 86,
308     OpenCLstd_Native_log2 = 87,
309     OpenCLstd_Native_log10 = 88,
310     OpenCLstd_Native_powr = 89,
311     OpenCLstd_Native_recip = 90,
312     OpenCLstd_Native_rsqrt = 91,
313     OpenCLstd_Native_sin = 92,
314     OpenCLstd_Native_sqrt = 93,
315     OpenCLstd_Native_tan = 94,
316 
317     // Section 2.2: Integer instructions
318     OpenCLstd_SAbs = 141,
319     OpenCLstd_SAbs_diff = 142,
320     OpenCLstd_SAdd_sat = 143,
321     OpenCLstd_UAdd_sat = 144,
322     OpenCLstd_SHadd = 145,
323     OpenCLstd_UHadd = 146,
324     OpenCLstd_SRhadd = 147,
325     OpenCLstd_URhadd = 148,
326     OpenCLstd_SClamp = 149,
327     OpenCLstd_UClamp = 150,
328     OpenCLstd_Clz = 151,
329     OpenCLstd_Ctz = 152,
330     OpenCLstd_SMad_hi = 153,
331     OpenCLstd_UMad_sat = 154,
332     OpenCLstd_SMad_sat = 155,
333     OpenCLstd_SMax = 156,
334     OpenCLstd_UMax = 157,
335     OpenCLstd_SMin = 158,
336     OpenCLstd_UMin = 159,
337     OpenCLstd_SMul_hi = 160,
338     OpenCLstd_Rotate = 161,
339     OpenCLstd_SSub_sat = 162,
340     OpenCLstd_USub_sat = 163,
341     OpenCLstd_U_Upsample = 164,
342     OpenCLstd_S_Upsample = 165,
343     OpenCLstd_Popcount = 166,
344     OpenCLstd_SMad24 = 167,
345     OpenCLstd_UMad24 = 168,
346     OpenCLstd_SMul24 = 169,
347     OpenCLstd_UMul24 = 170,
348     OpenCLstd_UAbs = 201,
349     OpenCLstd_UAbs_diff = 202,
350     OpenCLstd_UMul_hi = 203,
351     OpenCLstd_UMad_hi = 204,
352 
353     // Section 2.3: Common instructions
354     OpenCLstd_FClamp = 95,
355     OpenCLstd_Degrees = 96,
356     OpenCLstd_FMax_common = 97,
357     OpenCLstd_FMin_common = 98,
358     OpenCLstd_Mix = 99,
359     OpenCLstd_Radians = 100,
360     OpenCLstd_Step = 101,
361     OpenCLstd_Smoothstep = 102,
362     OpenCLstd_Sign = 103,
363 
364     // Section 2.4: Geometric instructions
365     OpenCLstd_Cross = 104,
366     OpenCLstd_Distance = 105,
367     OpenCLstd_Length = 106,
368     OpenCLstd_Normalize = 107,
369     OpenCLstd_Fast_distance = 108,
370     OpenCLstd_Fast_length = 109,
371     OpenCLstd_Fast_normalize = 110,
372 
373     // Section 2.5: Relational instructions
374     OpenCLstd_Bitselect = 186,
375     OpenCLstd_Select = 187,
376 
377     // Section 2.6: Vector Data Load and Store instructions
378     OpenCLstd_Vloadn = 171,
379     OpenCLstd_Vstoren = 172,
380     OpenCLstd_Vload_half = 173,
381     OpenCLstd_Vload_halfn = 174,
382     OpenCLstd_Vstore_half = 175,
383     OpenCLstd_Vstore_half_r = 176,
384     OpenCLstd_Vstore_halfn = 177,
385     OpenCLstd_Vstore_halfn_r = 178,
386     OpenCLstd_Vloada_halfn = 179,
387     OpenCLstd_Vstorea_halfn = 180,
388     OpenCLstd_Vstorea_halfn_r = 181,
389 
390     // Section 2.7: Miscellaneous Vector instructions
391     OpenCLstd_Shuffle = 182,
392     OpenCLstd_Shuffle2 = 183,
393 
394     // Section 2.8: Misc instructions
395     OpenCLstd_Printf = 184,
396     OpenCLstd_Prefetch = 185,
397 };
398 
399 #endif
400 
401 #endif  // #ifndef OPENCLstd_H
402