problems with the AArch64 inline Assembler lazarus / 66-Unix ---------------------------------------------------------------------- derMischka81 · 2021-02-16 12:28 I use the inline Asssembler on my RPi3 with 64Bit OS. I have problems with the following inline Assembler instruction Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i asm  add x1, x1, x7, lsl #3end;  The Instruction should do the following thing: x1 := x1 + (x7 shl 3) but if I compile and check the results inklusive the assembly window I can see that the BarrelShift (lsl #3) is missing. The Next Problem is a branch to a Object-function. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TTestObj1.t estproc;beginend; TTestObj2.asmprob;nostackframe;assembler;asm  stp x0, x30, [sp, #-16]!   ldr x0, [x0, FTestObj1]  bl TTestObj1.testproc   ldp x0, x30 [sp], #16end;  The Branch-Value/Address is not correct --> jumps to the branch line self (infinite loop) ---------------------------------------------------------------------- Zvoni · 2021-02-16 14:33 I was under the impression, that the ADD in Assembly has three operands: Destination, Source1, Source2 You have 4 operands ---------------------------------------------------------------------- PascalDragon · 2021-02-17 08:43 Quote from: derMischka81 on February 16, 2021, 01:28:19 pmI use the inline Asssembler on my RPi3 with 64Bit OS. I have problems with the following inline Assembler instruction Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i asm  add x1, x1, x7, lsl #3end;  The Instruction should do the following thing: x1 := x1 + (x7 shl 3) but if I compile and check the results inklusive the assembly window I can see that the BarrelShift (lsl #3) is missing. You are aware that I as a compiler developer had already replied to this in on your thread in German forum? And that you should report this on the bug tracker? Quote from: derMischka81 on February 16, 2021, 01:28:19 pmThe Next Problem is a branch to a Object-function. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TTestObj1.t estproc;beginend; TTestObj2.asmprob;nostackframe;assembler;asm  stp x0, x30, [sp, #-16]!   ldr x0, [x0, FTestObj1]  bl TTestObj1.testproc   ldp x0, x30 [sp], #16end;  The Branch-Value/Address is not correct --> jumps to the branch line self (infinite loop) I think you better use a combination of ADRP and ADR to load the address into a register and branch to that. What exactly the assembler reader generates for your code I'd need to check. Quote from: Zvoni on February 16, 2021, 03:33:55 pmI was under the impression, that the ADD in Assembly has three operands: Destination, Source1, Source2 You have 4 operands The ADD instruction (among others) can also have an additional shift left as fourth parameter. See for example here. ---------------------------------------------------------------------- Jonas Maebe · 2021-02-17 13:26 Quote from: derMischka81 on February 16, 2021, 01:28:19 pmI use the inline Asssembler on my RPi3 with 64Bit OS. I have problems with the following inline Assembler instruction Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i asm  add x1, x1, x7, lsl #3end; This bug is fixed in trunk and fixes_3_2. QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TTestObj1.t estproc;beginend; TTestObj2.asmprob;nostackframe;assembler;asm  stp x0, x30, [sp, #-16]!   ldr x0, [x0, FTestObj1]  bl TTestObj1.testproc   ldp x0, x30 [sp], #16end; While not yet supported, for now this at least gives a compilation error rather than resulting in invalid code. The compiler does not yet parse "ldr x0, [x0, FTestObj1]" correctly either though (it seems to ignore the "FTestObj1"; even if it does not exist, no compilation error is printed). The RTL uses very little AArch64 inline assembly and since it's a new architecture, existing inline assembly tests are not checked for it (they would have to be translated first). So there are probably quite a few more bugs in its assembler reader...