[Bug rtl-optimization/21329] optimize i386 block copy

2005-05-02 Thread vda at port dot imtp dot ilyichevsk dot odessa dot ua

--- 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=8790action=view)
testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329


[Bug rtl-optimization/21329] optimize i386 block copy

2005-05-02 Thread vda at port dot imtp dot ilyichevsk dot odessa dot ua

--- 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=8791action=view)
patch against 4.0.0


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329


[Bug rtl-optimization/21329] optimize i386 block copy

2005-05-02 Thread vda at port dot imtp dot ilyichevsk dot odessa dot ua

--- 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
movlw10, %eax
movl%eax, t10
movlw20, %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


[Bug rtl-optimization/21329] optimize i386 block copy

2005-05-02 Thread vda at port dot imtp dot ilyichevsk dot odessa dot ua

--- 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