From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
autolearn_force=no version=3.4.4
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103376,1d575f572a099528
X-Google-Attributes: gid103376,public
X-Google-ArrivalTime: 2001-12-04 14:39:30 PST
Path:
archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!opentransit.net!wanadoo.fr!not-for-mail
From: Pascal Obry
Newsgroups: comp.lang.ada
Subject: Re: What is faster Ada or C?
Date: 04 Dec 2001 23:37:06 +0100
Organization: Home - http://perso.wanadoo.fr/pascal.obry
Message-ID:
References: <3c08314d$0$158$9b622d9e@news.freenet.de>
<3C0BA624.7A12BFA1@boeing.com>
<9ugotc$rjl$1@a1-hrz.uni-duisburg.de>
NNTP-Posting-Host: avelizy-103-1-2-214.abo.wanadoo.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: wanadoo.fr 1007505569 23816 217.128.15.214 (4 Dec 2001 22:39:29 GMT)
X-Complaints-To: abuse@wanadoo.fr
NNTP-Posting-Date: 4 Dec 2001 22:39:29 GMT
Original-Sender: d:\home\obry@PASCAL
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
Xref: archiver1.google.com comp.lang.ada:17416
Date: 2001-12-04T22:39:29+00:00
List-Id:
Georg Bauhaus writes:
>
> Here is side by side output:
>
> .file "silly.adb" .file "silly.c"
> gcc2_compiled.: gcc2_compiled.:
> ___gnu_compiled_ada: ___gnu_compiled_c:
> .text .text
> .align 4 .align 4
> .globl __ada_silly .globl _silly
> __ada_silly: _silly:
> pushl %ebp pushl %ebp
> movl %esp,%ebp movl %esp,%ebp
> subl $8,%esp subl $8,%esp
> movl $0,-4(%ebp) movl $0,-4(%ebp)
> movl $1,-8(%ebp) movl $1,-8(%ebp)
> L2: L2:
> cmpl $1000,-8(%ebp) cmpl $1000,-8(%ebp)
> jle L5 jle L5
> jmp L3 jmp L3
> .align 2,0x90 .align 2,0x90
> L5: L5:
> incl -4(%ebp) incl -4(%ebp)
> jmp L4 L4:
> .align 2,0x90 incl -8(%ebp)
> jmp L3 jmp L2
> .align 2,0x90 .align 2,0x90
> L6: L3:
> L4: movl -4(%ebp),%edx
> incl -8(%ebp) movl %edx,%eax
> jmp L2 jmp L1
> .align 2,0x90 .align 2,0x90
> L3: L1:
> movl -4(%ebp),%edx movl %ebp,%esp
> movl %edx,%eax popl %ebp
> jmp L1 ret
> .align 2,0x90
> L1:
> movl %ebp,%esp
> popl %ebp
> ret
>
Here is the GNAT 5 output: "-S -gnatp"
.file "silly.adb"
.text
.align 2
.globl __ada_silly
.def __ada_silly; .scl 2; .type 32; .endef
__ada_silly:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl $0, -4(%ebp)
movl $1, -8(%ebp)
L2:
cmpl $1000, -8(%ebp)
jle L5
jmp L3
L5:
leal -4(%ebp), %eax
incl (%eax)
leal -8(%ebp), %eax
incl (%eax)
jmp L2
L3:
movl -4(%ebp), %eax
leave
ret
And with "-S -gnatp -O2"
.file "silly.adb"
.text
.align 2
.p2align 4,,15
.globl __ada_silly
.def __ada_silly; .scl 2; .type 32; .endef
__ada_silly:
pushl %ebp
movl $999, %eax
movl %esp, %ebp
.p2align 4,,7
L8:
decl %eax
jns L8
movl $1000, %eax
popl %ebp
ret
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"