Fix Store-Conditional assembly operand order and add parens #345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The operand order for Store-Conditional assembly has the second and third operands reversed.
The RISC-V Instruction Set Manual states:
rd
is for the return code,rs2
is the value, andrs1
is the memory address.For the syntax
sc.w A,B,(C)
:A
is where the result is stored, per convention. So, this isrd
.B
is the value to be stored. So, this isrs2
.C
is the address at which to store the value. So, this isrs1
.The resulting syntax would be
stc.w rd,rs2,(rs1)
.The current assembly representation is:
Note that the order is wrong. In addition, parentheses are missing around
rs2
.Fix this instance, as well as two other instances where parentheses are missing.
Fixes #338.
Fixes #344.
Suggested-by: Tim Hutt timothy.hutt@codasip.com