title: How to perform right shift in Y86-64 (or other toy ISAs with ADD + AND but no native right shift)
body: <p>I'm trying to perform a right shift on Y86-64 </p>
  
  <p>To do a left shift I know that I need to multiply by 2^n where n is the number of bit shift we want for example if we want to shift by 4 it's 2^4 = 16 and do a loop of additions to perform multiplication on  it but I'm not sure what to do for right shifts I think I need to perform division  but not sure on how to approach that</p>
  
  <pre><code>pcount_do:
       movq $0, %rax
  .L2: movq %rdi, %rdx
       shrq %rdi
       ret
  </code></pre>