<HTML>
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>
</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>
</HTML>