summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2014-12-03 16:51:53 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-12-04 14:56:26 +0800
commitd32db40dcb231c65ac400c8ab7a719176c0c1595 (patch)
tree4576cb01ff80040c2a7e5d40f3f1f1b84b9d6e9b
parentc9d3e67158a6635cc757c875f8c793ed52ade1c4 (diff)
refine bswap utest to cover nsetc fail cases.
two bswap call in one block would trigger nsetc failures. the fail was fixed in backend already, just update the utest. Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--kernels/compiler_bswap.cl1
-rw-r--r--utests/compiler_bswap.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/kernels/compiler_bswap.cl b/kernels/compiler_bswap.cl
index 9ef0e6b7..97313b1a 100644
--- a/kernels/compiler_bswap.cl
+++ b/kernels/compiler_bswap.cl
@@ -1,6 +1,7 @@
#define TEST_TYPE(TYPE, LENGTH) \
kernel void compiler_bswap_##TYPE(global TYPE * src, global TYPE * dst){ \
dst[get_global_id(0)]= __builtin_bswap##LENGTH(src[get_global_id(0)]); \
+ dst[get_global_id(0)]= __builtin_bswap##LENGTH(dst[get_global_id(0)] -1 ); \
}
diff --git a/utests/compiler_bswap.cpp b/utests/compiler_bswap.cpp
index b5986b90..9475b991 100644
--- a/utests/compiler_bswap.cpp
+++ b/utests/compiler_bswap.cpp
@@ -85,6 +85,13 @@ void test(const char *kernel_name)
for (int32_t i = 0; i < (int32_t) n; ++i)
cpu(i, cpu_src, cpu_dst);
+ for (int32_t i = 0; i < (int32_t) n; ++i)
+ cpu_dst[i] = cpu_dst[i] -1;
+
+ // Run on CPU
+ for (int32_t i = 0; i < (int32_t) n; ++i)
+ cpu(i, cpu_dst, cpu_dst);
+
OCL_MAP_BUFFER(1);
// dump_data(cpu_src, cpu_dst, n);