[fpc-pascal] FPC ARM inline Assembler
Jonas Maebe
jonas at freepascal.org
Thu Apr 6 19:43:29 CEST 2023
On 06/04/2023 19:06, Vern via fpc-pascal wrote:
> .......... the ARM version fails (similar code : ignore the fact it is
> the reverse of BSR) ... what am I missing ?
>
> procedure MSBitTest ( DataIn : longword);
> var
> MSBit : longword;
>
> begin
> asm
> clz w4 , DataIn
> mov MsBit , w4
> end;
> end;
ARM is a load/store architecture, which means it only supports
operations on values loaded in registers. Local variables are always
allocated on the stack in procedures/functions with inline assembler
blocks, so you need to use the "str" instruction to store w4 into MsBit.
"mov" only works for register-register transfers on ARM.
Jonas
More information about the fpc-pascal
mailing list