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@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal