Hi !
I've found that latest GCC versions (past 4.0.0 and up to latest in CVS
head) never use 'movd %genreg, %mmxreg' to load mmx registers and always
insists doing it through memory eq.
'mov %genreg, (mem)'
'movd (mem), %mmxreg'
Older GCC versions do the same thing directly, without involving memory.
These dummy uses of memory do not come out with with different
optimization switches I've tried. After digging in GCC source code I
found that:
gcc/config/i386/i386.c:
int ix86_secondary_memory_needed (enum reg_class class1, enum reg_class
class2, enum machine_mode mode, int strict)
...
/* ??? This is a lie. We do have moves between mmx/general, and for
mmx/sse2.
But by saying we need secondary memory we discourage the register allocator
from using the mmx registers unless needed. */
if (MMX_CLASS_P (class1) != MMX_CLASS_P (class2)) return true;
...
If I comment out that "if" line, mmx register assignments from general
registers will work.
So, my question is: Should this requirement of using secondary memory to
move MMX registers between general regs be relaxed ?
I do not see the point why you should discourage the register allocator
from using mmx registers, move through memory is clearly inefficent and
enlarges resulting code (if the function containing moves is inlined in
several places, even more so).
What would be the correct code for MMX part of
ix86_secondary_memory_needed() function.
Regards,
Vahur