David Monniaux
David Monniaux

Reputation: 2004

in RISC-V, what is the difference between jump and tail

RISC-V assembly features two mnemonics jump and tail, both of which perform an unconditional jump to another symbol. What is the difference between the two?

Both are pseudo-instructions that get expanded by the assembler but the difference is unclear.

Upvotes: 1

Views: 2009

Answers (1)

David Monniaux
David Monniaux

Reputation: 2004

It seems that the GNU assembler understands tail XXX as

  auipc x6, (something appropriate for XXX)
  jr x6, (something appropriate for XXX)

whereas jump XXX, RR is understood as

  auipc RR, (something appropriate for XXX)
  jr RR, (something appropriate for XXX)

In short, jump lets you choose the temporary register that gets clobbered by the computation of the destination.

In any case, the GNU linker removes the auipc if the target is close enough.

Upvotes: 1

Related Questions