NASM Forum > Programming with NASM

Invalid effective address

(1/2) > >>

paml27:
Hello,

vmovsd xmm0,[rdi+0+r9*24] – why is this an invalid effective address

vmovsd xmm1,[rdi+0+r9*8] – and this is a valid effective address?

Thanks,

Pam

Frank Kotler:
Hi pam127,

I am not sure. It looks to me like the "* 24" might be the problem. 2, 4, 8... 16? and 32? maybe? I'm not sure what to do about it if 24 is what you want.

Best,
Frank

paml27:
Hi, Frank,

Thanks for your reply.  I guess it's successive powers of two. 

When I come back from my meeting I am going to try vmovsd xmm0,[rdi+0+r9*16*3+8*3] and I'll let you know what happens. 

Pam

fredericopissarra:
If the instruction has a SIB field (scale, index, base), then there is only 2 bits for the scale. So, it is 1, 2, 4 or 8, no more.

The easiest way to do [rdi+r9*48+24] is:

--- Code: ---mov    rax,r9
mov    rdx,r9  ; if you want to preserve r9.
shl    rax,5   ; rax = r9 * 32
shl    rdx,4   ; rdx = r9 * 16
add    rax,rdx ; rax = (32 + 16)*r9
movsd  xmm0,[rdi+rax+24]
--- End code ---

paml27:
I've tried various combinations, but Frederico's method is the only way to do it for what I need. 

Thanks to both of you. 

Navigation

[0] Message Index

[#] Next page

Go to full version