This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: abysmal code generated by gcc 3.2
- From: Denys Duchier <Denys dot Duchier at ps dot uni-sb dot de>
- To: Denys Duchier <Denys dot Duchier at ps dot uni-sb dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 22 Oct 2002 01:49:47 +0200
- Subject: Re: abysmal code generated by gcc 3.2
- References: <isk7kcrcpf.fsf@elk.ps.uni-sb.de>
Compiling emulate.cc with ... -O3 -fno-inline-functions ... with gcc
3.2 is still not nearly as good as -O3 with gcc 2.95, but at least it
is in the same ball park. After examining the assembly code some
more: a lot of it looks nicer with 3.2 than with 2.95 (once the
compiler has been stopped from behaving utterly foolishly). So, I am
guessing that now most of the regression lies elsewhere. After
comparing builtins.s for 2.95 and 3.2, I noticed some patterns; for
example with 2.95 I get all over the place:
testb $3, %dl
while with 3.2 I get instead:
testl $3, %edx
I believe this is the tag test for ref pointers, for the inlined deref
loop. This is is highly critical since pretty much everywhere we must
synchronize on data and make sure we unwind chains of deref pointers
before we can actually operate on the data.
For example, here is the relevant part for the BIsendPort primitive
compiled with gcc 3.2:
BIsendPort:
pushl %ebx
subl $40, %esp
movl 48(%esp), %ecx # _OZ_LOC, _OZ_LOC
movl (%ecx), %eax # * _OZ_LOC
movl (%eax), %edx # prt
xorl %eax, %eax
testl $3, %edx # prt
jne .L2922
.p2align 4,,15
.L2914:
movl %edx, %eax # prt, prtPtr
movl (%edx), %edx # * prt, prt
testl $3, %edx # prt
je .L2914
.L2922:
The corresponding code generated by gcc 2.95 is:
BIsendPort:
subl $24,%esp
pushl %ebx
movl 32(%esp),%ecx
movl (%ecx),%eax
movl (%eax),%edx
xorl %eax,%eax
testb $3,%dl
jne .L20218
.p2align 4,,7
.L20219:
movl %edx,%eax
movl (%edx),%edx
testb $3,%dl
je .L20219
.L20218:
Could the difference explain part of the regression I am seeing or
should I be looking for something else? If testl is significantly
more costly, how can I get testb back?
Cheers,
--
Dr. Denys Duchier Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme (Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50 Phone: +49 681 302 5618
66041 Saarbruecken, Germany Fax: +49 681 302 5615