For scalar register, should use stride 0.
also change the unit test to hit the point.
v2: fix h2()
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
INLINE GenRegister bottom_half(void) const {
GBE_ASSERT(isint64());
- GenRegister r = *this;
+ GenRegister r = h2(*this);
r.type = type == GEN_TYPE_UL ? GEN_TYPE_UD : GEN_TYPE_D;
- r.hstride = GEN_HORIZONTAL_STRIDE_2;
r.vstride = GEN_VERTICAL_STRIDE_16;
return r;
}
static INLINE GenRegister h2(GenRegister reg) {
GenRegister r = reg;
- r.hstride = GEN_HORIZONTAL_STRIDE_2;
+ if(r.hstride != GEN_HORIZONTAL_STRIDE_0)
+ r.hstride = GEN_HORIZONTAL_STRIDE_2;
return r;
}
-kernel void compiler_long(global long *src1, global long *src2, global long *dst) {
+kernel void compiler_long(global long *src1, global long *src2, global long *dst, long zero) {
int i = get_global_id(0);
+
if(i < 5)
- dst[i] = src1[i] + src2[i];
+ dst[i] = src1[i] + src2[i] + src2[i]*zero;
if(i > 5)
- dst[i] = src1[i] - src2[i];
+ dst[i] = src1[i] - src2[i] - zero;
}
const size_t n = 16;
int64_t src1[n], src2[n];
+ int64_t zero = 0;
// Setup kernel and buffers
OCL_CREATE_KERNEL("compiler_long");
OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int64_t), 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(cl_long), &zero);
globals[0] = n;
locals[0] = 16;