[Beignet] [PATCH v2 2/2] test 64bit-integer selection operator

Homer Hsing homer.xing at intel.com
Wed Aug 7 01:28:34 PDT 2013


Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 kernels/compiler_long_2.cl | 3 +++
 utests/compiler_long_2.cpp | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/kernels/compiler_long_2.cl b/kernels/compiler_long_2.cl
index f559d93..92be93a 100644
--- a/kernels/compiler_long_2.cl
+++ b/kernels/compiler_long_2.cl
@@ -13,5 +13,8 @@ kernel void compiler_long_2(global long *src1, global long *src2, global long *d
     case 3:
       dst[i] = src1[i] ^ src2[i];
       break;
+    case 4:
+      dst[i] = src1[i] ? 0x1122334455667788L : 0x8877665544332211UL;
+      break;
   }
 }
diff --git a/utests/compiler_long_2.cpp b/utests/compiler_long_2.cpp
index 012c2ab..e3c6640 100644
--- a/utests/compiler_long_2.cpp
+++ b/utests/compiler_long_2.cpp
@@ -24,6 +24,7 @@ void compiler_long_2(void)
     src1[i] = ((long)rand() << 32) + rand();
     src2[i] = ((long)rand() << 32) + rand();
   }
+  src1[4] = 1;
   OCL_MAP_BUFFER(0);
   OCL_MAP_BUFFER(1);
   memcpy(buf_data[0], src1, sizeof(src1));
@@ -37,10 +38,13 @@ void compiler_long_2(void)
   // Compare
   OCL_MAP_BUFFER(2);
   int64_t *dest = ((int64_t *)buf_data[2]);
+  //for (int32_t i = 0; i < (int32_t) n; ++i)
+  //  printf("%lx\n", dest[i]);
   OCL_ASSERT(0xFEDCBA9876543210UL == (uint64_t)dest[0]);
   OCL_ASSERT((src1[1] & src2[1]) == dest[1]);
   OCL_ASSERT((src1[2] | src2[2]) == dest[2]);
   OCL_ASSERT((src1[3] ^ src2[3]) == dest[3]);
+  OCL_ASSERT(0x1122334455667788L == dest[4]);
   OCL_UNMAP_BUFFER(2);
 }
 
-- 
1.8.1.2



More information about the Beignet mailing list