<HTML>
In the meantime, I've just submitted this patch: https://bugs.freepascal.org/view.php?id=33908 - it changes those routines with const p: tai to var p: tai.<br>
<div><br>
</div><div>Gareth aka. Kit<br>
</div> <br>
<br>
<span style="font-weight: bold;">On Sun 24/06/18 23:12 , "J. Gareth Moreton" gareth@moreton-family.com sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT:0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> 
If I had to start somewhere though... this is an extract of the disassembly from the pass 1 optimizer from the SVN head:<br>
 
<br>
 
<span style="font-family: Courier New;"><span style="font-weight: bold;">x86_64\aoptcpu.pas:105   result:=OptPass1OP(p);</span><br>
 
488b16                   mov    (%rsi),%rdx<br>
 
4889d9                   mov    %rbx,%rcx<br>
 
e8414f0000               callq  0x100189a30 <optpass1op><br>
 
4088c7                   mov    %al,%dil<br>
 
e951000000               jmpq   0x100184b48 <peepholeoptpass1cpu+648><br>
 
90                       nop<br>
 
<span style="font-weight: bold;">x86_64\aoptcpu.pas:110   result:=OptPass1MOVXX(p);</span><br>
 
4889f2                   mov    %rsi,%rdx<br>
 
4889d9                   mov    %rbx,%rcx<br>
 
e8cd4c0000               callq  0x1001897d0 <optpass1movxx><br>
 
4088c7                   mov    %al,%dil<br>
 
eb40                     jmp    0x100184b48 <peepholeoptpass1cpu+648><br>
 
<span style="font-weight: bold;">x86_64\aoptcpu.pas:112   result:=OptPass1LEA(p);</span><br>
 
4889f2                   mov    %rsi,%rdx<br>
 
4889d9                   mov    %rbx,%rcx<br>
 
e8ad500000               callq  0x100189bc0 <optpass1lea><br>
 
4088c7                   mov    %al,%dil<br>
 
eb30                     jmp    0x100184b48 <peepholeoptpass1cpu+648><br>
 
<span style="font-weight: bold;">x86_64\aoptcpu.pas:114   result:=OptPass1Sub(p);</span><br>
 
4889f2                   mov    %rsi,%rdx<br>
 
4889d9                   mov    %rbx,%rcx<br>
 
e89d580000               callq  0x10018a3c0 <optpass1sub><br>
 
4088c7                   mov    %al,%dil<br>
 
eb20                     jmp    0x100184b48 <peepholeoptpass1cpu+648><br>
 
</peepholeoptpass1cpu+648></optpass1sub></peepholeoptpass1cpu+648></optpass1lea></peepholeoptpass1cpu+648></optpass1movxx></peepholeoptpass1cpu+648></optpass1op></span><br>
 
There are some interesting things to note here.  OptPass1OP has "const p: tai" rather than "var p: tai" as a parameter, and this causes an unfortunate difference in the set-up, namely "mov (%rsi),%rdx" instead of "mov %rsi,%rdx".  If these were fixed  to all be "var p: tai" (I might actually do this, since it's a very simple change), then all the case nodes will be identical, save the call address, and would be a better experimental case for optimisation improvements.  Additionally, after the call, ther lies "mov %al,%dil" and an identical jump (to the end of the case block).  The MOV could easily be moved to after the jump with some careful code analysis, which might then allow for futher optimisation, depending on what is then done with %dil.<br>

 
<br>
 
Gareth aka. Kit<br>
 
 

_______________________________________________<br>

fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a><br>

<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a><br>

<br>

</blockquote></HTML>