-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RISCV64 assembly opcode documentation - update #5598
Conversation
Make opcodes bold in description
case "FMIN.S": | ||
return { | ||
"html": "<div><span class=\"opcode\"><b>FMIN.S</b> rd, rs1, rs2</span><br><div>Floating-point minimum-number and maximum-number instructions <b>FMIN.S</b> and FMAX.S write, respectively, the smaller or larger of rs1 and rs2 to rd. For the purposes of these instructions only, the value - 0.0 is considered to be less than the value + 0.0. If both inputs are NaNs, the result is the canonical NaN. If only one operand is a NaN, the result is the non-NaN operand. Signaling NaN inputs set the invalid operation exception flag, even when the result is not NaN.<br>Note that in version 2.2 of the F extension, the <b>FMIN.S</b> and FMAX.S instructions were amended to implement the proposed IEEE 754-201x minimumNumber and maximumNumber operations, rather than the IEEE 754-2008 minNum and maxNum operations. These operations differ in their handling of signaling NaNs.</div><br><div><b>ISA</b>: f</div></div>", | ||
"tooltip": "Floating-point minimum-number and maximum-number instructions FMIN.S and FMAX.S write, respectively, the smaller or larger of rs1 and rs2 to rd. For the purposes of these instructions only, the value - 0.0 is considered to be less than the value + 0.0. If both inputs are NaNs, the result is the canonical NaN. If only one operand is a NaN, the result is the non-NaN operand. Signaling NaN inputs set the invalid operation exception flag, even when the result is not NaN.\nNote that in version 2.2 of the F extension, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition of fmsub.h in opcodes.yaml is
fmsub.h:
opcode:
- fmsub.h
- rd
- rs1
- rs2
- rs3
- rm
- 26..25=2
- 6..2=0x11
- 1..0=3
opcode_group: zfh
opcode_args: *22
iss_code:
- require_either_extension(EXT_ZFH, EXT_ZHINX);
- require_fp;
- softfloat_roundingMode = RM;
- WRITE_FRD_H(f16_mulAdd(FRS1_H, FRS2_H, f16(FRS3_H.v ^ F16_SIGN)));
- set_fp_exceptions;
As opposed to others, it doesn't have a main_desc, where the ISA value is taken from, but it does have an opcode_group
(zfh), I wonder if it shouldn't be saying ISA: zfh
? (I have no idea what it actually means)
fmv.h.z
also have the opcode_group: zfh
, but that one actually has a main_desc
and the description
, so I don't know what the best option would be..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. It should say "(ISA: zfh)". zfh
means "Standard Extension for 16-bit Half-Precision Binary Floating-Point Instructions". To generate opcodes.yaml
, I'm using the most recent opcodes metadata files, but the html from an older ratified spec version, so it's probably missing fmsub.h
in the older documentation file. fmv.h
was found in the documentation so main_desc
is present.
I'm not sure if any compiler will generate code for the zfh
extension.
this is now live Although it is sometimes a bit confusing, for example for https://godbolt.org/api/asm/riscv64/sd - it mentions SD, but the description is about LW Is that fixable? |
Hi Patrick, All of the descriptions are automatically extracted from the RISC-V official user manual. The tend to only write per instruction group, for example SD is defined in the RV64 load and store instruction section, that's why it starts with LD: Having said that, I think it is fixable. The easiest way to fix it is to write some custom descriptions for cases like this where the user manual is not clear. |
Ahh I see. Unfortunate. Let's just keep it this way unless someone starts complaining |
This is an extension of the pull request by @SiyaoIsHiding
#5121
Closes #4584
Instead of scraping the HTML, I've used a file
opcodes.yaml
which is generated from a number of sources, the RISC-V documentation in tex or adoc, the RISC-V opcodes repositories, the RISC-V assembly manual and even the RISC-V ISA simulator.The script will to download
opcodes.yaml
and generate documentation from it.I've also made some fixes and additions to the
opcodes yaml
data so we can make meaningful quick references. The most visible one is the addition of psuedo instruction to base ISA mapping.All of the documents are extracted from the official RISC-V ISA manuals. These are not just targeted at programmers, but also the processor developers, so the descriptions may be verbose from a programming point of view.
The linked html is now hosted as a github io page. The scripts used to generate it are also all included in that github repo associated with those github pages. The version of the RISC-V spec is clearly identified in the URL.