title: mips number of clock cycles and how improving code
body: <p>I'm really new in MIPS and I have these questions which I found so many dissimil answers for them ... if someone can help, it would be great. Thanks</p>
  
  <p><em>How many clock cycles does this code take?</em></p>
  
  <pre><code>#Macro Instructions
  li  $t0, 32         #  1 or 2 cycles ?      
                      #                lui $at, Upper 16-bits of value 
                      #                ori Rd, $at, Lower 16-bits of value
                      #                -----------------------------------
                      #                ori Rt, $0, value
                      #
                      #  Which set of instructions will be executed?
  
  
  div $t2, $t2, $t0   #  41 cycles?          
                      #                bne Rt, $0,
                      #                break $0
                      #                ok: div Rs, Rt
                      #                mflo Rd
  
  #Integer Instruction
  
  lw  $t2, 0($t13)    #  1  cycles?
  sw  $t2, 0($t3)     #  1  cycles?
  </code></pre>
  
  <p>How those 4 lines of codes can be significantly improved? by avoiding to use Macros or ... ?</p>