Hi,

On Thu, 24 Aug 2017, LacaK wrote:

> Thank you!
> I have hoped, that there is some kind of direct usage. Because
> "fstp a" is compiled into:
>    fstps  -0x24(%ebp) // address of local variable "a" on stack
> and "pa^ := a" into:
>    mov    -0x4(%ebp),%eax
>    mov    -0x40(%eax),%edx   // pa
>    mov    -0x24(%ebp),%eax   // a
>    mov    %eax,(%edx)             // a -> pa^
>
> so I hoped, that there is possibility to do it directly :
>    fstps  (-0x24(%ebp))
> but seems that this construct (use address stored on address) is not
> supported by processors instructions at all.

Such double-dereference is actually supported by the CALL instruction
which can jump to an address stored at the address pointed by the
reference operand, IIRC. But that's the exception. The x86 instruction set
is not too orthogonal, it's full of "special" cases like that one.

But really fast CPUs usually don't like such constructs, because it has
too many interdependencies and sub-instructions (like, address calculation
has to be done multiple times), so it's hard decode, pair and to pipeline
them. Yes, the encoding would be smaller, but less instructions doesn't
directly mean faster execution on most modern processors.

Charlie
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to