This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, i386] automatic MMX/x87 FPU mode switching (the realone)


Roger Sayle wrote:

I think your problems with reg-stack.c are caused by a misunderstanding
or overloading of the term "x87 registers are live".  There's a semantic
difference with stack registers between being available for use, and
actually holding a value.  reg-stack.c concerns itself with the latter,
and your code confuses it by telling it that an UNSPECV_EFPU pushes
all eight floating point values onto stack, and the UNSPECV_EMMS pops
everything off of the stack.

Presumably, if reload and flow.c have done their job, there should
be nothing to do in reg-stack.c, as the x87 stack should be empty at
both types of mode switching instructions. Instead, I think you need
to clobber all of the other register sets contents in these patterns,
to ensure this.


Roger,

after some debugging, it looks that convert_regs_exit and convert_regs_entry functions are emitting stack compensating code on its own. So, when we have 8 fp registers live at function entry, reg-stack.c fills register stack with NaNs. At the function exit, reg-stack.c looks for the number of needed registers by itself, and then tries to compensate register stack to fit into this. Indeed, the registers sets are empty at the EFPU/EMMS boundaries, otherwise we wouldn't get as far as _.33.stack with the compilation.
I was wandering, if it is possible to get away by reg-stack.c simply ignoring the fact that EFPU/EMMS somehow load all 8 registers. It works, but some other compensation hacks would be needed on funtion entry and function exit. Currently a couple of lines are needed to prevent entry/exit compensation code to outsmart us.
Unfortunatelly, there is one ICE left where reg-stack.c thinks that it processes malformed ASM - I'll look into it tomorrow.


Thanks,
Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]