lynx.abraxas@xxxxxxxxxx writes: > On 24/03/07 11:11:52, Andrew Haley wrote: > > > I got a bit further with my problem. Now I'm stuck on how to save > > > the register used when -fPIC is enabled to the stack before my > > > seven input operands, needing all registers, get loaded. Is that > > > somehow possible? I couldn't find any examples on the net. It seems > > > not to be necessary in the original code for MSC. > > > > I doubt very much thath is possible. > > Thanks for Your answer. I then wonder why gcc doesn't let me load > the registers from the memory myself. > If I do eg: > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > sint32 startX, endX; > __asm__ __volatile__ ( > "push %%ebx \n\t" // save reg for PIC! > //code here using %1 but now reg can be rused: > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > //but now gcc says: > //error: memory input 5 is not directly addressable > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > //because m for %5 didn't work here > > //more code using also ebx and ebp > "pop %%ebx \n\t" // restore reg for PIC! > : > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > ); > > gcc complains about: error: memory input 5 is not directly addressable > Why is that? How else should I load the tileData pointer from > memory into a register? I wouldn't be using the "m" constraint for this. Pass in the pointer as an operand using constraint "r" or "g". Something like "g"(&tileData); Can you post some small sample code? Make it the shortest possible programs that shows your problem. Make sure all the types it needs are defined. > > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > > > I guess this is a joke. > > No, it isn't. I wouldn't have asked else wise... Reload has run out of registers. It's telling you that it needs another one. A -f option is not going to give reload another register. > Is it the combination of all -f options in -O2? I coudn't find a > single obviouse one in the manpage. Is it a rule then to include > -O2 or higher if inline asm is used??? No, there's no such rule. You've run out of registers. gcc needs one or two spare registers to work with. The x86 has eight, some of which are used for special purposes. You are using five in your asm. This is a very tight situation. Andrew.