Tests/support/summation_kernel.cpp
/**
 * Determine address offset for address registers.
 *
 * The offset is put in r0.
 * A register file location is also used as a temp storage location.
 *
 * @param reg_qpu_num index in the register file for location to put the qpu num in
 */
Determine address offset for address registers.
The offset is put in r0.
A register file location is also used as a temp storage location.

@param reg_qpu_num index in the register file for location to put the qpu num in
Determine address offset for address registers . The offset is put in r0 . A register file location is also used as a temp storage location . @param reg_qpu_num index in the register file for location to put the qpu num in
Instructions calc_offset(uint8_t num_qpus, uint8_t reg_qpu_num) {
  using namespace V3DLib::v3d::instr;
  Instructions ret;
  const char *text = 
    "Determine offset -> r0\n"
    "addr += 4 * (thread_num + 16 * qpu_num)";
  ret << set_qpu_num(num_qpus, reg_qpu_num).comment(text)
      << shl(r0, rf(reg_qpu_num), 4)
      << eidx(r1)
      << add(r0, r0, r1)
      << shl(r0, r0, 2);
  return ret;
}
Instructions calc_offset ( uint8_t num_qpus , uint8_t reg_qpu_num ) { using namespace V3DLib :: v3d :: instr ; Instructions ret ; const char * text = " \n " " " ; ret << set_qpu_num ( num_qpus , reg_qpu_num ) . comment ( text ) << shl ( r0 , rf ( reg_qpu_num ) , 4 ) << eidx ( r1 ) << add ( r0 , r0 , r1 ) << shl ( r0 , r0 , 2 ) ; return ret ; }
Determine address offset for address registers.
Determine address offset for address registers .