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

Added Pseudo-instructions from F and D. Allow for instructions to have a special field. #279

Conversation

AFOliveira
Copy link
Contributor

This time there was a need to modify parse.py a tiny bit in order to fully accommodate all pseudo-instructions.
Since parse.py did not allow to have pseudoinstructions with the two of the same register(e.g. fmv_s rs, rs) due to how it parses, I created a work around, that I succesfully checked does not break any of the pre-existing instructions. It allows that a register is equalled to anything, as in, "rs2=rs1" and uses the "rs2" to know it's position in encoding.

Adittionally, I added the following pseudo-instructions:

F

fmv.s
fabs.s
fneg.s

D

fmv.d
fabs.d
fneg.d

rv_d Show resolved Hide resolved
Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep things symmetric, can you add the analogous pseudoinstructions for Zfh and Q, too?

@AFOliveira
Copy link
Contributor Author

Sorry to get back on this but I'm actually having a hard time finding "Zfh" and ''Q'' pseudo-instructions since I believe they aren't in the ASM Manual and I also could not find them in the ISA spec, is there somewhere you can point me to so I can indeed add them here?

@aswaterman
Copy link
Member

It's possible that someone forgot to update the asm manual, but Zfh and Q have exactly analogous pseudoinstructions (fmv.h, fabs.h, fneg.h; fmv.q, fabs.q, fneg.q). Binutils implements them, for example. We should include them here, this repo being the source of truth, then update the asm manual accordingly.

https://github.com/bminor/binutils-gdb/blob/2e9df7573a1a7df1c34321c0837eb46b2be5d4a5/opcodes/riscv-opc.c#L815-L817

https://github.com/bminor/binutils-gdb/blob/2e9df7573a1a7df1c34321c0837eb46b2be5d4a5/opcodes/riscv-opc.c#L1022-L1024

@AFOliveira
Copy link
Contributor Author

Thank you for clarifying and linking the binutils! Latest commit should address all of this.

@AFOliveira AFOliveira force-pushed the PseudoinstructionsAdded branch 3 times, most recently from 0935a89 to e3d0e74 Compare August 30, 2024 12:45
rv_q Outdated Show resolved Hide resolved
rv_zfh Outdated Show resolved Hide resolved
@AFOliveira
Copy link
Contributor Author

All should now be solved. Sorry for the mess and the copy-paste error.

Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AFOliveira no prob, that's what code review is for!

@aswaterman aswaterman merged commit 2d55f75 into riscv:master Aug 31, 2024
2 checks passed
@AFOliveira AFOliveira deleted the PseudoinstructionsAdded branch September 4, 2024 08:21
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

Successfully merging this pull request may close these issues.

2 participants