예제 #1
0
파일: sse.py 프로젝트: shreyas42/slingen
class mmStorehPi(MovStatement):
    mrmap = [2,3]
    def __init__(self, src, dst):
        super(mmStorehPi, self).__init__()
        self.dst = VecDest(dst, 4, self.mrmap) if isinstance(dst, Pointer) else VecDest(dst.pointer, 4, self.mrmap) 
        self.srcs += [ src ]
 
    @staticmethod
    def canStore(reglen, mrmap, horizontal=True, isAligned=False):
        if not horizontal: return False
        return reglen == 4 and mrmap == mmStorehPi.mrmap

    @staticmethod
    def getStore(src, dst):
        return mmStorehPi(src, dst)
     
    def replaceRefs(self, refMap):
        dst = self.dst.replaceRefs(refMap)
        src = self.srcs[0].replaceRefs(refMap)
        if isinstance(dst, VecDest):
            self.dst = dst
            self.srcs[0] = src
            return self
        return Mov(src, dst)
      
    def computeSym(self, nameList):
        src = self.srcs[0].computeSym(nameList)
        return [ src[2], src[3] ] 
 
    def unparse(self, indent):
        return indent + "_mm_storeh_pi(" + self.dst.unparse("") + ", " + self.srcs[0].unparse("") + ");"
     
    def printInst(self, indent):
        return indent + "mmStorehPi( " + self.srcs[0].printInst("") + ", " + self.dst.printInst("") + " )"
예제 #2
0
파일: sse.py 프로젝트: shreyas42/slingen
class mmStorePs(MovStatement):
    mrmap = [0,1,2,3] # static definition of the mem-reg mapping imposed by the store
    def __init__(self, src, dst):
        super(mmStorePs, self).__init__()
        # silent introduction of VecDest operator
        self.dst = VecDest(dst, 4, self.mrmap, isAligned=True) if isinstance(dst, Pointer) else VecDest(dst.pointer, 4, self.mrmap, isAligned=True)
        self.srcs += [ src ]
        

    def replaceRefs(self, refMap):
        dst = self.dst.replaceRefs(refMap)
        src = self.srcs[0].replaceRefs(refMap)
        if isinstance(dst, VecDest):
            self.dst = dst
            self.srcs[0] = src
            return self
        return Mov(src, dst)

    @staticmethod
    def canStore(reglen, mrmap, horizontal=True, isAligned=False):
        if not horizontal: return False
        return reglen == 4 and mrmap == mmStoreuPs.mrmap and isAligned

    @staticmethod
    def getStore(src, dst):
        return mmStorePs(src, dst)

    def computeSym(self, nameList):
        return self.srcs[0].computeSym(nameList) 
     
    def unparse(self, indent):
        return indent + "_mm_store_ps(" + self.dst.unparse("") + ", " + self.srcs[0].unparse("") + ");"
    
    def printInst(self, indent):
        return indent + "mmStorePs( " + self.srcs[0].printInst("") + ", " + self.dst.printInst("") + " )"
예제 #3
0
class mmStoreSd(MovStatement):
    mrmap = [0]

    def __init__(self, src, dst):
        super(mmStoreSd, self).__init__()
        #         self.dst = ScaDest(dst) if isinstance(dst, Pointer) else ScaDest(dst.pointer)  # I don't anything else than a pointer can get here
        self.dst = VecDest(dst, 2, self.mrmap) if isinstance(
            dst, Pointer) else VecDest(dst.pointer, 2, self.mrmap)
        self.srcs += [src]
#         self.srcZMask = src.getZMask()
#         self.slen = 2
#         self.dlen = 1

    @staticmethod
    def canStore(reglen, mrmap, horizontal=True, isAligned=False):
        if not horizontal: return False
        return reglen == 2 and mrmap == mmStoreSd.mrmap

    @staticmethod
    def getStore(src, dst):
        return mmStoreSd(src, dst)

    def replaceRefs(self, refMap):
        #         pointer = AddressOf(self.dst.replaceRefs(refMap))
        #         src = self.srcs[0].replaceRefs(refMap)
        #         return mmStoreSd(src, pointer)
        dst = self.dst.replaceRefs(refMap)
        src = self.srcs[0].replaceRefs(refMap)
        if isinstance(dst, VecDest):
            self.dst = dst
            self.srcs[0] = src
            return self
        if self.srcZMask != [0, 1]:
            return Mov(mmMoveSd(mmSetzeroPd(), src), dst)
        return Mov(src, dst)


