Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 477e282

Browse files
authored
[SYCL] Add tests for select with bool argument (#986)
Signed-off-by: John Pennycook <[email protected]>
1 parent 1d6d005 commit 477e282

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

SYCL/DeviceLib/built-ins/scalar_relational.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,5 +379,37 @@ int main() {
379379
assert(r <= 123.124 && r >= 123.122); // r = 123.123
380380
}
381381

382+
// select-float,bool
383+
{
384+
s::cl_float r{0};
385+
{
386+
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
387+
s::queue myQueue;
388+
myQueue.submit([&](s::handler &cgh) {
389+
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
390+
cgh.single_task<class selectF1F1B1true>([=]() {
391+
AccR[0] = s::select(s::cl_float{34.34}, s::cl_float{123.123}, true);
392+
});
393+
});
394+
}
395+
assert(r <= 123.124 && r >= 123.122); // r = 123.123
396+
}
397+
398+
// select-float,bool
399+
{
400+
s::cl_float r{0};
401+
{
402+
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
403+
s::queue myQueue;
404+
myQueue.submit([&](s::handler &cgh) {
405+
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
406+
cgh.single_task<class selectF1F1B1false>([=]() {
407+
AccR[0] = s::select(s::cl_float{34.34}, s::cl_float{123.123}, false);
408+
});
409+
});
410+
}
411+
assert(r <= 34.35 && r >= 34.33); // r = 34.34
412+
}
413+
382414
return 0;
383415
}

0 commit comments

Comments
 (0)