This is the mail archive of the 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]

Re: SSE/MMX leaking to the integer code

> Write appropriate insns?  Fix the crashes?
Actually I don't want to write the insns (to allow SSE code to work),
since by default, the SSE instructions probably should not be automatically
generated in the integer code.  This is no-no for kernel developers
(who may still want to use the SSE builtins when they know SSE is allowed)
and in the integer programs it would cause the context switches to be
expensive, that is believed to hurt overall system performance, even when
I've never seen real data about that.
> Often when reload does this sort of thing, it is actually the most
> efficient choice, because the alternative is to spill some other
> register(s) to memory and then reload them again, so it costs two
> memory operations plus the actual work.
The REG->SSE->REG move is more expensive than REG->mem->REG.
> > In fact, in the longer term, I would love to allow both DI and
> > SImode values in SSE/MMX and teach gcc to use it when it runs out of
> > integer registers and special flag is used.  With my regclass
> > inheritance patches it is possible (and possibly with new regalloc),
> > but it appears to run into different problem - sometimes move from
> > eliminable register to SSE appears and then reload constructs an
> > "lea" pattern, but with SSE destination, that dies, since SSE is not
> > able to sum.
> > 
> > Is there some way around?
> Another thing to consider is that perhaps PREFERRED_RELOAD_CLASS or
> LIMIT_RELOAD_CLASS or one of those knobs could help.  It's unlikely
> that reload is starting with SSE_INT_REGS, it's probably starting with
> something like GENERAL_REGS or ANY_REGS and discovering that a SSE
> register fits.
Actually the find_valid_class is not limited by any such macro to my
understnanding.  But limiting PREFERRED_RELOAD_CLASS is definitly good idea.
We don't want to get constants loaded to SSE registers for integer operations.

Interestingly enought, the find_valid_class is used only when SUBREG
has invalid outer mode for given register, that should not happen on i386.
I probably need to try write smaller testcase and more understand what is
going on. It appears to be dificult to distile something small enought
to investigate in detail.
> It might also be that we need to teach reload to check whether a sum
> is a valid insn...
This appears to be dificult to do to me, the reloads are emitted by the official
chains and these are never verified and done later, so reload would need
some way to backtrace, that sounds nasty.

> -- 
> - Geoffrey Keating <>

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