Hi,

A much more deterministic version would do it as this:

function HiInteger(value: LongInt): LongInt; nostackframe; assembler;
asm
  mov r0, r0, asr #16
end;

If you do it with an inline ASM block and without stackframes it becomes much harder to predict how you need to address variables by name

Best Regards,
Jeppe

On 3/29/23 15:47, Paul Renaud via fpc-devel wrote:
Hello,  I've been having a problem getting some code to compile.  I've gone through the documentation, but there isn't any specific info for the arm version. This is a simplified version

Program Test;

  Function HiInteger( Value: LongInt ): LongInt;
    Begin
      Asm
        LdR R0, Value
        Mov R1, R0, ASR #16
        StR R1, @Result         (* This line generates an error *)
       End [ 'R0', 'R1' ];
     End;

  Begin
  End.

Free Pascal version 3.2.2 for arm

Thanks for any help in advance.
Paul.


_______________________________________________
fpc-devel maillist  -fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to