Lazarus

Free Pascal => General => Topic started by: avk on November 07, 2019, 08:04:21 am

Title: [SOLVED]Built-in assembler
Post by: avk on November 07, 2019, 08:04:21 am
It looks like a bug, attempt to compile this code:
Code: Pascal  [Select][+][-]
  1. {$asmmode intel}
  2. procedure doasm;
  3. begin
  4.   asm
  5.     test rax, $8000000000000000
  6.   end;
  7. end;
  8.  
reports an error:
Code: Text  [Select][+][-]
  1. ... Error: Asm: signed dword value exceeds bounds -9223372036854775808
  2.  
Title: Re: Built-in assembler
Post by: zamronypj on November 07, 2019, 08:33:39 am
According to TEST instruction documentation

https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf

TEST RAX, imm32

So it accepts immediate value 32 bit operand. To test with 64 bit immediate value, CMIIW, I think you need to copy 64bit immediate value to 64bit register first


Code: ASM  [Select][+][-]
  1. mov rcx, $8000000000000000
  2. test rax, rcx
Title: Re: Built-in assembler
Post by: avk on November 07, 2019, 08:49:27 am
Thank you very much.
TinyPortal © 2005-2018