Changeset 2795 for proto/Compiler


Ignore:
Timestamp:
Dec 20, 2012, 6:15:47 PM (6 years ago)
Author:
cameron
Message:

Move simd_const_1 to library, refine HMPS CCGO2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/CCGO_HMCPS.py

    r2791 r2795  
    472472
    473473#
    474 #  A version of HMCPS_CCGO eliminating ubitblocks
     474#  A version of HMCPS_CCGO eliminating use of "convert"
    475475#
    476476class HMCPS_CCGO2(HMCPS_CCGO):
     477
     478
     479    def GenerateCarryInAccess(self, operation_no):
     480        block_no = self.carryInfoSet.containing_block[operation_no]
     481        posn = self.alloc_map[operation_no] - self.carry_offset
     482        ub = posn/self.field_count
     483        rp = posn%self.field_count
     484        #return make_call("convert", [self.carry_pack_index(self.fw, ub, rp)])
     485        if rp == 0: e = self.carry_pack_full(ub)
     486        else: e = make_call("mvmd<%i>::srli<%i>" %(self.fw, rp), [self.carry_pack_full(ub)])
     487        if rp == self.field_count - 1:
     488          return e
     489        else: return make_call('simd_and', [e, mk_var("simd_const_1")])
     490
     491#
     492#  Eliminating ubitblock
     493#
     494class HMCPS_CCGO3(HMCPS_CCGO2):
    477495
    478496    def carry_pack_full(self, ub, v = None, mode = ast.Load()):
     
    484502
    485503    def GenerateCarryDecls(self):
    486         return "  BitBlock simd_const_1;\n    BitBlock %s [%i];\n" % (self.carryGroupVar, self.totalblock_count)
     504        return "  BitBlock %s [%i];\n" % (self.carryGroupVar, self.totalblock_count)
    487505
    488506    def GenerateInitializations(self):
    489507        v = self.carryGroupVar       
    490         inits = "simd_const_1 = mvmd<16>::srli<7>(simd<16>::constant<1>());\n"
     508        inits = ""
    491509        for i in range(0, self.totalblock_count):
    492510          inits += "%s[%i] = simd<%i>::constant<0>();\n" % (v, i, self.fw)
     
    532550        return decls + [make_callStmt('BitBlock_declare', [mk_var(t)]) for t in temps]
    533551   
    534 # Copyright 2012, Robert D. Cameron
     552class HMCPS_CCGO3(HMCPS_CCGO):
     553
     554
     555    def GenerateCarryInAccess(self, operation_no):
     556        block_no = self.carryInfoSet.containing_block[operation_no]
     557        posn = self.alloc_map[operation_no] - self.carry_offset
     558        ub = posn/self.field_count
     559        rp = posn%self.field_count
     560        #return make_call("convert", [self.carry_pack_index(self.fw, ub, rp)])
     561        if rp == 0: e = self.carry_pack_full(ub)
     562        else: e = make_call("mvmd<%i>::srli<%i>" %(self.fw, rp), [self.carry_pack_full(ub)])
     563        if rp == self.field_count - 1:
     564          return e
     565        else: return make_call('simd_and', [e, mk_var("simd_const_1")])
     566
     567
Note: See TracChangeset for help on using the changeset viewer.