2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 #include <clc/clctypes.h>
25 #define TABLE_SPACE __constant
27 #define TABLE_MANGLE(NAME) __clc_##NAME
29 #define DECLARE_TABLE(TYPE,NAME,LENGTH) \
30 TABLE_SPACE TYPE NAME [ LENGTH ]
32 #define TABLE_FUNCTION(TYPE,TABLE,NAME) \
33 TYPE TABLE_MANGLE(NAME)(size_t idx) { \
37 #define TABLE_FUNCTION_DECL(TYPE, NAME) \
38 TYPE TABLE_MANGLE(NAME)(size_t idx);
40 #define USE_TABLE(NAME, IDX) \
41 TABLE_MANGLE(NAME)(IDX)
43 TABLE_FUNCTION_DECL(float2
, loge_tbl
);
44 TABLE_FUNCTION_DECL(float, log_inv_tbl
);
45 TABLE_FUNCTION_DECL(float2
, log_inv_tbl_ep
);
46 TABLE_FUNCTION_DECL(float2
, log2_tbl
);
47 TABLE_FUNCTION_DECL(float2
, log10_tbl
);
48 TABLE_FUNCTION_DECL(uint4
, pibits_tbl
);
49 TABLE_FUNCTION_DECL(float2
, sinhcosh_tbl
);
50 TABLE_FUNCTION_DECL(float2
, cbrt_tbl
);
51 TABLE_FUNCTION_DECL(float, exp_tbl
);
52 TABLE_FUNCTION_DECL(float2
, exp_tbl_ep
);
56 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
58 TABLE_FUNCTION_DECL(double2
, ln_tbl
);
59 TABLE_FUNCTION_DECL(double2
, atan_jby256_tbl
);
60 TABLE_FUNCTION_DECL(double2
, two_to_jby64_ep_tbl
);
61 TABLE_FUNCTION_DECL(double2
, sinh_tbl
);
62 TABLE_FUNCTION_DECL(double2
, cosh_tbl
);
63 TABLE_FUNCTION_DECL(double, cbrt_inv_tbl
);
64 TABLE_FUNCTION_DECL(double2
, cbrt_dbl_tbl
);
65 TABLE_FUNCTION_DECL(double2
, cbrt_rem_tbl
);
66 TABLE_FUNCTION_DECL(double2
, powlog_tbl
);
67 TABLE_FUNCTION_DECL(double2
, log_f_inv_tbl
);