[Beignet] [PATCH 6/8] Correct the double bug in HSW.
Yang Rong
rong.r.yang at intel.com
Mon May 12 08:12:03 PDT 2014
Should set the nomask in mov_df_imm and need handle exec_width=4 case in setHeader.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/backend/gen75_encoder.cpp | 1 +
backend/src/backend/gen75_encoder.hpp | 5 ++++-
backend/src/backend/gen_encoder.cpp | 3 +++
backend/src/backend/gen_encoder.hpp | 4 ++++
4 files changed, 12 insertions(+), 1 deletion(-)
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 dc2dc76..899f85d 100644
--- a/backend/src/backend/gen75_encoder.hpp
+++ b/backend/src/backend/gen75_encoder.hpp
@@ -31,9 +31,12 @@ namespace gbe
class Gen75Encoder : public GenEncoder
{
public:
+ /*! exec width of the double data type */
+ const int GEN75_DOUBLE_EXEC_WIDTH = 4;
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 a4d353d..7a53b04 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -243,6 +243,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
@@ -627,6 +629,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 5af69cb..e5969a9 100644
--- a/backend/src/backend/gen_encoder.hpp
+++ b/backend/src/backend/gen_encoder.hpp
@@ -69,6 +69,8 @@ namespace gbe
virtual ~GenEncoder();
/*! 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 */
@@ -134,6 +136,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);
--
1.8.3.2
More information about the Beignet
mailing list