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]

Re: asm ("...") on PPC


>>>>> "Geir" == Geir Frode Raanes <geirfrs@invalid.ed.ntnu.no> writes:

    Geir> I am attemting to create the tightest loop possible on my
    Geir> PowerPC (MBX860 PowerQUICC,) copying data from a memory
    Geir> mapped IO region to actual RAM.

[snip]

    Geir>         mfspr 0,638
    Geir>         stw 0,0(11)        <- Almost same thing.
    Geir>                               Apart from the [u]pdate flag;
    Geir>                                i.e. EA[0(r11)] -> r11
    Geir>         addis 9,0,ioptr@ha <- What's this for addressing mode
    Geir>         addi 11,9,ioptr@l  <- And this? Lot's of "@ha" and "@l"
    Geir>         mfspr 0,638 stw 0,0(11) <- Almost same thing.  Apart


The @ha and @l are the high and low 16 bits of the ioptr.  Immediate
instructions can only load 16 bits of data.

I would suggest that you don't use the label linejeloop.  I would use 
the 'local labels'.  Like 10: and then 'bdnz+ 10b'.  Sorry if that isn't 
PPC assembler I have coded on the ARM and AVR since my PPC days.

opps... I have to ask this, did you put line-feeds in the string?
Here is a version that I think might work.

    asm volatile ("    mtctr %3     \n"         /* crt = linjeteller */
                  "    subi %0,4    \n"         /* ioptr--  */
                  "    subi %1,4    \n"         /* memptr-- */
                  "10: lwzu r9,4(%0)\n"         /* get source [++ioptr] */
                  "    stwu r9,4(%1)\n"         /* store target [++memptr] */
                  "    bdnz+ 10b    \n"         /* loop until crt == 0 */ "
    : "=b" (ioptr), "=b" (memptr)
    :  "0" (ioptr),  "1" (memptr), "r" (linjeteller)
    : "r9", "ctr" );

I think that might be the problem.

hth,
Bill


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