From: Yang Rong Date: Mon, 19 May 2014 05:52:23 +0000 (+0800) Subject: Correct the double bug in HSW. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=028f42d36df98c0bce662f9eb84e7da8dd488eaf;p=contrib%2Fbeignet.git Correct the double bug in HSW. Should set the nomask in mov_df_imm and need handle exec_width=4 case in setHeader. Signed-off-by: Yang Rong Reviewed-by: Junyan He --- diff --git a/backend/src/backend/gen75_encoder.cpp b/backend/src/backend/gen75_encoder.cpp index 7fc2d1d..9e758d6 100644 --- a/backend/src/backend/gen75_encoder.cpp +++ b/backend/src/backend/gen75_encoder.cpp @@ -183,6 +183,7 @@ namespace gbe GenRegister r = GenRegister::retype(tmp, GEN_TYPE_UD); push(); curr.predicate = GEN_PREDICATE_NONE; + curr.noMask = 1; curr.execWidth = 1; MOV(r, GenRegister::immud(u.u[0])); MOV(GenRegister::suboffset(r, 1), GenRegister::immud(u.u[1])); diff --git a/backend/src/backend/gen75_encoder.hpp b/backend/src/backend/gen75_encoder.hpp index a9042b3..60dea7b 100644 --- a/backend/src/backend/gen75_encoder.hpp +++ b/backend/src/backend/gen75_encoder.hpp @@ -31,11 +31,15 @@ namespace gbe class Gen75Encoder : public GenEncoder { public: + /*! exec width of the double data type */ + const int GEN75_DOUBLE_EXEC_WIDTH = 4; virtual ~Gen75Encoder(void) { } Gen75Encoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID) : GenEncoder(simdWidth, gen, deviceID, 8) { } + /*! Get double/long exec width */ + virtual int getDoubleExecWidth(void) { return GEN75_DOUBLE_EXEC_WIDTH; } virtual void MOV_DF(GenRegister dest, GenRegister src0, GenRegister tmp = GenRegister::null()); virtual void LOAD_DF_IMM(GenRegister dest, GenRegister tmp, double value); virtual void ATOMIC(GenRegister dst, uint32_t function, GenRegister src, uint32_t bti, uint32_t srcNum); diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp index aa30b05..7078dcb 100644 --- a/backend/src/backend/gen_encoder.cpp +++ b/backend/src/backend/gen_encoder.cpp @@ -240,6 +240,8 @@ namespace gbe insn->header.execution_size = GEN_WIDTH_8; else if (this->curr.execWidth == 16) insn->header.execution_size = GEN_WIDTH_16; + else if (this->curr.execWidth == 4) + insn->header.execution_size = GEN_WIDTH_4; else if (this->curr.execWidth == 1) insn->header.execution_size = GEN_WIDTH_1; else @@ -624,6 +626,7 @@ namespace gbe GenRegister src0, GenRegister src1 = GenRegister::null()) { int w = p->curr.execWidth; p->push(); + p->curr.execWidth = p->getDoubleExecWidth(); p->curr.nibControl = 0; GenNativeInstruction *insn = p->next(opcode); p->setHeader(insn); diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp index 9eaa1c2..e0bb4cc 100644 --- a/backend/src/backend/gen_encoder.hpp +++ b/backend/src/backend/gen_encoder.hpp @@ -70,6 +70,8 @@ namespace gbe virtual ~GenEncoder(void) { } /*! Size of the stack (should be large enough) */ enum { MAX_STATE_NUM = 16 }; + /*! gen7 exec width of the double data type */ + const int GEN7_DOUBLE_EXEC_WIDTH = 8; /*! Push the current instruction state */ void push(void); /*! Pop the latest pushed state */ @@ -135,6 +137,8 @@ namespace gbe #undef ALU2 #undef ALU2_MOD #undef ALU3 + /*! Get double/long exec width */ + virtual int getDoubleExecWidth(void) { return GEN7_DOUBLE_EXEC_WIDTH; } virtual void MOV_DF(GenRegister dest, GenRegister src0, GenRegister tmp = GenRegister::null()); virtual void LOAD_DF_IMM(GenRegister dest, GenRegister tmp, double value); void LOAD_INT64_IMM(GenRegister dest, int64_t value);