DPC++ Runtime
Runtime libraries for oneAPI DPC++
builtins_relational.cpp
Go to the documentation of this file.
1 //==------ builtins_relational.cpp - SYCL built-in relational functions ----==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // This file defines the host versions of functions defined
10 // in SYCL SPEC section - 4.13.7 Relational functions.
11 
12 #include "builtins_helper.hpp"
14 
15 #include <cmath>
16 
17 namespace s = sycl;
18 namespace d = s::detail;
19 
20 namespace __host_std {
21 namespace {
22 
23 template <typename T> inline T __vFOrdEqual(T x, T y) {
24  return -static_cast<T>(x == y);
25 }
26 
27 template <typename T> inline T __sFOrdEqual(T x, T y) { return x == y; }
28 
29 template <typename T> inline T __vFUnordNotEqual(T x, T y) {
30  return -static_cast<T>(x != y);
31 }
32 
33 template <typename T> inline T __sFUnordNotEqual(T x, T y) { return x != y; }
34 
35 template <typename T> inline T __vFOrdGreaterThan(T x, T y) {
36  return -static_cast<T>(x > y);
37 }
38 
39 template <typename T> inline T __sFOrdGreaterThan(T x, T y) { return x > y; }
40 
41 template <typename T> inline T __vFOrdGreaterThanEqual(T x, T y) {
42  return -static_cast<T>(x >= y);
43 }
44 
45 template <typename T> inline T __sFOrdGreaterThanEqual(T x, T y) {
46  return x >= y;
47 }
48 
49 template <typename T> inline T __vFOrdLessThanEqual(T x, T y) {
50  return -static_cast<T>(x <= y);
51 }
52 
53 template <typename T> inline T __sFOrdLessThanEqual(T x, T y) { return x <= y; }
54 
55 template <typename T> inline T __vFOrdNotEqual(T x, T y) {
56  return -static_cast<T>((x < y) || (x > y));
57 }
58 
59 template <typename T> inline T __sFOrdNotEqual(T x, T y) {
60  return ((x < y) || (x > y));
61 }
62 
63 template <typename T> inline T __vLessOrGreater(T x, T y) {
64  return -static_cast<T>((x < y) || (x > y));
65 }
66 
67 template <typename T> inline T __sLessOrGreater(T x, T y) {
68  return ((x < y) || (x > y));
69 }
70 
71 template <typename T> s::cl_int inline __Any(T x) { return d::msbIsSet(x); }
72 template <typename T> s::cl_int inline __All(T x) { return d::msbIsSet(x); }
73 
74 template <typename T> inline T __vOrdered(T x, T y) {
75  return -static_cast<T>(
77 }
78 
79 template <typename T> inline T __sOrdered(T x, T y) {
81 }
82 
83 template <typename T> inline T __vUnordered(T x, T y) {
84  return -(static_cast<T>(
86 }
87 
88 template <typename T> inline T __sUnordered(T x, T y) {
90 }
91 
92 template <typename T>
93 inline typename sycl::detail::enable_if_t<d::is_sgeninteger<T>::value, T>
94 __sycl_host_bitselect(T a, T b, T c) {
95  return (a & ~c) | (b & c);
96 }
97 
98 template <typename T> union databitset;
99 // cl_float
100 template <> union databitset<s::cl_float> {
101  static_assert(sizeof(s::cl_int) == sizeof(s::cl_float),
102  "size of cl_float is not equal to 32 bits(cl_int).");
103  s::cl_float f;
104  s::cl_int i;
105 };
106 
107 // cl_double
108 template <> union databitset<s::cl_double> {
109  static_assert(sizeof(s::cl_long) == sizeof(s::cl_double),
110  "size of cl_double is not equal to 64 bits(cl_long).");
111  s::cl_double f;
112  s::cl_long i;
113 };
114 
115 // cl_half
116 template <> union databitset<s::cl_half> {
117  static_assert(sizeof(s::cl_short) == sizeof(s::cl_half),
118  "size of cl_half is not equal to 16 bits(cl_short).");
119  s::cl_half f;
120  s::cl_short i;
121 };
122 
123 template <typename T>
124 typename sycl::detail::enable_if_t<d::is_sgenfloat<T>::value,
125  T> inline __sycl_host_bitselect(T a, T b,
126  T c) {
127  databitset<T> ba;
128  ba.f = a;
129  databitset<T> bb;
130  bb.f = b;
131  databitset<T> bc;
132  bc.f = c;
133  databitset<T> br;
134  br.f = 0;
135  br.i = ((ba.i & ~bc.i) | (bb.i & bc.i));
136  return br.f;
137 }
138 
139 template <typename T, typename T2>
140 inline T2 __sycl_host_select(T2 a, T2 b, T c) {
141  return (c ? b : a);
142 }
143 
144 template <typename T, typename T2> inline T2 __vselect(T2 a, T2 b, T c) {
145  return d::msbIsSet(c) ? b : a;
146 }
147 } // namespace
148 
149 // ---------- 4.13.7 Relational functions. Host implementations. ---------------
150 // FOrdEqual-isequal
152  s::cl_float y) __NOEXC {
153  return __sFOrdEqual(x, y);
154 }
156  s::cl_double y) __NOEXC {
157  return __sFOrdEqual(x, y);
158 }
160  s::cl_half y) __NOEXC {
161  return __sFOrdEqual(x, y);
162 }
164  s::cl_float)
166  s::cl_double)
168  s::cl_half)
169 
170 // FUnordNotEqual-isnotequal
171 __SYCL_EXPORT s::cl_int sycl_host_FUnordNotEqual(s::cl_float x,
172  s::cl_float y) __NOEXC {
173  return __sFUnordNotEqual(x, y);
174 }
175 __SYCL_EXPORT s::cl_int sycl_host_FUnordNotEqual(s::cl_double x,
176  s::cl_double y) __NOEXC {
177  return __sFUnordNotEqual(x, y);
178 }
179 __SYCL_EXPORT s::cl_int sycl_host_FUnordNotEqual(s::cl_half x,
180  s::cl_half y) __NOEXC {
181  return __sFUnordNotEqual(x, y);
182 }
183 MAKE_1V_2V_FUNC(sycl_host_FUnordNotEqual, __vFUnordNotEqual, s::cl_int,
185 MAKE_1V_2V_FUNC(sycl_host_FUnordNotEqual, __vFUnordNotEqual, s::cl_long,
187 MAKE_1V_2V_FUNC(sycl_host_FUnordNotEqual, __vFUnordNotEqual, s::cl_short,
189 
190 // (FOrdGreaterThan) // isgreater
191 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThan(s::cl_float x,
192  s::cl_float y) __NOEXC {
193  return __sFOrdGreaterThan(x, y);
194 }
195 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThan(s::cl_double x,
196  s::cl_double y) __NOEXC {
197  return __sFOrdGreaterThan(x, y);
198 }
199 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThan(s::cl_half x,
200  s::cl_half y) __NOEXC {
201  return __sFOrdGreaterThan(x, y);
202 }
203 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThan, __vFOrdGreaterThan, s::cl_int,
205 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThan, __vFOrdGreaterThan, s::cl_long,
207 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThan, __vFOrdGreaterThan, s::cl_short,
209 
210 // (FOrdGreaterThanEqual) // isgreaterequal
211 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThanEqual(s::cl_float x,
212  s::cl_float y) __NOEXC {
213  return __sFOrdGreaterThanEqual(x, y);
214 }
215 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThanEqual(s::cl_double x,
216  s::cl_double y) __NOEXC {
217  return __sFOrdGreaterThanEqual(x, y);
218 }
219 __SYCL_EXPORT s::cl_int sycl_host_FOrdGreaterThanEqual(s::cl_half x,
220  s::cl_half y) __NOEXC {
221  return __sFOrdGreaterThanEqual(x, y);
222 }
223 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThanEqual, __vFOrdGreaterThanEqual,
225 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThanEqual, __vFOrdGreaterThanEqual,
227 MAKE_1V_2V_FUNC(sycl_host_FOrdGreaterThanEqual, __vFOrdGreaterThanEqual,
229 
230 // (FOrdLessThan) // isless
231 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThan(s::cl_float x,
232  s::cl_float y) __NOEXC {
233  return (x < y);
234 }
235 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThan(s::cl_double x,
236  s::cl_double y) __NOEXC {
237  return (x < y);
238 }
239 __SYCL_EXPORT s::cl_int __vFOrdLessThan(s::cl_float x, s::cl_float y) __NOEXC {
240  return -(x < y);
241 }
242 __SYCL_EXPORT s::cl_long __vFOrdLessThan(s::cl_double x,
243  s::cl_double y) __NOEXC {
244  return -(x < y);
245 }
246 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThan(s::cl_half x,
247  s::cl_half y) __NOEXC {
248  return (x < y);
249 }
250 __SYCL_EXPORT s::cl_short __vFOrdLessThan(s::cl_half x, s::cl_half y) __NOEXC {
251  return -static_cast<s::cl_short>(x < y);
252 }
253 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThan, __vFOrdLessThan, s::cl_int, s::cl_float,
254  s::cl_float)
255 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThan, __vFOrdLessThan, s::cl_long,
257 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThan, __vFOrdLessThan, s::cl_short,
259 
260 // (FOrdLessThanEqual) // islessequal
261 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThanEqual(s::cl_float x,
262  s::cl_float y) __NOEXC {
263  return __sFOrdLessThanEqual(x, y);
264 }
265 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThanEqual(s::cl_double x,
266  s::cl_double y) __NOEXC {
267  return __sFOrdLessThanEqual(x, y);
268 }
269 __SYCL_EXPORT s::cl_int sycl_host_FOrdLessThanEqual(s::cl_half x,
270  s::cl_half y) __NOEXC {
271  return __sFOrdLessThanEqual(x, y);
272 }
273 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThanEqual, __vFOrdLessThanEqual, s::cl_int,
275 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThanEqual, __vFOrdLessThanEqual, s::cl_long,
277 MAKE_1V_2V_FUNC(sycl_host_FOrdLessThanEqual, __vFOrdLessThanEqual, s::cl_short,
279 
280 // (FOrdNotEqual) // islessgreater
281 __SYCL_EXPORT s::cl_int sycl_host_FOrdNotEqual(s::cl_float x,
282  s::cl_float y) __NOEXC {
283  return __sFOrdNotEqual(x, y);
284 }
285 __SYCL_EXPORT s::cl_int sycl_host_FOrdNotEqual(s::cl_double x,
286  s::cl_double y) __NOEXC {
287  return __sFOrdNotEqual(x, y);
288 }
289 __SYCL_EXPORT s::cl_int sycl_host_FOrdNotEqual(s::cl_half x,
290  s::cl_half y) __NOEXC {
291  return __sFOrdNotEqual(x, y);
292 }
293 MAKE_1V_2V_FUNC(sycl_host_FOrdNotEqual, __vFOrdNotEqual, s::cl_int, s::cl_float,
294  s::cl_float)
295 MAKE_1V_2V_FUNC(sycl_host_FOrdNotEqual, __vFOrdNotEqual, s::cl_long,
297 MAKE_1V_2V_FUNC(sycl_host_FOrdNotEqual, __vFOrdNotEqual, s::cl_short,
299 
300 // (LessOrGreater) // islessgreater
301 __SYCL_EXPORT s::cl_int sycl_host_LessOrGreater(s::cl_float x,
302  s::cl_float y) __NOEXC {
303  return __sLessOrGreater(x, y);
304 }
305 __SYCL_EXPORT s::cl_int sycl_host_LessOrGreater(s::cl_double x,
306  s::cl_double y) __NOEXC {
307  return __sLessOrGreater(x, y);
308 }
309 __SYCL_EXPORT s::cl_int sycl_host_LessOrGreater(s::cl_half x,
310  s::cl_half y) __NOEXC {
311  return __sLessOrGreater(x, y);
312 }
313 MAKE_1V_2V_FUNC(sycl_host_LessOrGreater, __vLessOrGreater, s::cl_int,
315 MAKE_1V_2V_FUNC(sycl_host_LessOrGreater, __vLessOrGreater, s::cl_long,
317 MAKE_1V_2V_FUNC(sycl_host_LessOrGreater, __vLessOrGreater, s::cl_short,
319 
320 // (IsFinite) // isfinite
321 __SYCL_EXPORT s::cl_int sycl_host_IsFinite(s::cl_float x) __NOEXC {
322  return std::isfinite(x);
323 }
324 __SYCL_EXPORT s::cl_int sycl_host_IsFinite(s::cl_double x) __NOEXC {
325  return std::isfinite(x);
326 }
327 __SYCL_EXPORT s::cl_int __vIsFinite(s::cl_float x) __NOEXC {
328  return -static_cast<s::cl_int>(std::isfinite(x));
329 }
330 __SYCL_EXPORT s::cl_long __vIsFinite(s::cl_double x) __NOEXC {
331  return -static_cast<s::cl_long>(std::isfinite(x));
332 }
333 __SYCL_EXPORT s::cl_int sycl_host_IsFinite(s::cl_half x) __NOEXC {
335 }
336 __SYCL_EXPORT s::cl_short __vIsFinite(s::cl_half x) __NOEXC {
337  return -static_cast<s::cl_int>(std::isfinite(d::cast_if_host_half(x)));
338 }
339 MAKE_1V_FUNC(sycl_host_IsFinite, __vIsFinite, s::cl_int, s::cl_float)
340 MAKE_1V_FUNC(sycl_host_IsFinite, __vIsFinite, s::cl_long, s::cl_double)
341 MAKE_1V_FUNC(sycl_host_IsFinite, __vIsFinite, s::cl_short, s::cl_half)
342 
343 // (IsInf) // isinf
344 __SYCL_EXPORT s::cl_int sycl_host_IsInf(s::cl_float x) __NOEXC {
345  return std::isinf(x);
346 }
347 __SYCL_EXPORT s::cl_int sycl_host_IsInf(s::cl_double x) __NOEXC {
348  return std::isinf(x);
349 }
350 __SYCL_EXPORT s::cl_int __vIsInf(s::cl_float x) __NOEXC {
351  return -static_cast<s::cl_int>(std::isinf(x));
352 }
353 __SYCL_EXPORT s::cl_long __vIsInf(s::cl_double x) __NOEXC {
354  return -static_cast<s::cl_long>(std::isinf(x));
355 }
356 __SYCL_EXPORT s::cl_int sycl_host_IsInf(s::cl_half x) __NOEXC {
357  return std::isinf(d::cast_if_host_half(x));
358 }
359 __SYCL_EXPORT s::cl_short __vIsInf(s::cl_half x) __NOEXC {
360  return -static_cast<s::cl_short>(std::isinf(d::cast_if_host_half(x)));
361 }
362 MAKE_1V_FUNC(sycl_host_IsInf, __vIsInf, s::cl_int, s::cl_float)
363 MAKE_1V_FUNC(sycl_host_IsInf, __vIsInf, s::cl_long, s::cl_double)
364 MAKE_1V_FUNC(sycl_host_IsInf, __vIsInf, s::cl_short, s::cl_half)
365 
366 // (IsNan) // isnan
367 __SYCL_EXPORT s::cl_int sycl_host_IsNan(s::cl_float x) __NOEXC {
368  return std::isnan(x);
369 }
370 __SYCL_EXPORT s::cl_int sycl_host_IsNan(s::cl_double x) __NOEXC {
371  return std::isnan(x);
372 }
373 __SYCL_EXPORT s::cl_int __vIsNan(s::cl_float x) __NOEXC {
374  return -static_cast<s::cl_int>(std::isnan(x));
375 }
376 __SYCL_EXPORT s::cl_long __vIsNan(s::cl_double x) __NOEXC {
377  return -static_cast<s::cl_long>(std::isnan(x));
378 }
379 
380 __SYCL_EXPORT s::cl_int sycl_host_IsNan(s::cl_half x) __NOEXC {
381  return std::isnan(d::cast_if_host_half(x));
382 }
383 __SYCL_EXPORT s::cl_short __vIsNan(s::cl_half x) __NOEXC {
384  return -static_cast<s::cl_short>(std::isnan(d::cast_if_host_half(x)));
385 }
386 MAKE_1V_FUNC(sycl_host_IsNan, __vIsNan, s::cl_int, s::cl_float)
387 MAKE_1V_FUNC(sycl_host_IsNan, __vIsNan, s::cl_long, s::cl_double)
388 MAKE_1V_FUNC(sycl_host_IsNan, __vIsNan, s::cl_short, s::cl_half)
389 
390 // (IsNormal) // isnormal
391 __SYCL_EXPORT s::cl_int sycl_host_IsNormal(s::cl_float x) __NOEXC {
392  return std::isnormal(x);
393 }
394 __SYCL_EXPORT s::cl_int sycl_host_IsNormal(s::cl_double x) __NOEXC {
395  return std::isnormal(x);
396 }
397 __SYCL_EXPORT s::cl_int __vIsNormal(s::cl_float x) __NOEXC {
398  return -static_cast<s::cl_int>(std::isnormal(x));
399 }
400 __SYCL_EXPORT s::cl_long __vIsNormal(s::cl_double x) __NOEXC {
401  return -static_cast<s::cl_long>(std::isnormal(x));
402 }
403 __SYCL_EXPORT s::cl_int sycl_host_IsNormal(s::cl_half x) __NOEXC {
405 }
406 __SYCL_EXPORT s::cl_short __vIsNormal(s::cl_half x) __NOEXC {
407  return -static_cast<s::cl_short>(std::isnormal(d::cast_if_host_half(x)));
408 }
409 MAKE_1V_FUNC(sycl_host_IsNormal, __vIsNormal, s::cl_int, s::cl_float)
410 MAKE_1V_FUNC(sycl_host_IsNormal, __vIsNormal, s::cl_long, s::cl_double)
411 MAKE_1V_FUNC(sycl_host_IsNormal, __vIsNormal, s::cl_short, s::cl_half)
412 
413 // (Ordered) // isordered
414 __SYCL_EXPORT s::cl_int sycl_host_Ordered(s::cl_float x,
415  s::cl_float y) __NOEXC {
416  return __sOrdered(x, y);
417 }
418 __SYCL_EXPORT s::cl_int sycl_host_Ordered(s::cl_double x,
419  s::cl_double y) __NOEXC {
420  return __sOrdered(x, y);
421 }
422 __SYCL_EXPORT s::cl_int sycl_host_Ordered(s::cl_half x, s::cl_half y) __NOEXC {
423  return __sOrdered(x, y);
424 }
425 MAKE_1V_2V_FUNC(sycl_host_Ordered, __vOrdered, s::cl_int, s::cl_float,
426  s::cl_float)
427 MAKE_1V_2V_FUNC(sycl_host_Ordered, __vOrdered, s::cl_long, s::cl_double,
428  s::cl_double)
429 MAKE_1V_2V_FUNC(sycl_host_Ordered, __vOrdered, s::cl_short, s::cl_half,
430  s::cl_half)
431 
432 // (Unordered) // isunordered
433 __SYCL_EXPORT s::cl_int sycl_host_Unordered(s::cl_float x,
434  s::cl_float y) __NOEXC {
435  return __sUnordered(x, y);
436 }
437 __SYCL_EXPORT s::cl_int sycl_host_Unordered(s::cl_double x,
438  s::cl_double y) __NOEXC {
439  return __sUnordered(x, y);
440 }
441 __SYCL_EXPORT s::cl_int sycl_host_Unordered(s::cl_half x,
442  s::cl_half y) __NOEXC {
443  return __sUnordered(x, y);
444 }
445 MAKE_1V_2V_FUNC(sycl_host_Unordered, __vUnordered, s::cl_int, s::cl_float,
446  s::cl_float)
447 MAKE_1V_2V_FUNC(sycl_host_Unordered, __vUnordered, s::cl_long, s::cl_double,
448  s::cl_double)
449 MAKE_1V_2V_FUNC(sycl_host_Unordered, __vUnordered, s::cl_short, s::cl_half,
450  s::cl_half)
451 
452 // (SignBitSet) // signbit
453 __SYCL_EXPORT s::cl_int sycl_host_SignBitSet(s::cl_float x) __NOEXC {
454  return std::signbit(x);
455 }
456 __SYCL_EXPORT s::cl_int sycl_host_SignBitSet(s::cl_double x) __NOEXC {
457  return std::signbit(x);
458 }
459 __SYCL_EXPORT s::cl_int __vSignBitSet(s::cl_float x) __NOEXC {
460  return -static_cast<s::cl_int>(std::signbit(x));
461 }
462 __SYCL_EXPORT s::cl_long __vSignBitSet(s::cl_double x) __NOEXC {
463  return -static_cast<s::cl_long>(std::signbit(x));
464 }
465 __SYCL_EXPORT s::cl_int sycl_host_SignBitSet(s::cl_half x) __NOEXC {
467 }
468 __SYCL_EXPORT s::cl_short __vSignBitSet(s::cl_half x) __NOEXC {
469  return -static_cast<s::cl_short>(std::signbit(d::cast_if_host_half(x)));
470 }
471 MAKE_1V_FUNC(sycl_host_SignBitSet, __vSignBitSet, s::cl_int, s::cl_float)
472 MAKE_1V_FUNC(sycl_host_SignBitSet, __vSignBitSet, s::cl_long, s::cl_double)
473 MAKE_1V_FUNC(sycl_host_SignBitSet, __vSignBitSet, s::cl_short, s::cl_half)
474 
475 // (Any) // any
476 MAKE_SR_1V_OR(sycl_host_Any, __Any, s::cl_int, s::cl_char)
477 MAKE_SR_1V_OR(sycl_host_Any, __Any, s::cl_int, s::cl_short)
478 MAKE_SR_1V_OR(sycl_host_Any, __Any, s::cl_int, s::cl_int)
479 MAKE_SR_1V_OR(sycl_host_Any, __Any, s::cl_int, s::cl_long)
480 
481 // (All) // all
486 
487 // (bitselect)
488 // Instantiate functions for the scalar types and vector types.
489 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_float, s::cl_float, s::cl_float,
490  s::cl_float)
492  s::cl_double)
493 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_char, s::cl_char, s::cl_char,
494  s::cl_char)
495 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_uchar, s::cl_uchar, s::cl_uchar,
496  s::cl_uchar)
497 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_short, s::cl_short, s::cl_short,
498  s::cl_short)
500  s::cl_ushort)
501 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_int, s::cl_int, s::cl_int,
502  s::cl_int)
503 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_uint, s::cl_uint, s::cl_uint,
504  s::cl_uint)
505 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_long, s::cl_long, s::cl_long,
506  s::cl_long)
507 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_ulong, s::cl_ulong, s::cl_ulong,
508  s::cl_ulong)
509 MAKE_SC_1V_2V_3V(sycl_host_bitselect, s::cl_half, s::cl_half, s::cl_half,
510  s::cl_half)
511 
512 // (Select) // select
513 // for scalar: result = c ? b : a.
514 // for vector: result[i] = (MSB of c[i] is set)? b[i] : a[i]
515 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_float, s::cl_float,
517 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_float, s::cl_float,
519 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_double, s::cl_double,
521 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_double, s::cl_double,
523 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_char, s::cl_char,
525 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_char, s::cl_char,
527 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_uchar, s::cl_uchar,
529 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_uchar, s::cl_uchar,
531 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_short, s::cl_short,
533 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_short, s::cl_short,
535 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_ushort, s::cl_ushort,
537 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_ushort, s::cl_ushort,
539 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_int, s::cl_int,
541 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_int, s::cl_int,
543 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_uint, s::cl_uint,
545 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_uint, s::cl_uint,
547 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_long, s::cl_long,
549 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_long, s::cl_long,
551 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_ulong, s::cl_ulong,
553 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_ulong, s::cl_ulong,
555 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_half, s::cl_half,
557 MAKE_SC_FSC_1V_2V_3V_FV(sycl_host_select, __vselect, s::cl_half, s::cl_half,
559 } // namespace __host_std
#define __NOEXC
Definition: builtins.hpp:18
#define MAKE_SC_1V_2V_3V(Fun, Ret, Arg1, Arg2, Arg3)
#define MAKE_SC_FSC_1V_2V_3V_FV(FunSc, FunV, Ret, Arg1, Arg2, Arg3)
#define MAKE_SR_1V_AND(Fun, Call, Ret, Arg1)
#define MAKE_1V_FUNC(Fun, Call, Ret, Arg1)
#define MAKE_SR_1V_OR(Fun, Call, Ret, Arg1)
MAKE_1V_2V_FUNC(sycl_host_FOrdEqual, __vFOrdEqual, s::cl_int, s::cl_float, s::cl_float) MAKE_1V_2V_FUNC(sycl_host_FOrdEqual
s::cl_int sycl_host_All(s::vec< int, 1 >)
s::cl_int sycl_host_FOrdEqual(s::cl_float x, s::cl_float y) __NOEXC
T cast_if_host_half(T val)
Definition: half_type.hpp:567
constexpr bool msbIsSet(const T x)
std::int8_t cl_char
Definition: aliases.hpp:79
detail::common_rel_ret_t< T > isunordered(T x, T y) __NOEXC
Definition: builtins.hpp:1204
half cl_half
Definition: aliases.hpp:87
detail::common_rel_ret_t< T > isnormal(T x) __NOEXC
Definition: builtins.hpp:1190
std::int16_t cl_short
Definition: aliases.hpp:81
std::uint8_t cl_uchar
Definition: aliases.hpp:80
detail::common_rel_ret_t< T > isinf(T x) __NOEXC
Definition: builtins.hpp:1176
std::int64_t cl_long
Definition: aliases.hpp:85
std::uint16_t cl_ushort
Definition: aliases.hpp:82
double cl_double
Definition: aliases.hpp:89
std::int32_t cl_int
Definition: aliases.hpp:83
std::uint32_t cl_uint
Definition: aliases.hpp:84
detail::common_rel_ret_t< T > isnan(T x) __NOEXC
Definition: builtins.hpp:1183
float cl_float
Definition: aliases.hpp:88
detail::common_rel_ret_t< T > isfinite(T x) __NOEXC
Definition: builtins.hpp:1169
detail::common_rel_ret_t< T > signbit(T x) __NOEXC
Definition: builtins.hpp:1211
std::uint64_t cl_ulong
Definition: aliases.hpp:86
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14