Mail Archives: djgpp/2002/02/07/23:15:12
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f
|
From: | Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp,comp.lang.c
|
Subject: | Re: gcc 2.953 output - is this a bug?
|
Date: | Thu, 07 Feb 2002 21:07:40 -0700
|
Organization: | Systematic Software
|
Lines: | 58
|
Message-ID: | <bpi46uos4dd4ul3e7838t13d81dop4gg5m@4ax.com>
|
References: | <3C61E6BB DOT 7F9AD526 AT yahoo DOT com>
|
NNTP-Posting-Host: | h-207-148-133-220.dial.cadvision.com
|
Mime-Version: | 1.0
|
X-Trace: | news3.cadvision.com 1013141261 17852 207.148.133.220 (8 Feb 2002 04:07:41 GMT)
|
X-Complaints-To: | news AT cadvision DOT com
|
NNTP-Posting-Date: | Fri, 8 Feb 2002 04:07:41 +0000 (UTC)
|
X-Newsreader: | Forte Agent 1.9/32.560
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
On Thu, 07 Feb 2002 02:31:00 GMT, CBFalconer
<cbfalconer AT yahoo DOT com> wrote:
>Please look at the following disassembly:
>
>00000578 <_hshstrehash>:
>
>/* 1------------------1 */
>
>/* ReHash a string quantity */
>unsigned long hshstrehash(const char * string)
>{
> 578: 55 push %ebp
> 579: 89 e5 mov %esp,%ebp
> 57b: 8b 4d 08 mov 0x8(%ebp),%ecx
> unsigned long h;
>
> h = 0;
> 57e: 31 d2 xor %edx,%edx
> while (*string) {
> 580: 80 39 00 cmpb $0x0,(%ecx)
> 583: 74 12 je 597 <_hshstrehash+0x1f>
> h = h * 37UL + (unsigned char) *string++;
> 585: 8d 04 d2 lea (%edx,%edx,8),%eax <<***
> 588: 8d 04 82 lea (%edx,%eax,4),%eax <<***
> 58b: 31 d2 xor %edx,%edx
> 58d: 8a 11 mov (%ecx),%dl
> 58f: 41 inc %ecx
> 590: 01 c2 add %eax,%edx
> }
> 592: 80 39 00 cmpb $0x0,(%ecx)
> 595: 75 ee jne 585 <_hshstrehash+0xd>
> return h;
> 597: 89 d0 mov %edx,%eax
> 599: 89 ec mov %ebp,%esp
> 59b: 5d pop %ebp
> 59c: c3 ret
>} /* hshstrehash */
>
>look at the lines marked "<<***". I fail to see how this
>implements h * 37UL. This is compiled with -O2 and disassembled
>by objdump -dS.
>
>c.l.c justification - purely standard source code :-) I AM
>impressed by gcc's code generation.
As am I -- I've got to download and read that source -- really
nice optimization -- anyone point me to the module?
--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada
Brian DOT Inglis AT CSi DOT com (Brian dot Inglis at SystematicSw dot ab dot ca)
fake address use address above to reply
tosspam AT aol DOT com abuse AT aol DOT com abuse AT yahoo DOT com abuse AT hotmail DOT com abuse AT msn DOT com abuse AT sprint DOT com abuse AT earthlink DOT com abuse AT cadvision DOT com abuse AT ibsystems DOT com uce AT ftc DOT gov
spam traps
- Raw text -