This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I am attemting to create the tightest loop possible on my PowerPC (MBX860 PowerQUICC,) copying data from a memory mapped IO region to actual RAM. For this I intend to use inline assembly as it seems that GCC does not make use of the dedicated loop count register (CRT.) I will copy from address "ioptr" to address "memptr." In other words I try to write the following C code in assembly: unsigned int linjeteller = 0xFF, *ioptr, *memptr; do { *memptr++ = *ioptr++; } while (linjeteller--); /* FF -> 00 == 256 Words == 1 KByte */ The equivalent of the above code should be something like: asm volatile ("mtctr %3 /* crt = linjeteller */ subi %0,4 /* ioptr-- */ subi %1,4 /* memptr-- */ linjeloop: lwzu r9,4(%0); /* get source [++ioptr] */ stwu r9,4(%1); /* store target [++memptr] */ bdnz+ linjeloop /* loop until crt == 0 */ " : "=b" (ioptr), "=b" (memptr) : "0" (ioptr), "1" (memptr), "r" (linjeteller) : "r9", "ctr" ); Which produces the result I expect in a separate .c file, but is completely ignored inside the larger actual .c file, even with optimalization turned off. The compiler knows it's there because if I deliberately insert errors into the above expression GCC complains. Oh well - I'll figure that one out later. Now, I get the result I expect. Unfortunately, this code is not accepteable for PPC/vxWorks/GAS. This is what I get: mtctr 4 subi 3,4 <- "Error: missing operand" Fix: subi 3,0,4 subi 4,4 <- "Error: missing operand" Fix: subi 4,0,4 linjeloop: lwzu r9,4(3) <- "Error: unsupported relocation type" ??? stwu r9,0,4(4) <- "Error: unsupported relocation type" ??? bdnz+ linjeloop "Error: unsupported relocation type" But this is supposed to be correct code according to the PowerPC manual. What is GAS really complaining about here? The following is what GCC produced: (with: asm ("mfspr %0,%1" : "=r" (IMMREG) : "i" (638));) mfspr 0,638 stw 0,0(11) <- Almost same thing. Apart from the [u]pdate flag; i.e. EA[0(r11)] -> r11 addis 9,0,ioptr@ha <- What's this for addressing mode addi 11,9,ioptr@l <- And this? Lot's of "@ha" and "@l" I really don't know what syntax GAS expects so I could use some help here. Also, I would like someone to confirm that my asm ("instruction" : OUT : IN : AFFECTED ) settings are correct for the load/store with Effective address [u]pdate case above. -- ****************************************************** Never ever underestimate the power of human stupidity. -Robert Anson Heinlein GeirFRS@invalid.and.so.forth ****************************************************** ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |