r304134 - [OpenCL] Test on half immediate support.

Egor Churaev via cfe-commits cfe-commits at lists.llvm.org
Mon May 29 00:44:22 PDT 2017


Author: echuraev
Date: Mon May 29 02:44:22 2017
New Revision: 304134

URL: http://llvm.org/viewvc/llvm-project?rev=304134&view=rev
Log:
[OpenCL] Test on half immediate support.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

Differential Revision: https://reviews.llvm.org/D33592

Modified:
    cfe/trunk/test/CodeGenOpenCL/half.cl

Modified: cfe/trunk/test/CodeGenOpenCL/half.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/half.cl?rev=304134&r1=304133&r2=304134&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/half.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/half.cl Mon May 29 02:44:22 2017
@@ -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
+}
+




More information about the cfe-commits mailing list