[PATCH] fix i386 memcpy
Denis Vlasenko
vda@port.imtp.ilyichevsk.odessa.ua
Tue Mar 29 23:55:00 GMT 2005
This patch shortens non-constant memcpy() by two bytes
and fixes spurious out-of-line constant memcpy().
Patch is run-tested (I run on patched kernel right now).
Benchmark and code generation test program will be mailed as reply.
# size vmlinux.org vmlinux
text data bss dec hex filename
3954591 1553426 236544 5744561 57a7b1 vmlinux.org
3952615 1553426 236544 5742585 579ff9 vmlinux
Example of changes (part of dump_fpu() body):
old.............................................. new......................
8d 83 40 02 00 00 lea 0x240(%ebx),%eax 8d b3 40 02 00 00 lea 0x240(%ebx),%esi
74 31 je c0108b27 <dump_fpu+0x9c> 74 2e je c0108b1d <dump_fpu+0x92>
6a 1c push $0x1c 8b 7d 0c mov 0xc(%ebp),%edi
50 push %eax b9 07 00 00 00 mov $0x7,%ecx
56 push %esi f3 a5 repz movsl %ds:(%esi),%es:(%edi)
e8 49 21 10 00 call c020ac48 <memcpy> 8b 55 0c mov 0xc(%ebp),%edx
83 c4 0c add $0xc,%esp 83 c2 1c add $0x1c,%edx
83 c6 1c add $0x1c,%esi 8d 83 60 02 00 00 lea 0x260(%ebx),%eax
81 c3 60 02 00 00 add $0x260,%ebx b9 07 00 00 00 mov $0x7,%ecx
bf 07 00 00 00 mov $0x7,%edi 89 d7 mov %edx,%edi
6a 0a push $0xa 89 c6 mov %eax,%esi
53 push %ebx a5 movsl %ds:(%esi),%es:(%edi)
56 push %esi a5 movsl %ds:(%esi),%es:(%edi)
e8 2f 21 10 00 call c020ac48 <memcpy> 66 a5 movsw %ds:(%esi),%es:(%edi)
83 c4 0c add $0xc,%esp 83 c2 0a add $0xa,%edx
83 c6 0a add $0xa,%esi 83 c0 10 add $0x10,%eax
83 c3 10 add $0x10,%ebx 49 dec %ecx
4f dec %edi 79 ef jns c0108b0a <dump_fpu+0x7f>
79 eb jns c0108b10 <dump_fpu+0x85> eb 0a jmp c0108b27 <dump_fpu+0x9c>
eb 0c jmp c0108b33 <dump_fpu+0xa8> 8b 7d 0c mov 0xc(%ebp),%edi
6a 6c push $0x6c b9 1b 00 00 00 mov $0x1b,%ecx
50 push %eax f3 a5 repz movsl %ds:(%esi),%es:(%edi)
56 push %esi 8b 45 f0 mov 0xfffffff0(%ebp),%eax
e8 18 21 10 00 call c020ac48 <memcpy> 5a pop %edx
83 c4 0c add $0xc,%esp 5b pop %ebx
8b 45 f0 mov 0xfffffff0(%ebp),%eax
8d 65 f4 lea 0xfffffff4(%ebp),%esp
5b pop %ebx
5e pop %esi
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string.memcpy.diff
Type: text/x-diff
Size: 2953 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050329/9feb557f/attachment.bin>
More information about the Gcc
mailing list