[fpc-pascal] FPC ARM inline Assembler

Vern vmst at golden.net
Thu Apr 6 20:05:19 CEST 2023


Works now!

Many Thanks
Vern

On 06/04/2023 1:43 p.m., Jonas Maebe via fpc-pascal wrote:
> 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
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list