示例#1
0
  def init_address(self):
    # Call syn_iters init self.code
    self.obj.init_address(self)

    # Update the address with the offset
    # For variable iterators, this is the value already computed for r_count
    self.obj.code.add(ppc.add(self.r_addr, self.r_addr, self.obj.r_count))

    return
示例#2
0
  def _update_inc_count(self):
    code = self.obj.code    
    r_block_size = code.prgm.acquire_register()
    r_offset = code.prgm.acquire_register()
    
    # Determine the block size for each loop
    util.load_word(code, r_block_size, self.get_count() - self.get_start())
    code.add(ppc.divw(r_block_size, r_block_size, code.r_size))
    
    # Determine the offset for the current block and update the r_count
    # (this is primarily for range, which uses different values in r_count
    #  to initialize ranges that don't start at 0)
    code.add(ppc.mullw(r_offset, code.r_rank, r_block_size))
    code.add(ppc.add(self.obj.r_count, self.obj.r_count, r_offset))
    
    if self.obj.r_stop is not None:
      code.add(ppc.add(self.obj.r_stop, self.obj.r_count, r_block_size))

    code.prgm.release_register(r_offset)
    code.prgm.release_register(r_block_size)
    return
示例#3
0
prgm.add(code)
prgm.print_code()
ret = proc.execute(prgm, mode='int')
print "ret", ret

prgm = env.Program()
code = prgm.get_stream()

# Use a register from the parent code in the subcode directly
r_add = prgm.acquire_register()

# Generate sub-stream
# Multiple eax by 2, add 1
subcode = prgm.get_stream()
subcode.add(ppc.mulli(prgm.gp_return, prgm.gp_return, 2))
subcode.add(ppc.add(prgm.gp_return, prgm.gp_return, r_add))

# Initialize a register, insert code
code.add(ppc.addi(r_add, 0, 1))
code.add(ppc.addi(prgm.gp_return, 0, 5))
code.add(subcode)

# Add 3, insert again
code.add(ppc.addi(r_add, 0, 2))
code.add(ppc.addi(prgm.gp_return, prgm.gp_return, 3))
code.add(subcode)

prgm.add(code)
prgm.print_code()
ret = proc.execute(prgm, mode='int')
print "ret", ret
示例#4
0
prgm.print_code()
ret = proc.execute(prgm, mode = 'int')
print "ret", ret


prgm = env.Program()
code = prgm.get_stream()

# Use a register from the parent code in the subcode directly
r_add = prgm.acquire_register()

# Generate sub-stream
# Multiple eax by 2, add 1
subcode = prgm.get_stream()
subcode.add(ppc.mulli(prgm.gp_return, prgm.gp_return, 2))
subcode.add(ppc.add(prgm.gp_return, prgm.gp_return, r_add))

# Initialize a register, insert code
code.add(ppc.addi(r_add, 0, 1))
code.add(ppc.addi(prgm.gp_return, 0, 5))
code.add(subcode)

# Add 3, insert again
code.add(ppc.addi(r_add, 0, 2))
code.add(ppc.addi(prgm.gp_return, prgm.gp_return, 3))
code.add(subcode)

prgm.add(code)
prgm.print_code()
ret = proc.execute(prgm, mode = 'int')
print "ret", ret