Disabling x87 instructions in -O3 X86_64 sse enabled code

Rask Ingemann Lambertsen rask@sygehus.dk
Tue Aug 29 21:19:00 GMT 2006


On Tue, Aug 29, 2006 at 06:23:52PM +0100, Alex Bennee wrote:

> However I'm under the
> impression gcc shouldn't be generating any x87 code unless explicitly
> enabled.

   There's an undocumented option -mno-80387 (at least in GCC 4.2).
 
> I also tried:
>  -ffixed-st0 -ffixed-st1 -ffixed-st2 -ffixed-st3 -ffixed-st4 -ffixed-st5
> -ffixed-st6 -ffixed-st7
> 
> To try and force the x87 floating point registers from being used.
> Unfortunately gcc didn't recognise the registers and I couldn't find the
> REGISTER_NAMES macro definition in the sources for what the correct
> incantation was.

   From gcc/config/i386/i386.h (still GCC 4.2, but I doubt this is much
different in GCC 4.1):

#define HI_REGISTER_NAMES                                               \
{"ax","dx","cx","bx","si","di","bp","sp",                               \
 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)",          \
 "argp", "flags", "fpsr", "dirflag", "frame",                           \
 "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",               \
 "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" ,               \
 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",                  \
 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}

#define REGISTER_NAMES HI_REGISTER_NAMES

#define ADDITIONAL_REGISTER_NAMES \
{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 },       \
  { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 },       \
  { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 },       \
  { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 },       \
  { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 },           \
  { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }

-- 
Rask Ingemann Lambertsen



More information about the Gcc-help mailing list