Jerome Vouillon wrote:
On Thu, Feb 06, 2003 at 01:37:42PM +0100, Leopold Toetsch wrote:This is one thing I allways wanted to try ;-) fast_core MOps: 11 Prederef: 17.5 CGoto MOps: 19.4 CGP MOps: 27.5 CGP -O3 MOps: 65 !!!1
Many thanks for this hint. I did write "I won't do it" but ehem, yes, here it is:Why not also predereference the operation address? This would save a memory read. The goto would become: goto **(cur_opcode += 4);
CGP MOps 34.5
CGP MOps -O3: 92.3
This is now the sub_i_i_i (-O3)
0x80e9060 <cgp_core+9808>: mov 0x4(%esi),%ecx
0x80e9063 <cgp_core+9811>: mov 0x8(%esi),%edx
0x80e9066 <cgp_core+9814>: mov 0xc(%esi),%eax
0x80e9069 <cgp_core+9817>: add $0x10,%esi
0x80e906c <cgp_core+9820>: mov (%eax),%eax
0x80e906e <cgp_core+9822>: mov (%edx),%edx
0x80e9070 <cgp_core+9824>: sub %eax,%edx
0x80e9072 <cgp_core+9826>: mov %edx,(%ecx)
0x80e9074 <cgp_core+9828>: jmp *(%esi)
So this saved 2 instructions including the memory access
This is the branch from mops.pasm
0x80e7ff0 <cgp_core+5600>: mov 0x4(%esi),%eax
0x80e7ff3 <cgp_core+5603>: cmpl $0x0,(%eax)
0x80e7ff6 <cgp_core+5606>: je 0x80e8010 <cgp_core+5632>
0x80e7ff8 <cgp_core+5608>: mov 0x8(%esi),%eax
0x80e7ffb <cgp_core+5611>: mov (%eax),%eax
0x80e7ffd <cgp_core+5613>: shl $0x2,%eax
0x80e8000 <cgp_core+5616>: add %eax,%esi
0x80e8002 <cgp_core+5618>: jmp *(%esi)
leo