Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is jalr with rs1=x0 inferable? #188

Open
pdonahue-ventana opened this issue Jan 6, 2025 · 2 comments
Open

Is jalr with rs1=x0 inferable? #188

pdonahue-ventana opened this issue Jan 6, 2025 · 2 comments

Comments

@pdonahue-ventana
Copy link
Contributor

Section 4.1.1 says:

For the purposes of this specification, the following strict definition applies:
If the target of a jump is supplied via a constant embedded within the jump opcode, it is classified
as inferable.

By my reading, the only jump in the base architecture that fits that description is JAL. Then JALR is later described as inferable if it follows a LUI, C.LUI, or AUIPC. However, the pseudocode has:

# Determine if instruction is an inferable jump #
function is_inferable_jump (instr)

  if ((instr.opcode == JAL)   or
      (instr.opcode == C.JAL) or
      (instr.opcode == C.J)   or
      (instr.opcode == JALR and instr.rs1 == 0))
    return TRUE

So does "constant" include the rs1 field? (I see how a jump to x0 +/- 4KB could be inferable, though this seems like a weird optimization in real life.)

@IainCRobertson
Copy link
Collaborator

IainCRobertson commented Jan 7, 2025 via email

@pdonahue-ventana
Copy link
Contributor Author

I'm happy with that resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants