From c3646e135e2ca9109cd8a9eaa419854fd3486053 Mon Sep 17 00:00:00 2001 From: Egor Churaev Date: Mon, 29 May 2017 07:44:22 +0000 Subject: [PATCH] [OpenCL] Test on half immediate support. Reviewers: Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D33592 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304134 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenOpenCL/half.cl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/CodeGenOpenCL/half.cl b/test/CodeGenOpenCL/half.cl index 9acabf0a2a..a10ba4d7f9 100644 --- a/test/CodeGenOpenCL/half.cl +++ b/test/CodeGenOpenCL/half.cl @@ -21,3 +21,20 @@ half test_inc(half x) { return ++x; } + +__attribute__((overloadable)) int min(int, int); +__attribute__((overloadable)) half min(half, half); +__attribute__((overloadable)) float min(float, float); + +__kernel void foo( __global half* buf, __global float* buf2 ) +{ + buf[0] = min( buf[0], 1.5h ); +// CHECK: half 0xH3E00 + buf[0] = min( buf2[0], 1.5f ); +// CHECK: float 1.500000e+00 + + const half one = 1.6666; + buf[1] = min( buf[1], one ); +// CHECK: half 0xH3EAB +} + -- 2.40.0