GBE: increase maximum src/dst operands to 32.
authorZhigang Gong <zhigang.gong@intel.com>
Tue, 21 Oct 2014 13:00:23 +0000 (21:00 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Thu, 23 Oct 2014 01:43:55 +0000 (09:43 +0800)
As we may bitcast a <16 * i64> to/from <32 * i32> due to
the legalize pass, we have to increase the maximum operands
number to 32 and fix some assertions accordingly.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Tested-by: "Meng, Mengmeng" <mengmeng.meng@intel.com>
backend/src/backend/gen_insn_selection.cpp
backend/src/ir/instruction.cpp
backend/src/ir/instruction.hpp
backend/src/llvm/llvm_scalarize.cpp

index 410f6b5..1a37ef1 100644 (file)
@@ -245,7 +245,7 @@ namespace gbe
   public:
     INLINE SelectionDAG(const ir::Instruction &insn) :
       insn(insn), mergeable(0), childNum(insn.getSrcNum()), isRoot(0) {
-      GBE_ASSERT(insn.getSrcNum() < 127);
+      GBE_ASSERT(insn.getSrcNum() <= ir::Instruction::MAX_SRC_NUM);
       for (uint32_t childID = 0; childID < childNum; ++childID)
         this->child[childID] = NULL;
       computeBool = false;
index 6c37f29..4e9bf63 100644 (file)
@@ -261,7 +261,7 @@ namespace ir {
         this->src = src;
         this->dstFamily = getFamily(dstType);
         this->srcFamily = getFamily(srcType);
-        GBE_ASSERT(srcNum <= 16 && dstNum <= 16);
+        GBE_ASSERT(srcNum <= Instruction::MAX_SRC_NUM && dstNum <= Instruction::MAX_DST_NUM);
         this->dstNum = dstNum;
         this->srcNum = srcNum;
       }
index 1c31171..fd79a44 100644 (file)
@@ -189,8 +189,8 @@ namespace ir {
       return T::isClassOf(*this);
     }
     /*! max_src for store instruction (vec16 + addr) */
-    static const uint32_t MAX_SRC_NUM = 17;
-    static const uint32_t MAX_DST_NUM = 16;
+    static const uint32_t MAX_SRC_NUM = 32;
+    static const uint32_t MAX_DST_NUM = 32;
   protected:
     BasicBlock *parent;      //!< The basic block containing the instruction
     GBE_CLASS(Instruction);  //!< Use internal allocators
index 3e48fbf..66ccf24 100644 (file)
@@ -106,18 +106,18 @@ namespace gbe {
 
     void setComponent(int c, llvm::Value* val)
     {
-      assert(c >= 0 && c < 16 && "Out of bounds component");
+      assert(c >= 0 && c < 32 && "Out of bounds component");
       vals[c] = val;
     }
     llvm::Value* getComponent(int c)
     {
-      assert(c >= 0 && c < 16 && "Out of bounds component");
+      assert(c >= 0 && c < 32 && "Out of bounds component");
       assert(vals[c] && "Requesting non-existing component");
       return vals[c];
     }
 
     // {Value* x, Value* y, Value* z, Value* w}
-    llvm::Value* vals[16];
+    llvm::Value* vals[32];
   };
 
   class Scalarize : public FunctionPass {
@@ -441,7 +441,7 @@ namespace gbe {
 
   void Scalarize::makeScalarizedCalls(Function* f, ArrayRef<Value*> args, int count, VectorValues& vVals)
   {
-    assert(count > 0 && count <= 16 && "invalid number of vector components");
+    assert(count > 0 && count <= 32 && "invalid number of vector components");
     for (int i = 0; i < count; ++i) {
       Value* res;
       SmallVector<Value*, 8> callArgs(args.begin(), args.end());
@@ -455,7 +455,7 @@ namespace gbe {
   void Scalarize::makePerComponentScalarizedCalls(Instruction* inst, ArrayRef<Value*> args)
   {
     int count = GetComponentCount(inst);
-    assert(count > 0 && count <= 16 && "invalid number of vector components");
+    assert(count > 0 && count <= 32 && "invalid number of vector components");
     assert((inst->getNumOperands() == args.size() || isa<PHINode>(inst))
            && "not enough arguments passed for instruction");