Author: Gerd Isenberg
Date: 00:25:11 10/16/05
Go up one level in this thread
On October 16, 2005 at 01:28:22, Scott Gasch wrote: >FWIW, here's gcc 3.4.2 with -O3 -S in ugly at&t syntax. I also added a >__attribute__((__regparm__(3))) to the function declaration to make it a >fastcall. > >getDayIndex1March00: > pushl %ebp > movl %esp, %ebp > pushl %edi > cmpl $3, %edx > pushl %esi > sbbl $0, %ecx Ok, that looks fine, only cmp-3 and sbb-0 with year (ecx) and month (edx) already in fastcall registers. Day seems also passed via eax register, with the consequence that four registers have to be saved on the stack, and a small stackframe must be created, to store/load one temporary local (month) on the stack - it seems that too many fastcall-registers fires back somehow. Interestingly all conpilers so far use the clever 2**37/100 reciprocal multiplication for div 100, but three lea-instructions to perform the mul 365 (9*8+1)+5, while a single mul is faster for amd-processors (3-cycles). Gerd > pushl %ebx > movl %eax, %edi > leal (%ecx,%ecx,8), %esi > movl %ecx, %eax > pushl %ebx > movl $1374389535, %ebx > movl %edx, -16(%ebp) > mull %ebx > leal (%ecx,%esi,8), %eax > movl %edx, %ebx > leal (%eax,%eax,4), %eax > shrl $2, %ecx > shrl $5, %ebx > addl %ecx, %eax > subl %ebx, %eax > shrl $2, %ebx > movl -16(%ebp), %edx > addl %ebx, %eax > addl daysTilMonth.0-4(,%edx,4), %eax > popl %edx > popl %ebx > popl %esi > addl %edi, %eax > popl %edi > leave > ret
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.