-
Notifications
You must be signed in to change notification settings - Fork 22
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
Instruction description mismatch #360
Comments
As far as I can see, LLVM model the three different fences in RISC-V separately:
These latter two are not "pseudo instructions" - in LLVM, that term is used to mean something without an encoding. The three above all have well-defined encodings. I think this split definition on the LLVM side was likely done for two reasons:
I'll also point out that the riscv-unified-db ( More generally, looking through the other
It's not very easy to balance all the reasons why LLVM may or may not split up an instruction compared to why this specification may or may not split up an instruction. I'm also 100% sure GCC/binutils will have made different choices to LLVM in some of these places. You may just need to cope with there not being a 1:1 mapping in some places. I'll also note some issues with the
|
The curse of the pseudo instructions again ;) To amplify @lenary's comments, I think there are two kinds of pseudo instructions:
I suspect we won't find issues with type 1. It's worth somehow distinguishing type 2. For both HW and SW, there are valid reasons to either treat them as separate instructions or as an alias on a case-by-case basis. UDB's goal should be to allow tools either choice. There are a few ways we can deal with type 2:
I'm leaning towards option 1, but this could be a good topic for the meeting today. |
I found that binutils also doesn't specify fence.tso as an alias (see https://github.com/bminor/binutils-gdb/blob/4a95bf414d90b565723618b55c52fadfba86a9c6/opcodes/riscv-opc.c#L575). Moreover, this commit (riscv/riscv-isa-manual@3943720)
|
Confirms, fence.tso is not a pseudo, so we should probably update it to not be one. |
Is your feature request related to a problem? Please describe.
While working on #356, I encountered the following issue with the FENCE instruction.
riscv-opcodes describes FENCE as
fence fm pred succ rs1 14..12=0 rd 6..2=0x03 1..0=3
LLVM describes FENCE as
0000pred[3]pred[2]pred[1]pred[0]succ[3]succ[2]succ[1]succ[0]00000000000000001111
The difference here is that LLVM hardcodes FM as 0000. I believe the reason this happens is because the ISA states the following:
The problem is that FENCE.TSO is a pseudo instruction of FENCE, therefore I'm not sure we can use LLVM definition here. Is this a difference on how compilers and hardware see the same instrucion?
Describe the solution you'd like
Would it be beneficialif we define a field that differentiates the instructions from software and hardware POV?
The text was updated successfully, but these errors were encountered: