[Beignet] [PATCH 2/2] GBE: optimize CMP instruction encoding.

Song, Ruiling ruiling.song at intel.com
Fri May 23 00:19:29 PDT 2014


-  ir::Register Selection::Opaque::replaceDst(SelectionInstruction *insn, uint32_t regID) {
+  ir::Register Selection::Opaque::replaceDst(SelectionInstruction 
+ *insn, uint32_t regID, ir::Type type, bool needMov) {
+    tmp = this->reg(ir::getFamily(type));
+    gr = this->selReg(tmp, type);

Seems that you set default type as ir::TYPE_FLOAT for the argument ir::Type type in replaceReg()
And you didn't set the type when calling the function, except for the CMP case( you set it to ir::TYPE_FLOAT), then if a register of type like QWORD. Things will become wrong.
My suggestion is that we don't need to pass an argument ir::Type.
We just use the type of the replaced register. We need make sure the register type should be right before calling replaceSrc or replaceDst.

         ir::Register tmp;
-        if (vector->isSrc)
-          tmp = selection.replaceSrc(vector->insn, regID);
-        else
-          tmp = selection.replaceDst(vector->insn, regID);
+        tmp = this->replaceReg(selection, vector->insn, regID, 
+ vector->isSrc);
The ir::Type is not set here.

         const VectorLocation location = std::make_pair(vector, regID);
         this->vectorMap.insert(std::make_pair(tmp, location));
-        intervals.push_back(tmp);
-        intervals[tmp].minID = vector->insn->ID;
-        intervals[tmp].maxID = vector->insn->ID;
       }
     }
   }



More information about the Beignet mailing list