#     def replaceInLHS(self, old, new):
#         if self.dst == old:
#             return mmStoreSd(self.srcs[0], AddressOf(new))

    def computeSym(self, nameList):
        return [self.srcs[0].computeSym(nameList)[0]]

    def unparse(self, indent):
        return indent + "_mm_store_sd(" + self.dst.unparse(
            "") + ", " + self.srcs[0].unparse("") + ");"

    def printInst(self, indent):
        return indent + "mmStoreSd( " + self.srcs[0].printInst(
            "") + ", " + self.dst.printInst("") + " )"
예제 #4
0
파일: sse.py 프로젝트: shreyas42/slingen
class mmStoreuPs(MovStatement):
    mrmap = [0,1,2,3] # static definition of the mem-reg mapping imposed by the store
    def __init__(self, src, dst):
        super(mmStoreuPs, self).__init__()
        dstpointer = dst if isinstance(dst, Pointer) else dst.pointer
        # silent introduction of VecDest operator
        self.dst = VecDest(dstpointer, 4, self.mrmap)
        self.srcs += [ src ]
        self.pointer = dstpointer

    def replaceRefs(self, refMap):
        dst = self.dst.replaceRefs(refMap)
        src = self.srcs[0].replaceRefs(refMap)
        if isinstance(dst, VecDest):
            self.dst = dst
            self.srcs[0] = src
            return self
        return Mov(src, dst)

    @staticmethod
    def canStore(reglen, mrmap, horizontal=True, isAligned=False):
        if not horizontal: return False
        return reglen == 4 and mrmap == mmStoreuPs.mrmap

    @staticmethod
    def getStore(src, dst):
        return mmStoreuPs(src, dst)

    def computeSym(self, nameList):
        return self.srcs[0].computeSym(nameList) 
     
    def unparse(self, indent):
        return indent + "_mm_storeu_ps(" + self.dst.unparse("") + ", " + self.srcs[0].unparse("") + ");"
    
    def printInst(self, indent):
        return indent + "mmStoreuPs( " + self.srcs[0].printInst("") + ", " + self.dst.printInst("") + " )"
    
    def align(self, analysis):
        for i, source in enumerate(self.srcs):
            self.srcs[i] = source.align(analysis)
        analysis.env = self.env # restore the analysis env that corresponds to this instruction
        if analysis.congruenceAnalysis.lessEqual(analysis.evaluateExpr(sympify(self.dst.pointer.ref.physLayout.name) + getReference(icode, self.dst.pointer.mat).getLinIdx(self.dst.pointer.at))[1], AbstractElement((0, self.dst.reglen))):
            return mmStorePs(self.srcs[0], self.dst.pointer)
        else:
            return self
예제 #5
0
파일: sse.py 프로젝트: shreyas42/slingen
class mmStoreSs(MovStatement):
    mrmap = [0]
    def __init__(self, src, dst):
        super(mmStoreSs, self).__init__()
        self.dst = VecDest(dst, 4, self.mrmap) if isinstance(dst, Pointer) else VecDest(dst.pointer, 4, self.mrmap) # When passing VecAccess in ScaRep
        self.srcs += [ src ]
        self.srcZMask = src.getZMask()

    @staticmethod
    def canStore(reglen, mrmap, horizontal=True, isAligned=False):
        if not horizontal: return False
        return reglen == 4 and mrmap == mmStoreSs.mrmap

    @staticmethod
    def getStore(src, dst):
        return mmStoreSs(src, dst)
     
    def replaceRefs(self, refMap):
        dst = self.dst.replaceRefs(refMap)
        src = self.srcs[0].replaceRefs(refMap)
        if isinstance(dst, VecDest):
            self.dst = dst
            self.srcs[0] = src
            return self
        if self.srcZMask != [0,1,1,1]:
            return Mov(mmMoveSs(mmSetzeroPs(), src), dst)
        return Mov(src, dst)
     
    def computeSym(self, nameList):
        return [ self.srcs[0].computeSym(nameList)[0] ] 

    def unparse(self, indent):
        return indent + "_mm_store_ss(" + self.dst.unparse("") + ", " + self.srcs[0].unparse("") + ");"
    
    def printInst(self, indent):
        return indent + "mmStoreSs( " + self.srcs[0].printInst("") + ", " + self.dst.printInst("") + " )"