How much should I add when using "jal" in RISC-V and 1 word is 8-byte?
jal x10 foo //x10 has O
As I know, "jal" instruction place foo address in PC(program counter, x2) so procedure can jump to foo, and in parallel, place (PC + 4) value in x10 (in this code) as return address to excute next procedure after return.
What I'm curious about is, using RISC-V ISA and 1 word is 8-byte, which number should I add, 4 or 8?
Likeas, when 1 word is 8-byte, how should I set offset?
For example,
f = g + A[8] (f, g are placed in x5, x6, respectively)
(base address of A[] is placed in x10)
add x5, x6, 64(x10)
is it right?
I assume it's correct because index * word = 8 * 8(byte) = 64
I studied in 1 word = 4-byte architecture so all I know is
A[8] (base address is placed in x10) is same as 2(x10) <- True.
If in 1 word = 8-byte architecture,
and if A[8] is same as 1(x10), it means 1 word is automatically considered as 8-byte, then why there exists ld (load doubleword) instruction? I guess it's false.