One minor comment, too many duplicate checking of GEN_HORIZONTAL_STRIDE_0. Just check it at one place, then all the consequent checkings will not need to consider the uniform case. That will be clearer.
On Wed, Dec 24, 2014 at 12:13:39AM +0800, [email protected] wrote: > From: Junyan He <[email protected]> > > For the instruction like: > MOV(16) rxx<4,4:1>:UQ ryy<4,4:1>:UQ > the src or dst will stride 4 lines, which is illegal. > The src and dst can not cross more than 2 adjacent lines. > We need to split this kind of instruction into two > 8 instructions here. > > Signed-off-by: Junyan He <[email protected]> > --- > backend/src/backend/gen_encoder.cpp | 57 > ++++++++++++++++++++++++++++++----- > 1 file changed, 50 insertions(+), 7 deletions(-) > > diff --git a/backend/src/backend/gen_encoder.cpp > b/backend/src/backend/gen_encoder.cpp > index b4bcc49..6737954 100644 > --- a/backend/src/backend/gen_encoder.cpp > +++ b/backend/src/backend/gen_encoder.cpp > @@ -67,11 +67,39 @@ namespace gbe > return false; > } > > + INLINE bool isVectorOfLongs(GenRegister reg) { > + if (reg.hstride != GEN_HORIZONTAL_STRIDE_0 && > + (reg.type == GEN_TYPE_UL || reg.type == GEN_TYPE_L)) > + return true; > + else > + return false; > + } > + > + INLINE bool isCrossMoreThan2(GenRegister reg) { > + if (reg.hstride == GEN_HORIZONTAL_STRIDE_0) > + return false; > + > + const uint32_t typeSz = typeSize(reg.type); > + const uint32_t horizontal = stride(reg.hstride); > + if (horizontal * typeSz * 16 > GEN_REG_SIZE * 2) { > + return true; > + } > + return false; > + } > + > INLINE bool needToSplitAlu1(GenEncoder *p, GenRegister dst, GenRegister > src) { > - if (p->curr.execWidth != 16 || src.hstride == GEN_HORIZONTAL_STRIDE_0) > return false; > + if (p->curr.execWidth != 16) return false; > + if (isVectorOfLongs(dst) == true) return true; > + if (isCrossMoreThan2(dst) == true) return true; > + > + if (src.hstride == GEN_HORIZONTAL_STRIDE_0) return false; > + > + if (isCrossMoreThan2(src) == true) return true; > + if (isVectorOfLongs(src) == true) return true; > + > if (isVectorOfBytes(dst) == true && > ((isVectorOfBytes(src) == true && src.hstride == dst.hstride) > - || src.hstride == GEN_HORIZONTAL_STRIDE_0)) > + || src.hstride == GEN_HORIZONTAL_STRIDE_0)) > return false; > if (isVectorOfBytes(dst) == true) return true; > if (isVectorOfBytes(src) == true) return true; > @@ -79,15 +107,24 @@ namespace gbe > } > > INLINE bool needToSplitAlu2(GenEncoder *p, GenRegister dst, GenRegister > src0, GenRegister src1) { > - if (p->curr.execWidth != 16 || > - (src0.hstride == GEN_HORIZONTAL_STRIDE_0 && > - src1.hstride == GEN_HORIZONTAL_STRIDE_0)) > + if (p->curr.execWidth != 16) return false; > + if (isVectorOfLongs(dst) == true) return true; > + if (isCrossMoreThan2(dst) == true) return true; > + > + if (src0.hstride == GEN_HORIZONTAL_STRIDE_0 && > + src1.hstride == GEN_HORIZONTAL_STRIDE_0) > return false; > + > + if (isVectorOfLongs(src0) == true) return true; > + if (isVectorOfLongs(src1) == true) return true; > + if (isCrossMoreThan2(src0) == true) return true; > + if (isCrossMoreThan2(src1) == true) return true; > + > if (isVectorOfBytes(dst) == true && > ((isVectorOfBytes(src0) == true && src0.hstride == dst.hstride) || > - src0.hstride == GEN_HORIZONTAL_STRIDE_0) && > + src0.hstride == GEN_HORIZONTAL_STRIDE_0) && > ((isVectorOfBytes(src1) == true && src1.hstride == dst.hstride) || > - src1.hstride == GEN_HORIZONTAL_STRIDE_0)) > + src1.hstride == GEN_HORIZONTAL_STRIDE_0)) > return false; > if (isVectorOfBytes(dst) == true ) return true; > if (isVectorOfBytes(src0) == true) return true; > @@ -102,6 +139,12 @@ namespace gbe > return false; > if (isVectorOfBytes(src0) == true) return true; > if (isVectorOfBytes(src1) == true) return true; > + > + if (isVectorOfLongs(src0) == true) return true; > + if (isVectorOfLongs(src1) == true) return true; > + if (isCrossMoreThan2(src0) == true) return true; > + if (isCrossMoreThan2(src1) == true) return true; > + > if (src0.type == GEN_TYPE_D || src0.type == GEN_TYPE_UD || src0.type == > GEN_TYPE_F) > return true; > if (src1.type == GEN_TYPE_D || src1.type == GEN_TYPE_UD || src1.type == > GEN_TYPE_F) > -- > 1.7.9.5 > > > > _______________________________________________ > Beignet mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
