summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2015-01-15 19:39:35 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-01-16 10:31:29 +0800
commit786da411150e51d0592a0ec3a81668d923dc7023 (patch)
tree75bc09ae237cbf5ca7383e9c8090df6979cc18b0 /backend
parent22fae30f1f4cdc8d7bfa5f51d7c7ee370cb9c82e (diff)
fix the wrong implementation of popcount.
add disassembly for cbit. Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'backend')
-rw-r--r--backend/src/backend/gen/gen_mesa_disasm.c1
-rw-r--r--backend/src/libocl/tmpl/ocl_integer.tmpl.cl10
2 files changed, 4 insertions, 7 deletions
diff --git a/backend/src/backend/gen/gen_mesa_disasm.c b/backend/src/backend/gen/gen_mesa_disasm.c
index 162d459f..4822de38 100644
--- a/backend/src/backend/gen/gen_mesa_disasm.c
+++ b/backend/src/backend/gen/gen_mesa_disasm.c
@@ -67,6 +67,7 @@ static const struct {
[GEN_OPCODE_LZD] = { .name = "lzd", .nsrc = 1, .ndst = 1 },
[GEN_OPCODE_FBH] = { .name = "fbh", .nsrc = 1, .ndst = 1 },
[GEN_OPCODE_FBL] = { .name = "fbl", .nsrc = 1, .ndst = 1 },
+ [GEN_OPCODE_CBIT] = { .name = "cbit", .nsrc = 1, .ndst = 1 },
[GEN_OPCODE_F16TO32] = { .name = "f16to32", .nsrc = 1, .ndst = 1 },
[GEN_OPCODE_F32TO16] = { .name = "f32to16", .nsrc = 1, .ndst = 1 },
diff --git a/backend/src/libocl/tmpl/ocl_integer.tmpl.cl b/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
index 992727f6..28b9c208 100644
--- a/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
@@ -87,15 +87,11 @@ OVERLOADABLE ulong clz(ulong x) {
return v;
}
-OVERLOADABLE char popcount(char x) {
- return x == 0 ? 0 : x < 0?__gen_ocl_cbit(x) - 24 : __gen_ocl_cbit(x);
-}
-OVERLOADABLE short popcount(short x) {
- return x == 0 ? 0 : x < 0?__gen_ocl_cbit(x) - 16 : __gen_ocl_cbit(x);
-}
#define SDEF(TYPE) \
-OVERLOADABLE TYPE popcount(TYPE x){ return x == 0? 0:__gen_ocl_cbit(x);}
+OVERLOADABLE TYPE popcount(TYPE x){ return __gen_ocl_cbit(x);}
+SDEF(char);
SDEF(uchar);
+SDEF(short);
SDEF(ushort);
SDEF(int);
SDEF(uint);