Merge lp:~schnetter/pocl/main into lp:~pocl/pocl/trunk
- main
- Merge into trunk
Proposed by
Erik Schnetter
Status: | Merged |
---|---|
Merged at revision: | 66 |
Proposed branch: | lp:~schnetter/pocl/main |
Merge into: | lp:~pocl/pocl/trunk |
Diff against target: |
503 lines (+177/-66) 20 files modified
include/_kernel.h (+26/-4) lib/kernel/acospi.cl (+4/-0) lib/kernel/asinpi.cl (+4/-0) lib/kernel/atan2pi.cl (+4/-0) lib/kernel/atanpi.cl (+4/-0) lib/kernel/cospi.cl (+4/-1) lib/kernel/degrees.cl (+5/-1) lib/kernel/exp10.cl (+4/-0) lib/kernel/fdim.cl (+1/-1) lib/kernel/fract.cl (+5/-0) lib/kernel/radians.cl (+5/-1) lib/kernel/rsqrt.cl (+1/-1) lib/kernel/signbit.cl (+1/-1) lib/kernel/sinpi.cl (+4/-0) lib/kernel/smoothstep.cl (+2/-2) lib/kernel/step.cl (+2/-2) lib/kernel/tanpi.cl (+4/-0) lib/kernel/tce/Makefile.am (+0/-52) lib/kernel/templates.h (+42/-0) lib/kernel/x86_64/signbit.cl (+55/-0) |
To merge this branch: | bzr merge lp:~schnetter/pocl/main |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Carlos Sánchez de La Lama | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
lp:~schnetter/pocl/main
updated
- 77. By Erik Schnetter
-
Add missing lib/kernel/tce that got lost in the merge
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Carlos Sánchez de La Lama (csanchezdll) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'include/_kernel.h' | |||
2 | --- include/_kernel.h 2011-11-03 18:58:00 +0000 | |||
3 | +++ include/_kernel.h 2011-11-05 00:27:24 +0000 | |||
4 | @@ -48,9 +48,6 @@ | |||
5 | 48 | #define cl_khr_fp64 | 48 | #define cl_khr_fp64 |
6 | 49 | #define cl_khr_int64 | 49 | #define cl_khr_int64 |
7 | 50 | 50 | ||
8 | 51 | /* Shouldn't the compiler define this? */ | ||
9 | 52 | //#define __SSE4_1__ | ||
10 | 53 | |||
11 | 54 | #endif | 51 | #endif |
12 | 55 | 52 | ||
13 | 56 | /* Enable double precision. This should really only be done when | 53 | /* Enable double precision. This should really only be done when |
14 | @@ -928,6 +925,7 @@ | |||
15 | 928 | #define M_SQRT2_F 1.41421356237309504880168872421f | 925 | #define M_SQRT2_F 1.41421356237309504880168872421f |
16 | 929 | #define M_SQRT1_2_F 0.707106781186547524400844362105f | 926 | #define M_SQRT1_2_F 0.707106781186547524400844362105f |
17 | 930 | 927 | ||
18 | 928 | #ifdef cl_khr_fp64 | ||
19 | 931 | #define HUGE_VAL __builtin_huge_val() | 929 | #define HUGE_VAL __builtin_huge_val() |
20 | 932 | 930 | ||
21 | 933 | #define DBL_DIG 15 | 931 | #define DBL_DIG 15 |
22 | @@ -953,6 +951,7 @@ | |||
23 | 953 | #define M_2_SQRTPI 1.12837916709551257389615890312 | 951 | #define M_2_SQRTPI 1.12837916709551257389615890312 |
24 | 954 | #define M_SQRT2 1.41421356237309504880168872421 | 952 | #define M_SQRT2 1.41421356237309504880168872421 |
25 | 955 | #define M_SQRT1_2 0.707106781186547524400844362105 | 953 | #define M_SQRT1_2 0.707106781186547524400844362105 |
26 | 954 | #endif | ||
27 | 956 | 955 | ||
28 | 957 | 956 | ||
29 | 958 | 957 | ||
30 | 959 | /* Math Functions */ | 958 | /* Math Functions */ |
31 | @@ -1344,6 +1343,29 @@ | |||
32 | 1344 | int16 _cl_overloadable NAME(float16 ); | 1343 | int16 _cl_overloadable NAME(float16 ); |
33 | 1345 | #endif | 1344 | #endif |
34 | 1346 | #ifdef cl_khr_fp64 | 1345 | #ifdef cl_khr_fp64 |
35 | 1346 | #define _CL_DECLARE_FUNC_K_V(NAME) \ | ||
36 | 1347 | int _cl_overloadable NAME(float ); \ | ||
37 | 1348 | int2 _cl_overloadable NAME(float2 ); \ | ||
38 | 1349 | int3 _cl_overloadable NAME(float3 ); \ | ||
39 | 1350 | int4 _cl_overloadable NAME(float4 ); \ | ||
40 | 1351 | int8 _cl_overloadable NAME(float8 ); \ | ||
41 | 1352 | int16 _cl_overloadable NAME(float16 ); \ | ||
42 | 1353 | int _cl_overloadable NAME(double ); \ | ||
43 | 1354 | long2 _cl_overloadable NAME(double2 ); \ | ||
44 | 1355 | long3 _cl_overloadable NAME(double3 ); \ | ||
45 | 1356 | long4 _cl_overloadable NAME(double4 ); \ | ||
46 | 1357 | long8 _cl_overloadable NAME(double8 ); \ | ||
47 | 1358 | long16 _cl_overloadable NAME(double16); | ||
48 | 1359 | #else | ||
49 | 1360 | #define _CL_DECLARE_FUNC_K_V(NAME) \ | ||
50 | 1361 | int _cl_overloadable NAME(float ); \ | ||
51 | 1362 | int2 _cl_overloadable NAME(float2 ); \ | ||
52 | 1363 | int3 _cl_overloadable NAME(float3 ); \ | ||
53 | 1364 | int4 _cl_overloadable NAME(float4 ); \ | ||
54 | 1365 | int8 _cl_overloadable NAME(float8 ); \ | ||
55 | 1366 | int16 _cl_overloadable NAME(float16 ); | ||
56 | 1367 | #endif | ||
57 | 1368 | #ifdef cl_khr_fp64 | ||
58 | 1347 | #define _CL_DECLARE_FUNC_S_V(NAME) \ | 1369 | #define _CL_DECLARE_FUNC_S_V(NAME) \ |
59 | 1348 | float _cl_overloadable NAME(float ); \ | 1370 | float _cl_overloadable NAME(float ); \ |
60 | 1349 | float _cl_overloadable NAME(float2 ); \ | 1371 | float _cl_overloadable NAME(float2 ); \ |
61 | @@ -2242,7 +2264,7 @@ | |||
62 | 2242 | _CL_DECLARE_FUNC_J_VV(isnormal) | 2264 | _CL_DECLARE_FUNC_J_VV(isnormal) |
63 | 2243 | _CL_DECLARE_FUNC_J_VV(isordered) | 2265 | _CL_DECLARE_FUNC_J_VV(isordered) |
64 | 2244 | _CL_DECLARE_FUNC_J_VV(isunordered) | 2266 | _CL_DECLARE_FUNC_J_VV(isunordered) |
66 | 2245 | _CL_DECLARE_FUNC_J_V(signbit) | 2267 | _CL_DECLARE_FUNC_K_V(signbit) |
67 | 2246 | _CL_DECLARE_FUNC_I_IG(any) | 2268 | _CL_DECLARE_FUNC_I_IG(any) |
68 | 2247 | _CL_DECLARE_FUNC_I_IG(all) | 2269 | _CL_DECLARE_FUNC_I_IG(all) |
69 | 2248 | _CL_DECLARE_FUNC_G_GGG(bitselect) | 2270 | _CL_DECLARE_FUNC_G_GGG(bitselect) |
70 | 2249 | 2271 | ||
71 | === modified file 'lib/kernel/acospi.cl' | |||
72 | --- lib/kernel/acospi.cl 2011-10-26 03:01:29 +0000 | |||
73 | +++ lib/kernel/acospi.cl 2011-11-05 00:27:24 +0000 | |||
74 | @@ -23,4 +23,8 @@ | |||
75 | 23 | 23 | ||
76 | 24 | #include "templates.h" | 24 | #include "templates.h" |
77 | 25 | 25 | ||
78 | 26 | #ifdef cl_khr_fp64 | ||
79 | 26 | DEFINE_EXPR_V_V(acospi, acos(a)/(stype)M_PI) | 27 | DEFINE_EXPR_V_V(acospi, acos(a)/(stype)M_PI) |
80 | 28 | #else | ||
81 | 29 | DEFINE_EXPR_V_V(acospi, acos(a)/M_PI_F) | ||
82 | 30 | #endif | ||
83 | 27 | 31 | ||
84 | === modified file 'lib/kernel/asinpi.cl' | |||
85 | --- lib/kernel/asinpi.cl 2011-10-26 03:01:29 +0000 | |||
86 | +++ lib/kernel/asinpi.cl 2011-11-05 00:27:24 +0000 | |||
87 | @@ -23,4 +23,8 @@ | |||
88 | 23 | 23 | ||
89 | 24 | #include "templates.h" | 24 | #include "templates.h" |
90 | 25 | 25 | ||
91 | 26 | #ifdef cl_khr_fp64 | ||
92 | 26 | DEFINE_EXPR_V_V(asinpi, asin(a)/(stype)M_PI) | 27 | DEFINE_EXPR_V_V(asinpi, asin(a)/(stype)M_PI) |
93 | 28 | #else | ||
94 | 29 | DEFINE_EXPR_V_V(asinpi, asin(a)/M_PI_F) | ||
95 | 30 | #endif | ||
96 | 27 | 31 | ||
97 | === modified file 'lib/kernel/atan2pi.cl' | |||
98 | --- lib/kernel/atan2pi.cl 2011-10-26 03:01:29 +0000 | |||
99 | +++ lib/kernel/atan2pi.cl 2011-11-05 00:27:24 +0000 | |||
100 | @@ -23,4 +23,8 @@ | |||
101 | 23 | 23 | ||
102 | 24 | #include "templates.h" | 24 | #include "templates.h" |
103 | 25 | 25 | ||
104 | 26 | #ifdef cl_khr_fp64 | ||
105 | 26 | DEFINE_EXPR_V_VV(atan2pi, atan2(a, b)/(stype)M_PI) | 27 | DEFINE_EXPR_V_VV(atan2pi, atan2(a, b)/(stype)M_PI) |
106 | 28 | #else | ||
107 | 29 | DEFINE_EXPR_V_VV(atan2pi, atan2(a, b)/M_PI_F) | ||
108 | 30 | #endif | ||
109 | 27 | 31 | ||
110 | === modified file 'lib/kernel/atanpi.cl' | |||
111 | --- lib/kernel/atanpi.cl 2011-10-26 03:01:29 +0000 | |||
112 | +++ lib/kernel/atanpi.cl 2011-11-05 00:27:24 +0000 | |||
113 | @@ -23,4 +23,8 @@ | |||
114 | 23 | 23 | ||
115 | 24 | #include "templates.h" | 24 | #include "templates.h" |
116 | 25 | 25 | ||
117 | 26 | #ifdef cl_khr_fp64 | ||
118 | 26 | DEFINE_EXPR_V_V(atanpi, atan(a)/(stype)M_PI) | 27 | DEFINE_EXPR_V_V(atanpi, atan(a)/(stype)M_PI) |
119 | 28 | #else | ||
120 | 29 | DEFINE_EXPR_V_V(atanpi, atan(a)/M_PI_F) | ||
121 | 30 | #endif | ||
122 | 27 | 31 | ||
123 | === modified file 'lib/kernel/cospi.cl' | |||
124 | --- lib/kernel/cospi.cl 2011-10-26 03:01:29 +0000 | |||
125 | +++ lib/kernel/cospi.cl 2011-11-05 00:27:24 +0000 | |||
126 | @@ -23,5 +23,8 @@ | |||
127 | 23 | 23 | ||
128 | 24 | #include "templates.h" | 24 | #include "templates.h" |
129 | 25 | 25 | ||
131 | 26 | #undef cospi | 26 | #ifdef cl_khr_fp64 |
132 | 27 | DEFINE_EXPR_V_V(cospi, cos((stype)M_PI*a)) | 27 | DEFINE_EXPR_V_V(cospi, cos((stype)M_PI*a)) |
133 | 28 | #else | ||
134 | 29 | DEFINE_EXPR_V_V(cospi, cos(M_PI_F*a)) | ||
135 | 30 | #endif | ||
136 | 28 | 31 | ||
137 | === modified file 'lib/kernel/degrees.cl' | |||
138 | --- lib/kernel/degrees.cl 2011-10-26 21:01:40 +0000 | |||
139 | +++ lib/kernel/degrees.cl 2011-11-05 00:27:24 +0000 | |||
140 | @@ -23,4 +23,8 @@ | |||
141 | 23 | 23 | ||
142 | 24 | #include "templates.h" | 24 | #include "templates.h" |
143 | 25 | 25 | ||
145 | 26 | DEFINE_EXPR_V_V(degrees, (stype)(180.0 / M_PI) * a) | 26 | #ifdef cl_khr_fp64 |
146 | 27 | DEFINE_EXPR_V_V(degrees, (stype)(180 / M_PI) * a) | ||
147 | 28 | #else | ||
148 | 29 | DEFINE_EXPR_V_V(degrees, (180 / M_PI_F) * a) | ||
149 | 30 | #endif | ||
150 | 27 | 31 | ||
151 | === modified file 'lib/kernel/exp10.cl' | |||
152 | --- lib/kernel/exp10.cl 2011-10-26 03:01:29 +0000 | |||
153 | +++ lib/kernel/exp10.cl 2011-11-05 00:27:24 +0000 | |||
154 | @@ -23,4 +23,8 @@ | |||
155 | 23 | 23 | ||
156 | 24 | #include "templates.h" | 24 | #include "templates.h" |
157 | 25 | 25 | ||
158 | 26 | #ifdef cl_khr_fp64 | ||
159 | 26 | DEFINE_EXPR_V_V(exp10, exp((stype)M_LN10*a)) | 27 | DEFINE_EXPR_V_V(exp10, exp((stype)M_LN10*a)) |
160 | 28 | #else | ||
161 | 29 | DEFINE_EXPR_V_V(exp10, exp(M_LN10_F*a)) | ||
162 | 30 | #endif | ||
163 | 27 | 31 | ||
164 | === modified file 'lib/kernel/fdim.cl' | |||
165 | --- lib/kernel/fdim.cl 2011-10-26 03:01:29 +0000 | |||
166 | +++ lib/kernel/fdim.cl 2011-11-05 00:27:24 +0000 | |||
167 | @@ -23,4 +23,4 @@ | |||
168 | 23 | 23 | ||
169 | 24 | #include "templates.h" | 24 | #include "templates.h" |
170 | 25 | 25 | ||
172 | 26 | DEFINE_EXPR_V_VV(fdim, fmax(a-b, (stype)0.0)) | 26 | DEFINE_EXPR_V_VV(fdim, fmax(a-b, (stype)0)) |
173 | 27 | 27 | ||
174 | === modified file 'lib/kernel/fract.cl' | |||
175 | --- lib/kernel/fract.cl 2011-10-26 03:01:29 +0000 | |||
176 | +++ lib/kernel/fract.cl 2011-11-05 00:27:24 +0000 | |||
177 | @@ -23,4 +23,9 @@ | |||
178 | 23 | 23 | ||
179 | 24 | #include "templates.h" | 24 | #include "templates.h" |
180 | 25 | 25 | ||
181 | 26 | |||
182 | 27 | #ifdef cl_khr_fp64 | ||
183 | 26 | DEFINE_EXPR_V_VPV(fract, fmin(a - floor(a), (vtype)(stype)(sizeof(stype)==4 ? 0x1.fffffep-1f : 0x1.fffffffffffffp-1))) | 28 | DEFINE_EXPR_V_VPV(fract, fmin(a - floor(a), (vtype)(stype)(sizeof(stype)==4 ? 0x1.fffffep-1f : 0x1.fffffffffffffp-1))) |
184 | 29 | #else | ||
185 | 30 | DEFINE_EXPR_V_VPV(fract, fmin(a - floor(a), (vtype)(stype)0x1.fffffep-1f)) | ||
186 | 31 | #endif | ||
187 | 27 | 32 | ||
188 | === modified file 'lib/kernel/radians.cl' | |||
189 | --- lib/kernel/radians.cl 2011-10-26 21:01:40 +0000 | |||
190 | +++ lib/kernel/radians.cl 2011-11-05 00:27:24 +0000 | |||
191 | @@ -23,4 +23,8 @@ | |||
192 | 23 | 23 | ||
193 | 24 | #include "templates.h" | 24 | #include "templates.h" |
194 | 25 | 25 | ||
196 | 26 | DEFINE_EXPR_V_V(radians, (stype)(M_PI / 180.0) * a) | 26 | #ifdef cl_khr_fp64 |
197 | 27 | DEFINE_EXPR_V_V(radians, (stype)(M_PI / 180) * a) | ||
198 | 28 | #else | ||
199 | 29 | DEFINE_EXPR_V_V(radians, (M_PI_F / 180) * a) | ||
200 | 30 | #endif | ||
201 | 27 | 31 | ||
202 | === modified file 'lib/kernel/rsqrt.cl' | |||
203 | --- lib/kernel/rsqrt.cl 2011-10-26 03:01:29 +0000 | |||
204 | +++ lib/kernel/rsqrt.cl 2011-11-05 00:27:24 +0000 | |||
205 | @@ -23,4 +23,4 @@ | |||
206 | 23 | 23 | ||
207 | 24 | #include "templates.h" | 24 | #include "templates.h" |
208 | 25 | 25 | ||
210 | 26 | DEFINE_EXPR_V_V(rsqrt, (stype)1.0/sqrt(a)) | 26 | DEFINE_EXPR_V_V(rsqrt, (stype)1/sqrt(a)) |
211 | 27 | 27 | ||
212 | === modified file 'lib/kernel/signbit.cl' | |||
213 | --- lib/kernel/signbit.cl 2011-10-27 01:35:56 +0000 | |||
214 | +++ lib/kernel/signbit.cl 2011-11-05 00:27:24 +0000 | |||
215 | @@ -23,4 +23,4 @@ | |||
216 | 23 | 23 | ||
217 | 24 | #include "templates.h" | 24 | #include "templates.h" |
218 | 25 | 25 | ||
220 | 26 | DEFINE_BUILTIN_J_V(signbit) | 26 | DEFINE_BUILTIN_K_V(signbit) |
221 | 27 | 27 | ||
222 | === modified file 'lib/kernel/sinpi.cl' | |||
223 | --- lib/kernel/sinpi.cl 2011-10-26 03:01:29 +0000 | |||
224 | +++ lib/kernel/sinpi.cl 2011-11-05 00:27:24 +0000 | |||
225 | @@ -23,4 +23,8 @@ | |||
226 | 23 | 23 | ||
227 | 24 | #include "templates.h" | 24 | #include "templates.h" |
228 | 25 | 25 | ||
229 | 26 | #ifdef cl_khr_fp64 | ||
230 | 26 | DEFINE_EXPR_V_V(sinpi, sin((stype)M_PI*a)) | 27 | DEFINE_EXPR_V_V(sinpi, sin((stype)M_PI*a)) |
231 | 28 | #else | ||
232 | 29 | DEFINE_EXPR_V_V(sinpi, sin(M_PI_F*a)) | ||
233 | 30 | #endif | ||
234 | 27 | 31 | ||
235 | === modified file 'lib/kernel/smoothstep.cl' | |||
236 | --- lib/kernel/smoothstep.cl 2011-10-27 00:18:42 +0000 | |||
237 | +++ lib/kernel/smoothstep.cl 2011-11-05 00:27:24 +0000 | |||
238 | @@ -25,7 +25,7 @@ | |||
239 | 25 | 25 | ||
240 | 26 | DEFINE_EXPR_V_VVV(smoothstep, | 26 | DEFINE_EXPR_V_VVV(smoothstep, |
241 | 27 | ({ | 27 | ({ |
244 | 28 | vtype t = clamp((c - a) / (b - a), (stype)0.0, (stype)1.0); | 28 | vtype t = clamp((c - a) / (b - a), (stype)0, (stype)1); |
245 | 29 | t * t * mad((vtype)-2.0, t, (vtype)3.0); | 29 | t * t * mad((vtype)-2, t, (vtype)3); |
246 | 30 | })) | 30 | })) |
247 | 31 | DEFINE_EXPR_V_SSV(smoothstep, smoothstep((vtype)a, (vtype)b, c)) | 31 | DEFINE_EXPR_V_SSV(smoothstep, smoothstep((vtype)a, (vtype)b, c)) |
248 | 32 | 32 | ||
249 | === modified file 'lib/kernel/step.cl' | |||
250 | --- lib/kernel/step.cl 2011-10-27 00:18:42 +0000 | |||
251 | +++ lib/kernel/step.cl 2011-11-05 00:27:24 +0000 | |||
252 | @@ -27,8 +27,8 @@ | |||
253 | 27 | // DEFINE_EXPR_V_VV(step, b < a ? (vtype)0.0 : (vtype)1.0) | 27 | // DEFINE_EXPR_V_VV(step, b < a ? (vtype)0.0 : (vtype)1.0) |
254 | 28 | DEFINE_EXPR_V_VV(step, | 28 | DEFINE_EXPR_V_VV(step, |
255 | 29 | ({ | 29 | ({ |
258 | 30 | vtype zero = 0.0; | 30 | vtype zero = 0; |
259 | 31 | vtype one = 1.0; | 31 | vtype one = 1; |
260 | 32 | jtype result = b < a ? *(jtype*)&zero : *(jtype*)&one; | 32 | jtype result = b < a ? *(jtype*)&zero : *(jtype*)&one; |
261 | 33 | *(vtype*)&result; | 33 | *(vtype*)&result; |
262 | 34 | })) | 34 | })) |
263 | 35 | 35 | ||
264 | === modified file 'lib/kernel/tanpi.cl' | |||
265 | --- lib/kernel/tanpi.cl 2011-10-26 03:01:29 +0000 | |||
266 | +++ lib/kernel/tanpi.cl 2011-11-05 00:27:24 +0000 | |||
267 | @@ -23,4 +23,8 @@ | |||
268 | 23 | 23 | ||
269 | 24 | #include "templates.h" | 24 | #include "templates.h" |
270 | 25 | 25 | ||
271 | 26 | #ifdef cl_khr_fp64 | ||
272 | 26 | DEFINE_EXPR_V_V(tanpi, tan((stype)M_PI*a)) | 27 | DEFINE_EXPR_V_V(tanpi, tan((stype)M_PI*a)) |
273 | 28 | #else | ||
274 | 29 | DEFINE_EXPR_V_V(tanpi, tan(M_PI_F*a)) | ||
275 | 30 | #endif | ||
276 | 27 | 31 | ||
277 | === added directory 'lib/kernel/tce' | |||
278 | === removed directory 'lib/kernel/tce' | |||
279 | === added file 'lib/kernel/tce/Makefile.am' | |||
280 | --- lib/kernel/tce/Makefile.am 1970-01-01 00:00:00 +0000 | |||
281 | +++ lib/kernel/tce/Makefile.am 2011-11-05 00:27:24 +0000 | |||
282 | @@ -0,0 +1,52 @@ | |||
283 | 1 | # Process this file with automake to produce Makefile.in (in this, | ||
284 | 2 | # and all subdirectories). | ||
285 | 3 | # Makefile.am for pocl/lib/kernel/tce. | ||
286 | 4 | # | ||
287 | 5 | # The TCE (http://tce.cs.tut.fi) target. | ||
288 | 6 | # | ||
289 | 7 | # Copyright (c) 2011 Universidad Rey Juan Carlos | ||
290 | 8 | # | ||
291 | 9 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
292 | 10 | # of this software and associated documentation files (the "Software"), to deal | ||
293 | 11 | # in the Software without restriction, including without limitation the rights | ||
294 | 12 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
295 | 13 | # copies of the Software, and to permit persons to whom the Software is | ||
296 | 14 | # furnished to do so, subject to the following conditions: | ||
297 | 15 | # | ||
298 | 16 | # The above copyright notice and this permission notice shall be included in | ||
299 | 17 | # all copies or substantial portions of the Software. | ||
300 | 18 | # | ||
301 | 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
302 | 20 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
303 | 21 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
304 | 22 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
305 | 23 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
306 | 24 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
307 | 25 | # THE SOFTWARE. | ||
308 | 26 | |||
309 | 27 | targetpkglibdir = $(pkglibdir)/tce | ||
310 | 28 | targetpkglib_LIBRARIES = libkernel.a | ||
311 | 29 | |||
312 | 30 | vpath %.cl @srcdir@/.. | ||
313 | 31 | vpath %.c @srcdir@/.. | ||
314 | 32 | vpath %.ll @srcdir@/.. | ||
315 | 33 | |||
316 | 34 | include ../sources.mk | ||
317 | 35 | |||
318 | 36 | libkernel_a_LIBADD = barrier.o | ||
319 | 37 | EXTRA_DIST = barrier.ll | ||
320 | 38 | |||
321 | 39 | RANLIB = `@LLVM_CONFIG@ --bindir`/llvm-ranlib | ||
322 | 40 | AR = `@LLVM_CONFIG@ --bindir`/llvm-ar | ||
323 | 41 | |||
324 | 42 | .cl.o: | ||
325 | 43 | $(CLANG) $(AM_CPPFLAGS) $(CLANGFLAGS) -ccc-host-triple tce-tut-llvm -c -emit-llvm -include $(top_srcdir)/include/_kernel.h -o $@ $< | ||
326 | 44 | |||
327 | 45 | .c.o: | ||
328 | 46 | $(CLANG) $(AM_CPPFLAGS) $(CLANGFLAGS) -ccc-host-triple tce-tut-llvm -c -emit-llvm -include $(top_srcdir)/include/_kernel.h -o $@ $< | ||
329 | 47 | |||
330 | 48 | barrier.o: barrier.ll | ||
331 | 49 | $(LLVM_AS) -o $@ $< | ||
332 | 50 | |||
333 | 51 | $(libkernel_a_SOURCES:.c=.o): $(top_srcdir)/include/_kernel.h ../templates.h | ||
334 | 52 | $(libkernel_a_SOURCES:.cl=.o): $(top_srcdir)/include/_kernel.h ../templates.h | ||
335 | 0 | 53 | ||
336 | === removed file 'lib/kernel/tce/Makefile.am' | |||
337 | --- lib/kernel/tce/Makefile.am 2011-11-03 18:58:00 +0000 | |||
338 | +++ lib/kernel/tce/Makefile.am 1970-01-01 00:00:00 +0000 | |||
339 | @@ -1,52 +0,0 @@ | |||
340 | 1 | # Process this file with automake to produce Makefile.in (in this, | ||
341 | 2 | # and all subdirectories). | ||
342 | 3 | # Makefile.am for pocl/lib/kernel/tce. | ||
343 | 4 | # | ||
344 | 5 | # The TCE (http://tce.cs.tut.fi) target. | ||
345 | 6 | # | ||
346 | 7 | # Copyright (c) 2011 Universidad Rey Juan Carlos | ||
347 | 8 | # | ||
348 | 9 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
349 | 10 | # of this software and associated documentation files (the "Software"), to deal | ||
350 | 11 | # in the Software without restriction, including without limitation the rights | ||
351 | 12 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
352 | 13 | # copies of the Software, and to permit persons to whom the Software is | ||
353 | 14 | # furnished to do so, subject to the following conditions: | ||
354 | 15 | # | ||
355 | 16 | # The above copyright notice and this permission notice shall be included in | ||
356 | 17 | # all copies or substantial portions of the Software. | ||
357 | 18 | # | ||
358 | 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
359 | 20 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
360 | 21 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
361 | 22 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
362 | 23 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
363 | 24 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
364 | 25 | # THE SOFTWARE. | ||
365 | 26 | |||
366 | 27 | targetpkglibdir = $(pkglibdir)/tce | ||
367 | 28 | targetpkglib_LIBRARIES = libkernel.a | ||
368 | 29 | |||
369 | 30 | vpath %.cl @srcdir@/.. | ||
370 | 31 | vpath %.c @srcdir@/.. | ||
371 | 32 | vpath %.ll @srcdir@/.. | ||
372 | 33 | |||
373 | 34 | include ../sources.mk | ||
374 | 35 | |||
375 | 36 | libkernel_a_LIBADD = barrier.o | ||
376 | 37 | EXTRA_DIST = barrier.ll | ||
377 | 38 | |||
378 | 39 | RANLIB = `@LLVM_CONFIG@ --bindir`/llvm-ranlib | ||
379 | 40 | AR = `@LLVM_CONFIG@ --bindir`/llvm-ar | ||
380 | 41 | |||
381 | 42 | .cl.o: | ||
382 | 43 | $(CLANG) $(AM_CPPFLAGS) $(CLANGFLAGS) -ccc-host-triple tce-tut-llvm -c -emit-llvm -include $(top_srcdir)/include/_kernel.h -o $@ $< | ||
383 | 44 | |||
384 | 45 | .c.o: | ||
385 | 46 | $(CLANG) $(AM_CPPFLAGS) $(CLANGFLAGS) -ccc-host-triple tce-tut-llvm -c -emit-llvm -include $(top_srcdir)/include/_kernel.h -o $@ $< | ||
386 | 47 | |||
387 | 48 | barrier.o: barrier.ll | ||
388 | 49 | $(LLVM_AS) -o $@ $< | ||
389 | 50 | |||
390 | 51 | $(libkernel_a_SOURCES:.c=.o): $(top_srcdir)/include/_kernel.h ../templates.h | ||
391 | 52 | $(libkernel_a_SOURCES:.cl=.o): $(top_srcdir)/include/_kernel.h ../templates.h | ||
392 | 53 | 0 | ||
393 | === modified file 'lib/kernel/templates.h' | |||
394 | --- lib/kernel/templates.h 2011-11-01 16:33:17 +0000 | |||
395 | +++ lib/kernel/templates.h 2011-11-05 00:27:24 +0000 | |||
396 | @@ -359,6 +359,48 @@ | |||
397 | 359 | IMPLEMENT_BUILTIN_J_V(NAME, int16, float16 , lo, hi) | 359 | IMPLEMENT_BUILTIN_J_V(NAME, int16, float16 , lo, hi) |
398 | 360 | #endif | 360 | #endif |
399 | 361 | 361 | ||
400 | 362 | #define IMPLEMENT_BUILTIN_K_V(NAME, JTYPE, VTYPE, LO, HI) \ | ||
401 | 363 | JTYPE __attribute__ ((overloadable)) \ | ||
402 | 364 | NAME(VTYPE a) \ | ||
403 | 365 | { \ | ||
404 | 366 | return (JTYPE)(NAME(a.LO), NAME(a.HI)); \ | ||
405 | 367 | } | ||
406 | 368 | #ifdef cl_khr_fp64 | ||
407 | 369 | #define DEFINE_BUILTIN_K_V(NAME) \ | ||
408 | 370 | int __attribute__ ((overloadable)) \ | ||
409 | 371 | NAME(float a) \ | ||
410 | 372 | { \ | ||
411 | 373 | return __builtin_##NAME##f(a); \ | ||
412 | 374 | } \ | ||
413 | 375 | int __attribute__ ((overloadable)) \ | ||
414 | 376 | NAME(double a) \ | ||
415 | 377 | { \ | ||
416 | 378 | return __builtin_##NAME(a); \ | ||
417 | 379 | } \ | ||
418 | 380 | IMPLEMENT_BUILTIN_K_V(NAME, int2 , float2 , lo, hi) \ | ||
419 | 381 | IMPLEMENT_BUILTIN_K_V(NAME, int3 , float3 , lo, s2) \ | ||
420 | 382 | IMPLEMENT_BUILTIN_K_V(NAME, int4 , float4 , lo, hi) \ | ||
421 | 383 | IMPLEMENT_BUILTIN_K_V(NAME, int8 , float8 , lo, hi) \ | ||
422 | 384 | IMPLEMENT_BUILTIN_K_V(NAME, int16 , float16 , lo, hi) \ | ||
423 | 385 | IMPLEMENT_BUILTIN_K_V(NAME, long2 , double2 , lo, hi) \ | ||
424 | 386 | IMPLEMENT_BUILTIN_K_V(NAME, long3 , double3 , lo, s2) \ | ||
425 | 387 | IMPLEMENT_BUILTIN_K_V(NAME, long4 , double4 , lo, hi) \ | ||
426 | 388 | IMPLEMENT_BUILTIN_K_V(NAME, long8 , double8 , lo, hi) \ | ||
427 | 389 | IMPLEMENT_BUILTIN_K_V(NAME, long16, double16, lo, hi) | ||
428 | 390 | #else | ||
429 | 391 | #define DEFINE_BUILTIN_K_V(NAME) \ | ||
430 | 392 | int __attribute__ ((overloadable)) \ | ||
431 | 393 | NAME(float a) \ | ||
432 | 394 | { \ | ||
433 | 395 | return __builtin_##NAME##f(a); \ | ||
434 | 396 | } \ | ||
435 | 397 | IMPLEMENT_BUILTIN_K_V(NAME, int2 , float2 , lo, hi) \ | ||
436 | 398 | IMPLEMENT_BUILTIN_K_V(NAME, int3 , float3 , lo, s2) \ | ||
437 | 399 | IMPLEMENT_BUILTIN_K_V(NAME, int4 , float4 , lo, hi) \ | ||
438 | 400 | IMPLEMENT_BUILTIN_K_V(NAME, int8 , float8 , lo, hi) \ | ||
439 | 401 | IMPLEMENT_BUILTIN_K_V(NAME, int16, float16 , lo, hi) | ||
440 | 402 | #endif | ||
441 | 403 | |||
442 | 362 | #define IMPLEMENT_EXPR_V_V(NAME, EXPR, VTYPE, STYPE) \ | 404 | #define IMPLEMENT_EXPR_V_V(NAME, EXPR, VTYPE, STYPE) \ |
443 | 363 | VTYPE __attribute__ ((overloadable)) \ | 405 | VTYPE __attribute__ ((overloadable)) \ |
444 | 364 | NAME(VTYPE a, VTYPE b) \ | 406 | NAME(VTYPE a, VTYPE b) \ |
445 | 365 | 407 | ||
446 | === added file 'lib/kernel/x86_64/signbit.cl' | |||
447 | --- lib/kernel/x86_64/signbit.cl 1970-01-01 00:00:00 +0000 | |||
448 | +++ lib/kernel/x86_64/signbit.cl 2011-11-05 00:27:24 +0000 | |||
449 | @@ -0,0 +1,55 @@ | |||
450 | 1 | /* OpenCL built-in library: signbit() | ||
451 | 2 | |||
452 | 3 | Copyright (c) 2011 Universidad Rey Juan Carlos | ||
453 | 4 | |||
454 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
455 | 6 | of this software and associated documentation files (the "Software"), to deal | ||
456 | 7 | in the Software without restriction, including without limitation the rights | ||
457 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
458 | 9 | copies of the Software, and to permit persons to whom the Software is | ||
459 | 10 | furnished to do so, subject to the following conditions: | ||
460 | 11 | |||
461 | 12 | The above copyright notice and this permission notice shall be included in | ||
462 | 13 | all copies or substantial portions of the Software. | ||
463 | 14 | |||
464 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
465 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
466 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONORDEREDRINGEMENT. IN NO EVENT SHALL THE | ||
467 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
468 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
469 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
470 | 21 | THE SOFTWARE. | ||
471 | 22 | */ | ||
472 | 23 | |||
473 | 24 | #define IMPLEMENT_SIGNBIT_BUILTIN_FLOAT __builtin_signbitf(a) | ||
474 | 25 | #define IMPLEMENT_SIGNBIT_BUILTIN_DOUBLE __builtin_signbit(a) | ||
475 | 26 | #define IMPLEMENT_SIGNBIT_DIRECT \ | ||
476 | 27 | ({ \ | ||
477 | 28 | int bits = CHAR_BIT * sizeof(stype); \ | ||
478 | 29 | *(jtype*)&a >> (jtype)(bits-1); \ | ||
479 | 30 | }) | ||
480 | 31 | |||
481 | 32 | #define IMPLEMENT_DIRECT(NAME, VTYPE, STYPE, JTYPE, EXPR) \ | ||
482 | 33 | JTYPE _cl_overloadable NAME(VTYPE a) \ | ||
483 | 34 | { \ | ||
484 | 35 | typedef VTYPE vtype; \ | ||
485 | 36 | typedef STYPE stype; \ | ||
486 | 37 | typedef JTYPE jtype; \ | ||
487 | 38 | return EXPR; \ | ||
488 | 39 | } | ||
489 | 40 | |||
490 | 41 | |||
491 | 42 | |||
492 | 43 | IMPLEMENT_DIRECT(signbit, float , float, int , IMPLEMENT_SIGNBIT_BUILTIN_FLOAT) | ||
493 | 44 | IMPLEMENT_DIRECT(signbit, float2 , float, int2 , IMPLEMENT_SIGNBIT_DIRECT) | ||
494 | 45 | IMPLEMENT_DIRECT(signbit, float3 , float, int3 , IMPLEMENT_SIGNBIT_DIRECT) | ||
495 | 46 | IMPLEMENT_DIRECT(signbit, float4 , float, int4 , IMPLEMENT_SIGNBIT_DIRECT) | ||
496 | 47 | IMPLEMENT_DIRECT(signbit, float8 , float, int8 , IMPLEMENT_SIGNBIT_DIRECT) | ||
497 | 48 | IMPLEMENT_DIRECT(signbit, float16, float, int16, IMPLEMENT_SIGNBIT_DIRECT) | ||
498 | 49 | |||
499 | 50 | IMPLEMENT_DIRECT(signbit, double , double, int , IMPLEMENT_SIGNBIT_BUILTIN_DOUBLE) | ||
500 | 51 | IMPLEMENT_DIRECT(signbit, double2 , double, long2 , IMPLEMENT_SIGNBIT_DIRECT) | ||
501 | 52 | IMPLEMENT_DIRECT(signbit, double3 , double, long3 , IMPLEMENT_SIGNBIT_DIRECT) | ||
502 | 53 | IMPLEMENT_DIRECT(signbit, double4 , double, long4 , IMPLEMENT_SIGNBIT_DIRECT) | ||
503 | 54 | IMPLEMENT_DIRECT(signbit, double8 , double, long8 , IMPLEMENT_SIGNBIT_DIRECT) | ||
504 | 55 | IMPLEMENT_DIRECT(signbit, double16, double, long16, IMPLEMENT_SIGNBIT_DIRECT) |