[PATCH] Fix PR optimization/8746 (x86)

tm_gccmail@mail.kloo.net tm_gccmail@mail.kloo.net
Sat Mar 22 00:28:00 GMT 2003


On Fri, 21 Mar 2003, Eric Botcazou wrote:

> > Indeed.  And according to
> >
> >    1 0000 66F7C30400            testw   $4, %bx
> >    3 0008 F7C304000000          testl   $4, %ebx
> >
> > they're larger for HImode as well.  I'd support simply removing
> > these patterns entirely unless Jan can defend their existance.
> 
> My vague recollection of my x86 asm programming days tells me that it was not 
> recommended to mix 16-bit code with 32-bit code, but that mixing 8-bit code 
> with 32-bit code was ok (but this was probably for early Pentiums).

Yep.

If I remember correctly, the way the x86 moved from 16-bit registers to
32-bit registers was to add the 0x66 "opcode size" prefix which changes
the 16-bit instructions to 32-bit instructions or 32-bit instructions to
16-bit instructions, depending on the default size of the instruction as
specified in the TLB for that page, which most OSes set to default to
32-bits.

So, 8 and 32-bit instructions require no opcode prefix, but 16-bit
instructions require an extra byte.

Toshi



More information about the Gcc-patches mailing list