utests: add utest to convert double to int64

Submitted by rander on March 14, 2017, 9:46 a.m.

Details

Message ID 1489484764-17282-1-git-send-email-rander.wang@intel.com
State New
Headers show
Series "utests: add utest to convert double to int64" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

rander March 14, 2017, 9:46 a.m.
Signed-off-by: rander <rander.wang@intel.com>
---
 kernels/builtin_convert_double2int64.cl |  73 ++++++++
 utests/CMakeLists.txt                   |   3 +-
 utests/builtin_convert_double2int64.cpp | 319 ++++++++++++++++++++++++++++++++
 3 files changed, 394 insertions(+), 1 deletion(-)
 create mode 100644 kernels/builtin_convert_double2int64.cl
 create mode 100644 utests/builtin_convert_double2int64.cpp

Patch hide | download patch | download mbox

diff --git a/kernels/builtin_convert_double2int64.cl b/kernels/builtin_convert_double2int64.cl
new file mode 100644
index 0000000..970b06b
--- /dev/null
+++ b/kernels/builtin_convert_double2int64.cl
@@ -0,0 +1,73 @@ 
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+__kernel void builtin_convert_double2int64(__global double *X,
+												__global long *Z,
+												__global ulong *uZ,
+												int max_input)
+{
+	int i = get_global_id(0);
+	int j;
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_sat(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_rtz(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_rtn(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_rte(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_rtp(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_sat_rtz(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_sat_rtn(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_sat_rte(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		Z[i++] = convert_long_sat_rtp(X[j]);
+
+	i = 0;
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_sat(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_rtz(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_rtn(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_rte(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_rtp(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_sat_rtz(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_sat_rtn(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_sat_rte(X[j]);
+
+	for(j = 0; j < max_input; j++)
+		uZ[i++] = convert_ulong_sat_rtp(X[j]);
+
+}
+
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 38741c1..299831a 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -302,7 +302,8 @@  set (utests_sources
   builtin_commonFunc_fp64.cpp
   builtin_convert_double2int8.cpp
   builtin_convert_double2int16.cpp
-  builtin_convert_double2int32.cpp)
+  builtin_convert_double2int32.cpp
+  builtin_convert_double2int64.cpp)
 
 if (LLVM_VERSION_NODOT VERSION_GREATER 34)
   SET(utests_sources
diff --git a/utests/builtin_convert_double2int64.cpp b/utests/builtin_convert_double2int64.cpp
new file mode 100644
index 0000000..ad8faa1
--- /dev/null
+++ b/utests/builtin_convert_double2int64.cpp
@@ -0,0 +1,319 @@ 
+#include "utest_helper.hpp"
+#include <cmath>
+#include <algorithm>
+
+namespace{
+    double doubleX[] = {
+        0x1.0000000001p0,
+        -0x1.0000000001p2,
+        0x1.1ffp8,
+        -0x1.1fffp8,
+        0x1.0p7,
+        -0x1.0p7,
+        0x1.fffp6,
+        -0x1.ffffp6,
+        0x1.ffffp7,
+        0x1.1p-64,
+        -0x1.ffffp7,
+        0x1.00001p8,
+        -0x1.00001p8,
+        0x1.00000001p5,
+        -0x1.00000001p5,
+        0x1.0p-32,
+        -0x1.0p-32,
+        0x1.000000001p16,
+        -0x1.000000001p16,
+        0x1.ffffffffffp15,
+        -0x1.1p-64
+        -0x1.ffffffffffp15,
+        0x1.fffffffffp8,
+        -0x1.fffffffffp8,
+        0x1fffffp128,
+        -0x1ffffffp128,
+        0x1.1000001p12,
+        -0x1.1000001p12,
+        0x1.cp13,
+        -0x1.cp13,
+        0x1.100001p11,
+        -0x1.100001p11,
+        0x1.0p32,
+        -0x1.0p32,
+        0x1.0000001p34,
+        -0x1.0000001p35,
+        0x1.fffffffffp31,
+        -0x1.fffffffp31,
+        0x1.1000001p40,
+        -0x1.1000001p41,
+        0x1.c0000001p50,
+        -0x1.c0000001p51,
+        0x1.fffffffffffffp60,
+        -0x1.fffffffffffffp61,
+        0x1.00000001p22,
+        -0x1.00000001p23,
+        0x1.c00000001p24,
+        -0x1.c00000001p25,
+        0x1.0p63,
+        -0x1.0p63,
+        0x1.0p64,
+        -0x1.0p64,
+        0x1.0000000001p63,
+        -0x1.0000000001p63,
+        0x1.00000000000001p64,
+        -0x1.00000000000001p64,
+        0x1.0p128,
+        -0x1.0p128,
+        0x1.100000000001p48,
+        -0x1.100000000001p47,
+        0x1.c00000000001p40,
+        -0x1.c00000000001p41,
+        0x1.fffffffffffffffffffffffp38,
+        -0x1.fffffffffffffffffffffffp37,
+    };
+
+const char*  testFunc[] =
+{
+    " long convert_long(double x)",
+    " long convert_long_sat(double x)",
+    " long convert_long_rtz(double x)",
+    " long convert_long_rtn(double x)",
+    " long convert_long_rte(double x)",
+    " long convert_long_rtp(double x)",
+    " long convert_long_sat_rtz(double x)",
+    " long convert_long_sat_rtn(double x)",
+    " long convert_long_sat_rte(double x)",
+    " long convert_long_sat_rtp(double x)",
+
+    " ulong convert_ulong(double x)",
+    " ulong convert_ulong_sat(double x)",
+    " ulong convert_ulong_rtz(double x)",
+    " ulong convert_ulong_rtn(double x)",
+    " ulong convert_ulong_rte(double x)",
+    " ulong convert_ulong_rtp(double x)",
+    " ulong convert_ulong_sat_rtz(double x)",
+    " ulong convert_ulong_sat_rtn(double x)",
+    " ulong convert_ulong_sat_rte(double x)",
+    " ulong convert_ulong_sat_rtp(double x)"
+};
+
+unsigned long expectResultlong[] = {
+0x1, 0xfffffffffffffffc, 0x11f, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff81,
+0xff, 0x0, 0xffffffffffffff01, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0xffff, 0xffffffffffff0001, 0x1ff, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffc, 0x11f, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff81,
+0xff, 0x0, 0xffffffffffffff01, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0xffff, 0xffffffffffff0001, 0x1ff, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffc, 0x11f, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff81,
+0xff, 0x0, 0xffffffffffffff01, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0xffff, 0xffffffffffff0001, 0x1ff, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffb, 0x11f, 0xfffffffffffffee0, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff80,
+0xff, 0x0, 0xffffffffffffff00, 0x100, 0xfffffffffffffeff, 0x20, 0xffffffffffffffdf, 0x0,
+0xffffffffffffffff, 0x10000, 0xfffffffffffeffff, 0xffff, 0xffffffffffff0000, 0x1ff, 0xfffffffffffffe00, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffeeff, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff77f, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff7fffff, 0x1c00000, 0xfffffffffc7fffff, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff77ffffffffff, 0x1c000000000, 0xfffffc7fffffffff, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffc, 0x120, 0xfffffffffffffee0, 0x80, 0xffffffffffffff80, 0x80, 0xffffffffffffff80,
+0x100, 0x0, 0xffffffffffffff00, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0x10000, 0xffffffffffff0000, 0x200, 0xfffffffffffffe00, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0x100000000, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x2, 0xfffffffffffffffc, 0x120, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x80, 0xffffffffffffff81,
+0x100, 0x1, 0xffffffffffffff01, 0x101, 0xffffffffffffff00, 0x21, 0xffffffffffffffe0, 0x1,
+0x0, 0x10001, 0xffffffffffff0000, 0x10000, 0xffffffffffff0001, 0x200, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1101, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x881, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0x100000000, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400001, 0xffffffffff800000, 0x1c00001, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000001, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffc, 0x11f, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff81,
+0xff, 0x0, 0xffffffffffffff01, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0xffff, 0xffffffffffff0001, 0x1ff, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffb, 0x11f, 0xfffffffffffffee0, 0x80, 0xffffffffffffff80, 0x7f, 0xffffffffffffff80,
+0xff, 0x0, 0xffffffffffffff00, 0x100, 0xfffffffffffffeff, 0x20, 0xffffffffffffffdf, 0x0,
+0xffffffffffffffff, 0x10000, 0xfffffffffffeffff, 0xffff, 0xffffffffffff0000, 0x1ff, 0xfffffffffffffe00, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffeeff, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff77f, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0xffffffff, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff7fffff, 0x1c00000, 0xfffffffffc7fffff, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff77ffffffffff, 0x1c000000000, 0xfffffc7fffffffff, 0x8000000000, 0xffffffc000000000, 0x0,
+0x1, 0xfffffffffffffffc, 0x120, 0xfffffffffffffee0, 0x80, 0xffffffffffffff80, 0x80, 0xffffffffffffff80,
+0x100, 0x0, 0xffffffffffffff00, 0x100, 0xffffffffffffff00, 0x20, 0xffffffffffffffe0, 0x0,
+0x0, 0x10000, 0xffffffffffff0000, 0x10000, 0xffffffffffff0000, 0x200, 0xfffffffffffffe00, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x880, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0x100000000, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400000, 0xffffffffff800000, 0x1c00000, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000000, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0,
+0x2, 0xfffffffffffffffc, 0x120, 0xfffffffffffffee1, 0x80, 0xffffffffffffff80, 0x80, 0xffffffffffffff81,
+0x100, 0x1, 0xffffffffffffff01, 0x101, 0xffffffffffffff00, 0x21, 0xffffffffffffffe0, 0x1,
+0x0, 0x10001, 0xffffffffffff0000, 0x10000, 0xffffffffffff0001, 0x200, 0xfffffffffffffe01, 0x7fffffffffffffff,
+0x8000000000000000, 0x1101, 0xffffffffffffef00, 0x3800, 0xffffffffffffc800, 0x881, 0xfffffffffffff780, 0x100000000,
+0xffffffff00000000, 0x400000040, 0xfffffff7ffffff80, 0x100000000, 0xffffffff00000008, 0x11000001000, 0xfffffddfffffe000, 0x7000000040000,
+0xfff1fffffff80000, 0x1fffffffffffff00, 0xc000000000000200, 0x400001, 0xffffffffff800000, 0x1c00001, 0xfffffffffc800000, 0x7fffffffffffffff,
+0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff,
+0x8000000000000000, 0x1100000000001, 0xffff780000000000, 0x1c000000001, 0xfffffc8000000000, 0x8000000000, 0xffffffc000000000, 0x0
+};
+
+unsigned long expectResultUlong[] = {
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x120, 0x0, 0x80, 0x0, 0x80, 0x0,
+    0x100, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0x10000, 0x0, 0x200, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0x100000000, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x2, 0x0, 0x120, 0x0, 0x80, 0x0, 0x80, 0x0,
+    0x100, 0x1, 0x0, 0x101, 0x0, 0x21, 0x0, 0x1,
+    0x0, 0x10001, 0x0, 0x10000, 0x0, 0x200, 0x0, 0xffffffffffffffff,
+    0x0, 0x1101, 0x0, 0x3800, 0x0, 0x881, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0x100000000, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400001, 0x0, 0x1c00001, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000001, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x11f, 0x0, 0x80, 0x0, 0x7f, 0x0,
+    0xff, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0xffff, 0x0, 0x1ff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0xffffffff, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x1, 0x0, 0x120, 0x0, 0x80, 0x0, 0x80, 0x0,
+    0x100, 0x0, 0x0, 0x100, 0x0, 0x20, 0x0, 0x0,
+    0x0, 0x10000, 0x0, 0x10000, 0x0, 0x200, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100, 0x0, 0x3800, 0x0, 0x880, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0x100000000, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400000, 0x0, 0x1c00000, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000000, 0x0, 0x8000000000, 0x0, 0x0,
+    0x2, 0x0, 0x120, 0x0, 0x80, 0x0, 0x80, 0x0,
+    0x100, 0x1, 0x0, 0x101, 0x0, 0x21, 0x0, 0x1,
+    0x0, 0x10001, 0x0, 0x10000, 0x0, 0x200, 0x0, 0xffffffffffffffff,
+    0x0, 0x1101, 0x0, 0x3800, 0x0, 0x881, 0x0, 0x100000000,
+    0x0, 0x400000040, 0x0, 0x100000000, 0x0, 0x11000001000, 0x0, 0x7000000040000,
+    0x0, 0x1fffffffffffff00, 0x0, 0x400001, 0x0, 0x1c00001, 0x0, 0x8000000000000000,
+    0x0, 0xffffffffffffffff, 0x0, 0x8000000000800000, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff,
+    0x0, 0x1100000000001, 0x0, 0x1c000000001, 0x0, 0x8000000000, 0x0, 0x0
+};
+
+double *input_data;
+const int count_input = 64;
+const int max_function = 20;
+
+static void builtin_convert_double2int64(void)
+{
+  // Setup kernel and buffers
+  int k, i, index_cur;
+  long gpu_data[max_function * count_input] = {0};
+  float diff;
+  long log[256] = {0};
+
+  OCL_CREATE_KERNEL("builtin_convert_double2int64");
+
+  OCL_CREATE_BUFFER(buf[0], CL_MEM_READ_WRITE, count_input * max_function * sizeof(double), NULL);
+  OCL_CREATE_BUFFER(buf[1], CL_MEM_READ_WRITE, count_input * max_function * sizeof(long), NULL);
+  OCL_CREATE_BUFFER(buf[2], CL_MEM_READ_WRITE, count_input * max_function * sizeof(long), NULL);
+
+  OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+  OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]);
+  OCL_SET_ARG(2, sizeof(cl_mem), &buf[2]);
+  OCL_SET_ARG(3, sizeof(int), &count_input);
+
+  globals[0] = 1;
+  locals[0] = 1;
+
+  input_data = (double *)doubleX;
+  clEnqueueWriteBuffer( queue, buf[0], CL_TRUE, 0, count_input * max_function * sizeof(double), input_data, 0, NULL, NULL);
+
+   // Run the kernel
+  OCL_NDRANGE( 1 );
+
+    clEnqueueReadBuffer( queue, buf[1], CL_TRUE, 0, sizeof(long) * max_function/2 * count_input, gpu_data, 0, NULL, NULL);
+    for (k = 0; (uint)k < count_input*max_function/2; k++)
+    {
+        OCL_ASSERT(gpu_data[k] == expectResultlong[k]);
+        if(gpu_data[k] != expectResultlong[k])
+        {
+            printf("failed at function:%s,  expect value: %lx, but get :%lx \n", testFunc[k/count_input], expectResultlong[k], gpu_data[k]);
+        }
+    }
+
+    clEnqueueReadBuffer( queue, buf[2], CL_TRUE, 0, sizeof(long) * max_function/2 * count_input, gpu_data, 0, NULL, NULL);
+    unsigned long *ugpu_data = (unsigned long *)gpu_data;
+      for (k = 0; (uint)k < count_input*max_function/2; k++)
+      {
+            OCL_ASSERT(ugpu_data[k] == expectResultUlong[k]);
+            if(ugpu_data[k] != expectResultUlong[k])
+            {
+                printf("failed at function:%s,  expect value: %lx, but get :%lx \n", testFunc[k/count_input], expectResultUlong[k], ugpu_data[k]);
+            }
+      }
+}
+
+MAKE_UTEST_FROM_FUNCTION(builtin_convert_double2int64)
+}