public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/21329] New: optimize i386 block copy
@ 2005-05-02 8:59 vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:00 ` [Bug rtl-optimization/21329] " vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua @ 2005-05-02 8:59 UTC (permalink / raw)
To: gcc-bugs
gcc generates suboptimal i386 block copy code, like this:
movl $9, %ecx
rep
movsb
or this:
movl $2, %ecx
rep
movsl
movsw
Such short copies can be done with few movsl's instead.
Patch is attached. Note that I am not familiar with gcc
internals at all, so take it with reasonable suspicion.
--
Summary: optimize i386 block copy
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vda at port dot imtp dot ilyichevsk dot odessa dot ua
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/21329] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
@ 2005-05-02 9:00 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:02 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua @ 2005-05-02 9:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From vda at port dot imtp dot ilyichevsk dot odessa dot ua 2005-05-02 09:00 -------
Created an attachment (id=8790)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8790&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/21329] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:00 ` [Bug rtl-optimization/21329] " vda at port dot imtp dot ilyichevsk dot odessa dot ua
@ 2005-05-02 9:02 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:04 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua @ 2005-05-02 9:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From vda at port dot imtp dot ilyichevsk dot odessa dot ua 2005-05-02 09:02 -------
Created an attachment (id=8791)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8791&action=view)
patch against 4.0.0
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/21329] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:00 ` [Bug rtl-optimization/21329] " vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:02 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
@ 2005-05-02 9:04 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:10 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua @ 2005-05-02 9:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From vda at port dot imtp dot ilyichevsk dot odessa dot ua 2005-05-02 09:04 -------
Comparison between old and new code (-O2):
--- tO2.s Mon May 2 11:49:24 2005
+++ tO2-new.s Mon May 2 11:50:03 2005
@@ -35,8 +35,7 @@
movl $t21, %edi
movl $w21, %esi
cld
- movl $2, %ecx
- rep
+ movsl
movsl
movsb
popl %esi
@@ -55,8 +54,7 @@
movl $t22, %edi
movl $w22, %esi
cld
- movl $2, %ecx
- rep
+ movsl
movsl
movsw
popl %esi
@@ -75,8 +73,7 @@
movl $t23, %edi
movl $w23, %esi
cld
- movl $2, %ecx
- rep
+ movsl
movsl
movsw
movsb
@@ -96,8 +93,8 @@
movl $t30, %edi
movl $w30, %esi
cld
- movl $3, %ecx
- rep
+ movsl
+ movsl
movsl
popl %esi
popl %edi
@@ -115,8 +112,9 @@
movl $t40, %edi
movl $w40, %esi
cld
- movl $4, %ecx
- rep
+ movsl
+ movsl
+ movsl
movsl
popl %esi
popl %edi
@@ -169,7 +167,6 @@
movl %esp, %ebp
pushl %edi
pushl %esi
- subl $24, %esp
movl w10, %eax
movl %eax, t10
movl w20, %eax
@@ -179,36 +176,34 @@
movl $t21, %edi
movl $w21, %esi
cld
- movl $2, %ecx
- rep
+ movsl
movsl
movsb
movl $t22, %edi
movl $w22, %esi
- movb $2, %cl
- rep
+ movsl
movsl
movsw
movl $t23, %edi
movl $w23, %esi
- movb $2, %cl
- rep
+ movsl
movsl
movsw
movsb
movl $t30, %edi
movl $w30, %esi
- movb $3, %cl
- rep
+ movsl
+ movsl
movsl
movl $t40, %edi
movl $w40, %esi
- movb $4, %cl
- rep
+ movsl
+ movsl
+ movsl
movsl
movl $t50, %edi
movl $w50, %esi
- movb $5, %cl
+ movl $5, %ecx
rep
movsl
movl $t60, %edi
@@ -216,7 +211,6 @@
movb $6, %cl
rep
movsl
- addl $24, %esp
popl %esi
popl %edi
leave
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/21329] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (2 preceding siblings ...)
2005-05-02 9:04 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
@ 2005-05-02 9:10 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 12:24 ` [Bug target/21329] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua @ 2005-05-02 9:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From vda at port dot imtp dot ilyichevsk dot odessa dot ua 2005-05-02 09:10 -------
BTW, see above comment: gcc -O2 allocated 24 bytes on stack
and never uset them. ?!
Now, unoptimized compilation comparison:
--- t.s Mon May 2 11:41:20 2005
+++ t-new.s Mon May 2 11:39:40 2005
@@ -32,8 +32,8 @@
movl $t21, %edi
movl $w21, %esi
cld
- movl $9, %ecx
- rep
+ movsl
+ movsl
movsb
popl %esi
popl %edi
@@ -50,9 +50,9 @@
movl $t22, %edi
movl $w22, %esi
cld
- movl $10, %ecx
- rep
- movsb
+ movsl
+ movsl
+ movsw
popl %esi
popl %edi
leave
@@ -68,8 +68,9 @@
movl $t23, %edi
movl $w23, %esi
cld
- movl $11, %ecx
- rep
+ movsl
+ movsl
+ movsw
movsb
popl %esi
popl %edi
@@ -86,9 +87,8 @@
movl $t30, %edi
movl $w30, %esi
cld
- movl $3, %eax
- movl %eax, %ecx
- rep
+ movsl
+ movsl
movsl
popl %esi
popl %edi
@@ -105,9 +105,9 @@
movl $t40, %edi
movl $w40, %esi
cld
- movl $4, %eax
- movl %eax, %ecx
- rep
+ movsl
+ movsl
+ movsl
movsl
popl %esi
popl %edi
@@ -168,34 +168,34 @@
movl $t21, %edi
movl $w21, %esi
cld
- movl $9, %ecx
- rep
+ movsl
+ movsl
movsb
movl $t22, %edi
movl $w22, %esi
cld
- movl $10, %ecx
- rep
- movsb
+ movsl
+ movsl
+ movsw
movl $t23, %edi
movl $w23, %esi
cld
- movl $11, %ecx
- rep
+ movsl
+ movsl
+ movsw
movsb
movl $t30, %edi
movl $w30, %esi
cld
- movl $3, %eax
- movl %eax, %ecx
- rep
+ movsl
+ movsl
movsl
movl $t40, %edi
movl $w40, %esi
cld
- movl $4, %eax
- movl %eax, %ecx
- rep
+ movsl
+ movsl
+ movsl
movsl
movl $t50, %edi
movl $w50, %esi
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/21329] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (3 preceding siblings ...)
2005-05-02 9:10 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
@ 2005-05-02 12:24 ` pinskia at gcc dot gnu dot org
2005-05-02 12:27 ` [Bug target/21329] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-02 12:24 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|rtl-optimization |target
Keywords| |missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/21329] [4.0/4.1 Regression] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (4 preceding siblings ...)
2005-05-02 12:24 ` [Bug target/21329] " pinskia at gcc dot gnu dot org
@ 2005-05-02 12:27 ` pinskia at gcc dot gnu dot org
2005-05-06 19:31 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-02 12:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-02 12:27 -------
Confirmed, a regression from 3.4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Known to fail| |4.0.0 4.1.0
Known to work| |3.4.0
Last reconfirmed|0000-00-00 00:00:00 |2005-05-02 12:27:23
date| |
Summary|optimize i386 block copy |[4.0/4.1 Regression]
| |optimize i386 block copy
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/21329] [4.0/4.1 Regression] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (5 preceding siblings ...)
2005-05-02 12:27 ` [Bug target/21329] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-06 19:31 ` cvs-commit at gcc dot gnu dot org
2005-05-18 19:09 ` [Bug target/21329] [4.0 " cvs-commit at gcc dot gnu dot org
2005-06-06 7:22 ` steven at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-06 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-06 19:31 -------
Subject: Bug 21329
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jakub@gcc.gnu.org 2005-05-06 19:31:17
Modified files:
gcc : ChangeLog
gcc/config/i386: i386.c
Log message:
2005-05-06 Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Jakub Jelinek <jakub@redhat.com>
PR target/21329
* config/i386/i386.c (ix86_expand_movmem): Don't use rep; movsb
for -Os if (movsl;)*(movsw;)?(movsb;)? sequence is shorter.
Don't use rep; movs{l,q} if the repetition count is really small,
instead use a sequence of movs{l,q} instructions.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8626&r2=2.8627
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.818&r2=1.819
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/21329] [4.0 Regression] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (6 preceding siblings ...)
2005-05-06 19:31 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-18 19:09 ` cvs-commit at gcc dot gnu dot org
2005-06-06 7:22 ` steven at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-18 19:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-18 19:09 -------
Subject: Bug 21329
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-rhl-branch
Changes by: jakub@gcc.gnu.org 2005-05-18 19:08:44
Modified files:
gcc : ChangeLog
gcc/config/i386: i386.c
Log message:
2005-05-06 Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Jakub Jelinek <jakub@redhat.com>
PR target/21329
* config/i386/i386.c (ix86_expand_movmem): Don't use rep; movsb
for -Os if (movsl;)*(movsw;)?(movsb;)? sequence is shorter.
Don't use rep; movs{l,q} if the repetition count is really small,
instead use a sequence of movs{l,q} instructions.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=2.7592.2.10.2.33&r2=2.7592.2.10.2.34
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.795.8.9&r2=1.795.8.10
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/21329] [4.0 Regression] optimize i386 block copy
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
` (7 preceding siblings ...)
2005-05-18 19:09 ` [Bug target/21329] [4.0 " cvs-commit at gcc dot gnu dot org
@ 2005-06-06 7:22 ` steven at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-06-06 7:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-06-06 07:22 -------
.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-06-06 7:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-02 8:59 [Bug rtl-optimization/21329] New: optimize i386 block copy vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:00 ` [Bug rtl-optimization/21329] " vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:02 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:04 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 9:10 ` vda at port dot imtp dot ilyichevsk dot odessa dot ua
2005-05-02 12:24 ` [Bug target/21329] " pinskia at gcc dot gnu dot org
2005-05-02 12:27 ` [Bug target/21329] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-06 19:31 ` cvs-commit at gcc dot gnu dot org
2005-05-18 19:09 ` [Bug target/21329] [4.0 " cvs-commit at gcc dot gnu dot org
2005-06-06 7:22 ` steven at gcc dot gnu dot org
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).