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

Jan Hubicka <> writes:

> Hi, i386.h is currently allowing DImode in the SSE2/MMX registers.
> This appears to be source of problems for me, because gcc sometimes
> decides to use SSE registers for integer work.  The problem does not
> appear to be in register preferences, as SSE gets as expensive as
> memory there, but it seems to come from reload, for instance
> find_valid_class, that simply discover SSE_INT_REGS as valid for
> DImode (with SSE2 allowed).
> This usually results in unmatched insn, but sometimes in crash.
> Do you have any idea how to handle this?

Write appropriate insns?  Fix the crashes?

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.

> 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.

It might also be that we need to teach reload to check whether a sum
is a valid insn...

- Geoffrey Keating <>

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