public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86
@ 2004-08-30 5:50 dann at godzilla dot ics dot uci dot edu
2004-10-06 23:27 ` [Bug rtl-optimization/17236] " giovannibajo at libero dot it
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-08-30 5:50 UTC (permalink / raw)
To: gcc-bugs
Compiling:
unsigned long long LLM(unsigned long long arg1, unsigned long long arg2)
{
return arg1 * arg2;
}
with gcc -O2 -fomit-frame-pointer generates:
pushl %ebp
pushl %edi
pushl %ebx
pushl %edi
pushl %edi
movl 32(%esp), %ecx
movl 24(%esp), %eax
movl 36(%esp), %ebx
movl 24(%esp), %edi
mull %ecx
imull 28(%esp), %ecx
imull %ebx, %edi
movl %edx, %ebp
movl %eax, (%esp)
addl %edi, %ebp
movl (%esp), %eax
leal (%ebp,%ecx), %ecx
movl %ecx, 4(%esp)
movl 4(%esp), %edx
popl %ecx
popl %ebx
popl %ebx
popl %edi
popl %ebp
ret
ICC -O2 generates much smaller code:
movl 8(%esp), %ecx #516.18
imull 12(%esp), %ecx #516.18
movl 16(%esp), %eax #516.18
imull 4(%esp), %eax #516.18
addl %eax, %ecx #516.18
movl 4(%esp), %eax #516.18
mull 12(%esp) #516.18
addl %ecx, %edx #516.18
ret #516.18
--
Summary: inefficient code for long long multiply on x86
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17236] inefficient code for long long multiply on x86
2004-08-30 5:50 [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86 dann at godzilla dot ics dot uci dot edu
@ 2004-10-06 23:27 ` giovannibajo at libero dot it
2005-03-14 18:24 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-06 23:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-10-06 23:27 -------
Confirmed. The code is know a little bit better:
LLM:
pushl %ebp
pushl %edi
pushl %ebx
subl $8, %esp
movl 32(%esp), %ecx
movl 36(%esp), %ebx
movl 24(%esp), %eax
mull %ecx
movl %eax, (%esp)
movl 24(%esp), %edi
imull %ebx, %edi
movl %edx, %ebp
addl %edi, %ebp
imull 28(%esp), %ecx
leal (%ebp,%ecx), %ecx
movl %ecx, 4(%esp)
movl (%esp), %eax
movl 4(%esp), %edx
addl $8, %esp
popl %ebx
popl %edi
popl %ebp
ret
.size LLM, .-LLM
.ident "GCC: (GNU) 4.0.0 20041003 (experimental)"
On 2.95, we used to emit:
LLM:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 20(%esp),%ecx
movl 24(%esp),%ebx
movl 28(%esp),%eax
movl 32(%esp),%esi
mull %ecx
movl %eax,%edi
movl 28(%esp),%eax
imull %ecx,%esi
imull %ebx,%eax
movl %edx,%ebp
addl %esi,%ebp
addl %eax,%ebp
movl %edi,%eax
movl %ebp,%edx
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.Lfe1:
.size LLM,.Lfe1-LLM
.ident "GCC: (GNU) 2.95.3 20010315 (release)"
Not a regression, and ICC does so much better.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Known to fail| |2.95.3 3.0.4 3.3.3 3.4.1
| |4.0.0
Last reconfirmed|0000-00-00 00:00:00 |2004-10-06 23:27:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17236] inefficient code for long long multiply on x86
2004-08-30 5:50 [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86 dann at godzilla dot ics dot uci dot edu
2004-10-06 23:27 ` [Bug rtl-optimization/17236] " giovannibajo at libero dot it
@ 2005-03-14 18:24 ` cvs-commit at gcc dot gnu dot org
2005-03-15 10:05 ` giovannibajo at libero dot it
2005-03-15 10:07 ` giovannibajo at libero dot it
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-14 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-14 18:24 -------
Subject: Bug 17236
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: sayle@gcc.gnu.org 2005-03-14 18:24:15
Modified files:
gcc : ChangeLog optabs.c
Log message:
PR rtl-optimization/17236
* optabs.c (expand_doubleword_mult): New helper function split out
from expand_binop. Permute the order in which instructions are
emitted to minimize the number of simultaneously live registers.
(expand_binop): Call expand_doubleword_mult to synthesize a double
word multiplication.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7846&r2=2.7847
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/optabs.c.diff?cvsroot=gcc&r1=1.260&r2=1.261
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17236] inefficient code for long long multiply on x86
2004-08-30 5:50 [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86 dann at godzilla dot ics dot uci dot edu
2004-10-06 23:27 ` [Bug rtl-optimization/17236] " giovannibajo at libero dot it
2005-03-14 18:24 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-15 10:05 ` giovannibajo at libero dot it
2005-03-15 10:07 ` giovannibajo at libero dot it
3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2005-03-15 10:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-03-15 10:04 -------
Roger explains what else needs to be done here:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01386.html
Right now, after his patch, mainline generates this code:
pushl %edi
pushl %esi
pushl %ebx
movl 16(%esp), %eax
movl 20(%esp), %edx
movl 24(%esp), %ecx
movl 28(%esp), %ebx
movl %edx, %esi
imull %ecx, %esi
movl %ebx, %edi
imull %eax, %edi
addl %edi, %esi
mull %ecx
leal (%esi,%edx), %edx
popl %ebx
popl %esi
popl %edi
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17236] inefficient code for long long multiply on x86
2004-08-30 5:50 [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86 dann at godzilla dot ics dot uci dot edu
` (2 preceding siblings ...)
2005-03-15 10:05 ` giovannibajo at libero dot it
@ 2005-03-15 10:07 ` giovannibajo at libero dot it
3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2005-03-15 10:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-03-15 10:07 -------
Uros did some additional comments:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01427.html
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |19398
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-15 10:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-30 5:50 [Bug rtl-optimization/17236] New: inefficient code for long long multiply on x86 dann at godzilla dot ics dot uci dot edu
2004-10-06 23:27 ` [Bug rtl-optimization/17236] " giovannibajo at libero dot it
2005-03-14 18:24 ` cvs-commit at gcc dot gnu dot org
2005-03-15 10:05 ` giovannibajo at libero dot it
2005-03-15 10:07 ` giovannibajo at libero dot it
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).