With RISC-V assembler, the operand order is destination/source except for stores.
Thus, your example instruction reads:
SW x8, -6(x4)
^ ^
| |
| destination
source
The store word (sw
) instruction reads the lower 4 bytes of your source register and stores them into memory at the address given in the destination operand.
In your example, -6(x4)
is the usual assembler syntax for specifying a register where an address is stored (x4
) and a constant offset (-6
) to that address.
In prose your example instruction reads:
Store the lower 4 bytes located in register x8 into memory at the address obtained by subtracting 6 from the address that is located in register x4.
More formally:
sw src, off(dst) => M[dst + off] = src[31:0]
See also for example Annex A RISC-V Instruction Listings, page 162 of The RISC-V Reader by Patterson and Waterman, 2017.