In Go assembly on arm64, I have created a table of values
DATA table<>+0(SB)/4, 0x00000001 DATA table<>+4(SB)/4, 0x00000002 DATA table<>+8(SB)/4, 0x00000003 DATA table<>+12(SB)/4, 0x00000004
But what I want to be able to do is load up a value into a register from this table, but based on a variable.
If I had a constant I could do
MOVD table<>+4(SB), R1
but how can I do it with a variable? Something like...
MOVD $4, R0 MOVD table<>+R0(SB), R1
Or better yet, can I get the address and load a vector directly?
I guess the answer in normal are is ADR, but when I try that in go
ADR table<>(SB), R0
I just get
asm: illegal combination: 00280 [...] ADR table<>(SB), R9 ADDR NONE NONE REG, 3 7
Which is maybe the least useful error message I've ever seen.
Okay, so ADR works if I do PC relative addressing, but that's obviously not right.
User contributions licensed under CC BY-SA 3.0