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.
Gareth aka. Kit On Sun 24/06/18 23:12 , "J. Gareth Moreton" [email protected] sent: If I had to start somewhere though... this is an extract of the disassembly from the pass 1 optimizer from the SVN head: x86_64aoptcpu.pas:105 result:=OptPass1OP(p); 488b16 mov (%rsi),%rdx 4889d9 mov %rbx,%rcx e8414f0000 callq 0x100189a30 4088c7 mov %al,%dil e951000000 jmpq 0x100184b48 90 nop x86_64aoptcpu.pas:110 result:=OptPass1MOVXX(p); 4889f2 mov %rsi,%rdx 4889d9 mov %rbx,%rcx e8cd4c0000 callq 0x1001897d0 4088c7 mov %al,%dil eb40 jmp 0x100184b48 x86_64aoptcpu.pas:112 result:=OptPass1LEA(p); 4889f2 mov %rsi,%rdx 4889d9 mov %rbx,%rcx e8ad500000 callq 0x100189bc0 4088c7 mov %al,%dil eb30 jmp 0x100184b48 x86_64aoptcpu.pas:114 result:=OptPass1Sub(p); 4889f2 mov %rsi,%rdx 4889d9 mov %rbx,%rcx e89d580000 callq 0x10018a3c0 4088c7 mov %al,%dil eb20 jmp 0x100184b48 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. Gareth aka. Kit _______________________________________________ fpc-devel maillist - [email protected] [1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: ------ [1] mailto:[email protected] [2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
