title: RISC-V difference between jal and jalr
body: <p>I came across the instruction named jal and jalr while studying RISC-V assembly language.</p>
  <p>I quite having hard times to understand the differences between jal and jalr.</p>
  <pre><code>jal x1, X 
  </code></pre>
  <p>It seems that above code is meaning that jump to X, and save the return address which is normally PC+4 to the x1.</p>
  <p>But after that, <code>jalr x0, 0(x1)</code> comes.</p>
  <p><code>0(x1)</code> means that going back to the address which is the return address, but what is x0?</p>
  <p>Essentially x0 is zero in RISC-V, so why do we need x0?</p>
  <p>What is the actual difference between those two instructions, <code>jal</code> and <code>jalr</code>?</p>