This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Generate xlat insn
On 9/25/07, Jakub Jelinek <jakub@redhat.com> wrote:
> > > > This small patch implements xlat insn. With attached patch,
> > > > following testcase:
> Even the code size reduction is not present.
> Compare:
>
> 00000000 <test>:
> 0: 0f b6 44 24 04 movzbl 0x4(%esp),%eax
> 5: 8a 80 00 00 00 00 mov 0x0(%eax),%al
> 7: R_386_32 table
> b: c3 ret
>
> 0000000c <test2>:
> c: 0f b6 44 24 04 movzbl 0x4(%esp),%eax
> 11: 8b 15 00 00 00 00 mov 0x0,%edx
> 13: R_386_32 table
> 17: 8a 04 02 mov (%edx,%eax,1),%al
> 1a: c3 ret
>
> 0000001b <test3>:
> 1b: 53 push %ebx
> 1c: 0f b6 44 24 04 movzbl 0x4(%esp),%eax
> 21: 8b 1d 00 00 00 00 mov 0x0,%ebx
> 23: R_386_32 table
> 27: d7 xlat %ds:(%ebx)
> 28: 5b pop %ebx
> 29: c3 ret
Indeed. Some targets (default i686) generate a byte longer movzbl
instead of movb.
> From what I can see, the first one (which GCC doesn't generate for -Os,
> why?) is 3 bytes smaller than the one with xlat. And 3 byte movb
IMO, ix86_address_cost has to be tuned for -Os to prefer base+index
addressing mode.
Uros.