From: Yang Rong Date: Tue, 28 Jan 2014 03:03:15 +0000 (+0800) Subject: Multiple register's hstride in suboffset. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b807cec1c553464b9ff15a3e6a1907dc08cddc27;p=contrib%2Fbeignet.git Multiple register's hstride in suboffset. When register's hstride is not 0 or 1, suboffset will get wrong element. Also change some offsets that already multiple hstride by hard code. Signed-off-by: Yang Rong Reviewed-by: Zhigang Gong --- diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp index 893de34..9cbe60b 100644 --- a/backend/src/backend/gen_context.cpp +++ b/backend/src/backend/gen_context.cpp @@ -208,7 +208,7 @@ namespace gbe p->curr.chooseNib(i); p->MOV(xdst, xsrc); xdst = GenRegister::suboffset(xdst, 4); - xsrc = GenRegister::suboffset(xsrc, 8); + xsrc = GenRegister::suboffset(xsrc, 4); } p->pop(); break; @@ -1207,10 +1207,10 @@ namespace gbe p->curr.predicate = GEN_PREDICATE_NONE; p->curr.execWidth = 8; p->MOV(dest, src); - p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 4)); if (execWidth == 16) { - p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 16)); - p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 24)); + p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 12)); } p->pop(); } @@ -1222,13 +1222,13 @@ namespace gbe p->curr.execWidth = 8; p->MOV(dest, src); p->curr.nibControl = 1; - p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 4)); + p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 4)); if (execWidth == 16) { p->curr.quarterControl = 1; p->curr.nibControl = 0; - p->MOV(GenRegister::suboffset(dest, 16), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 8)); p->curr.nibControl = 1; - p->MOV(GenRegister::suboffset(dest, 24), GenRegister::suboffset(src, 12)); + p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 12)); } p->pop(); } @@ -1240,10 +1240,10 @@ namespace gbe p->curr.predicate = GEN_PREDICATE_NONE; p->curr.execWidth = 8; p->MOV(dest, src); - p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 4)); if (execWidth == 16) { - p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 16)); - p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 24)); + p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 12)); } p->pop(); } @@ -1255,13 +1255,13 @@ namespace gbe p->curr.execWidth = 8; p->MOV(dest, src); p->curr.nibControl = 1; - p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 4)); + p->MOV(GenRegister::suboffset(dest, 4), GenRegister::suboffset(src, 4)); if (execWidth == 16) { p->curr.quarterControl = 1; p->curr.nibControl = 0; - p->MOV(GenRegister::suboffset(dest, 16), GenRegister::suboffset(src, 8)); + p->MOV(GenRegister::suboffset(dest, 8), GenRegister::suboffset(src, 8)); p->curr.nibControl = 1; - p->MOV(GenRegister::suboffset(dest, 24), GenRegister::suboffset(src, 12)); + p->MOV(GenRegister::suboffset(dest, 12), GenRegister::suboffset(src, 12)); } p->pop(); } diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp index c372e36..61393a3 100644 --- a/backend/src/backend/gen_encoder.cpp +++ b/backend/src/backend/gen_encoder.cpp @@ -908,7 +908,7 @@ namespace gbe curr.execWidth = 8; curr.predicate = GEN_PREDICATE_NONE; MOV(r0, src0); - MOV(GenRegister::suboffset(r0, 8), GenRegister::suboffset(src0, 4)); + MOV(GenRegister::suboffset(r0, 4), GenRegister::suboffset(src0, 4)); curr.predicate = GEN_PREDICATE_NORMAL; curr.quarterControl = 0; curr.nibControl = 0; @@ -921,7 +921,7 @@ namespace gbe curr.execWidth = 8; curr.predicate = GEN_PREDICATE_NONE; MOV(r0, GenRegister::suboffset(src0, 8)); - MOV(GenRegister::suboffset(r0, 8), GenRegister::suboffset(src0, 12)); + MOV(GenRegister::suboffset(r0, 4), GenRegister::suboffset(src0, 12)); curr.predicate = GEN_PREDICATE_NORMAL; curr.quarterControl = 1; curr.nibControl = 0; diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp index 57c78d9..8794318 100644 --- a/backend/src/backend/gen_register.hpp +++ b/backend/src/backend/gen_register.hpp @@ -763,7 +763,7 @@ namespace gbe static INLINE GenRegister suboffset(GenRegister reg, uint32_t delta) { if (reg.hstride != GEN_HORIZONTAL_STRIDE_0) { - reg.subnr += delta * typeSize(reg.type); + reg.subnr += delta * typeSize(reg.type) * hstride_size(reg); reg.nr += reg.subnr / 32; reg.subnr %= 32; }