FILD doubt

Peter Johnson peter at tortall.net
Thu Aug 31 12:08:32 PDT 2006


On Thu, 31 Aug 2006, Vikas N Kumar wrote:
> On 8/31/06, Andrew Dunstan <a_dunstan at hotmail.com> wrote:
>> will push the 64-bit int pointed to by rax onto the fp stack. The int must
>> be in memory, not in a GPR.
>
> Yea, but even the below statement gave me errors.
>
> fild [rbp-8]
>
> [rbp -8] is  an m64 type operand right  or is it r/m64 ?

Yasm doesn't know what size operand that is unless you tell it.  The 
address size is obviously 64-bit, but the size of the data there is not 
known to the assembler.  This is just like

mov [rbp], 0

Is the value at that address a byte?  16 bit?  32 bit?  Yasm doesn't know, 
so you need to explicitly tell it:

mov dword [rbp], 0
or
mov [rbp], dword 0

The same rule applies to fild.  It can take either a 32-bit or 64-bit 
operand, and Yasm doesn't know which one you want unless you tell it, thus 
the error.  If you want 64-bit, say "qword" e.g.

fild qword [rbp-8]

Note Yasm will try to figure out the size if it can (for example "mov 
[rbp], eax" is obviously accessing a 32-bit value because eax is 32-bit, 
but in the cases it can't figure out the size, Yasm needs you to tell it.

Peter


More information about the yasm-devel mailing list