[Beignet] [PATCH] GBE: Fix getTypesize bug with LLVM3.9

Xiuli Pan xiuli.pan at intel.com
Mon Jan 9 07:00:15 UTC 2017


From: Pan Xiuli <xiuli.pan at intel.com>

We will check some type size but some of the type size have change name
in LLVM3.9, change the check to fit the type name now.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 backend/src/llvm/llvm_gen_backend.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 467b1de..064515b 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -281,7 +281,7 @@ namespace gbe
     return CPV;
   }
 
-#define TYPESIZE(TYPE,VECT,SZ) else if(name == std::string(#TYPE).append(#VECT)) return VECT*SZ;
+#define TYPESIZE(TYPE,VECT,SZ) else if( name == std::string(#TYPE).append(" __attribute__((ext_vector_type("#VECT")))") ) return VECT*SZ;
 #define TYPESIZEVEC(TYPE,SZ)\
   else if(name == #TYPE) return SZ;\
   TYPESIZE(TYPE,2,SZ)\
@@ -293,21 +293,22 @@ namespace gbe
   static uint32_t getTypeSize(Module* M, const ir::Unit &unit, std::string& name) {
       if(name == "size_t") return sizeof(size_t);
       TYPESIZEVEC(char,1)
-      TYPESIZEVEC(uchar,1)
+      TYPESIZEVEC(unsigned char,1)
       TYPESIZEVEC(short,2)
-      TYPESIZEVEC(ushort,2)
+      TYPESIZEVEC(unsigned short,2)
       TYPESIZEVEC(half,2)
       TYPESIZEVEC(int,4)
-      TYPESIZEVEC(uint,4)
+      TYPESIZEVEC(unsigned int,4)
       TYPESIZEVEC(float,4)
       TYPESIZEVEC(double,8)
       TYPESIZEVEC(long,8)
-      TYPESIZEVEC(ulong,8)
+      TYPESIZEVEC(unsigned long,8)
       else{
         StructType *StrTy = M->getTypeByName("struct."+name);
         if(StrTy)
           return getTypeByteSize(unit,StrTy);
       }
+      GBE_ASSERTM(false, "Unspported type name");
       return 0;
   }
 #undef TYPESIZEVEC
-- 
2.7.4



More information about the Beignet mailing list