public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/6585: useless memory store instructions on x86
@ 2003-04-23 14:05 bangerth
0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-04-23 14:05 UTC (permalink / raw)
To: bruno, gcc-bugs, gcc-prs, nobody
Synopsis: useless memory store instructions on x86
State-Changed-From-To: feedback->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Apr 23 14:05:36 2003
State-Changed-Why:
Code is better but not good
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6585
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/6585: useless memory store instructions on x86
@ 2003-04-23 12:56 Bruno Haible
0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2003-04-23 12:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/6585; it has been noted by GNATS.
From: Bruno Haible <bruno@clisp.org>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: optimization/6585: useless memory store instructions on x86
Date: Wed, 23 Apr 2003 14:53:49 +0200 (CEST)
> Bruno, I can verify your problem with 3.2, but I get
> significantly better code with 3.2.2. Can you say a word
> whether the new code satisfies you?
No, the new code is somewhat better, but still exhibits three problems:
- The dead store is still there.
- The prologue still saves and restores an unused register.
- The final reshuffling of registers before return is suboptimal.
=========================== mul.c ===============================
long long mul (long long a, long long b) {
return a * b;
}
=================================================================
$ gcc -v
Reading specs from /packages/gnu-inst-gcc/3.2.2/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs
Configured with: ../configure --prefix=/packages/gnu-inst-gcc/3.2.2 --enable-shared --enable-version-specific-runtime-libs --enable-nls --enable-threads=posix --enable-__cxa_atexit
Thread model: posix
gcc version 3.2.2
$ gcc -O6 -fomit-frame-pointer -S mul.c
$ cat mul.s
.file "mul.c"
.text
.p2align 4,,15
.globl mul
.type mul,@function
mul:
subl $20, %esp
movl 24(%esp), %eax a0
movl %ebx, 8(%esp) save %ebx
movl 32(%esp), %ebx b0
movl %esi, 12(%esp) save %esi
movl 36(%esp), %ecx b1
movl %edi, 16(%esp) save %edi USELESS!
movl 16(%esp), %edi restore %edi USELESS!
mull %ebx %edx:%eax := a0*b0
movl %edx, %esi
movl %eax, (%esp)
movl 24(%esp), %eax a0
movl %edx, 4(%esp) USELESS!
imull %ecx, %eax a0*b1
addl %eax, %esi
movl 28(%esp), %eax a1
imull %eax, %ebx a1*b0
leal (%ebx,%esi), %eax
movl 12(%esp), %esi
movl 8(%esp), %ebx
movl %eax, 4(%esp) ! Could be simplified to 2 instructions:
movl (%esp), %eax ! movl %eax, %edx
movl 4(%esp), %edx ! movl (%esp), %eax
addl $20, %esp
ret
.Lfe1:
.size mul,.Lfe1-mul
.ident "GCC: (GNU) 3.2.2"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/6585: useless memory store instructions on x86
@ 2003-03-15 4:58 bangerth
0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-03-15 4:58 UTC (permalink / raw)
To: bruno, gcc-bugs, gcc-prs, nobody
Synopsis: useless memory store instructions on x86
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Sat Mar 15 04:58:27 2003
State-Changed-Why:
Bruno, I can verify your problem with 3.2, but I get
significantly better code with 3.2.2. Can you say a word
whether the new code satisfies you?
Thanks
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6585
^ permalink raw reply [flat|nested] 4+ messages in thread
* optimization/6585: useless memory store instructions on x86
@ 2002-05-06 13:06 Bruno Haible
0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2002-05-06 13:06 UTC (permalink / raw)
To: gcc-gnats
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]
>Number: 6585
>Category: optimization
>Synopsis: useless memory store instructions on x86
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Mon May 06 13:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Bruno Haible
>Release: 3.1 20020423 (prerelease)
>Organization:
GNU hackers
>Environment:
System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
>Description:
A case of a useless memory store and of a useless register spill.
=========================== mul.c ===============================
long long mul (long long a, long long b) {
return a * b;
}
=================================================================
$ gcc -v
Lecture des spécification à partir de /packages/gnu-snapshot/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configuré avec: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
Modèle de thread: single
version gcc 3.1 20020423 (prerelease)
$ gcc -O6 -fomit-frame-pointer -S mul.c
$ cat mul.s
.file "mul.c"
.text
.align 2
.p2align 4,,15
.globl mul
.type mul,@function
mul:
subl $28, %esp
movl 40(%esp), %ecx b0
movl %ebx, 12(%esp) save %ebx
movl 32(%esp), %ebx a0
movl %ebp, 24(%esp) save %ebp
movl 44(%esp), %ebp b1
movl %ebx, %eax a0
mull %ecx %edx:%eax := a0*b0
movl %edi, 20(%esp) save %edi
movl 36(%esp), %edi a1
movl %esi, 16(%esp) save %esi USELESS!
movl 16(%esp), %esi restore %esi USELESS!
imull %edi, %ecx a1*b0
movl %eax, (%esp)
movl 20(%esp), %edi restore %edi
movl %ebx, %eax a0
movl %edx, 4(%esp) USELESS!
imull %ebp, %eax a0*b1
movl 12(%esp), %ebx restore %ebx
movl 24(%esp), %ebp restore %ebp
addl %eax, %edx hi+a0*b1
movl (%esp), %eax lo
movl %edx, 4(%esp) hi+a0*b1 ! Could be simplified
addl %ecx, 4(%esp) hi+a0*b1+a1*b0 ! to a single insn:
movl 4(%esp), %edx ! addl %ecx, $edx
addl $28, %esp
ret
.Lfe1:
.size mul,.Lfe1-mul
.ident "GCC: (GNU) 3.1 20020423 (prerelease)"
>How-To-Repeat:
gcc -O6 -fomit-frame-pointer -S mul.c
>Fix:
more optimizations
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-23 14:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-23 14:05 optimization/6585: useless memory store instructions on x86 bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-04-23 12:56 Bruno Haible
2003-03-15 4:58 bangerth
2002-05-06 13:06 Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).