Steve, 
I could not get it...
The thing I see is that gcc can omit 'y' from rtl generation but very 
unlikely cause you assign a value to it before asm operator...

~d


On Friday 13 September 2002 20:52, Steve Underwood wrote:
> Dmitry wrote:
> >could you please be more specific?
> >Are they eliminated during code generatin phase?
> >Have you tried to make one of them as input?
> >
> >Only whole asm operator can be deleted by gcc. So, try to recombine
> > params.
>
> OK. Here is a specific example - a sqrt function from the 430 apps.
> book, turned into a C function. This version does not work. x and y get
> merged, and are no longer separate working variables inside the asm code.
>
> int32_t isqrt32(register int32_t h)
> {
>     register int32_t x;
>     register int32_t y;
>     register int16_t i;
>
>     x =
>     y = 0;
>     i = 32;
>     __asm__ (
>         "1: \n"
>         " setc \n"
>         " rlc    %A0 \n"
>         " rlc     %B0 \n"
>         " sub     %A0,%A1 \n"
>         " subc    %B0,%B1 \n"
>         " jhs    2f \n"
>         " add    %A0,%A1 \n"
>         " addc    %B0,%B1 \n"
>         " sub    #2,%A0 \n"
>         "2: \n"
>         " inc    %A0 \n"
>         " rla    %A2 \n"
>         " rlc    %B2 \n"
>         " rlc    %A1 \n"
>         " rlc    %B1 \n"
>         " rla    %A2 \n"
>         " rlc    %B2 \n"
>         " rlc    %A1 \n"
>         " rlc    %B1 \n"
>         " dec    %3 \n"
>         " jne    1b \n"
>
>         : "+r"(x), "+r"(y)
>         : "r"(h), "r"(i));
>
>     return  x;
> }
>
> The works. The values of x and y are now different as we enter the asm
> code, so GCC cannot coalesce them. It allocates two registers for x and
> another 2 for y. All is well, as setting the top bit of x happens to be
> harmless. It wastes code, though. It gets me around the immediate
> problem, but it obviously not the right way to do things.
>
> int32_t isqrt32(register int32_t h)
> {
>     register int32_t x;
>     register int32_t y;
>     register int16_t i;
>
>     x = 0x80000000;
>     y = 0;
>     i = 32;
>     __asm__ (
>         "1: \n"
>         " setc \n"
>         " rlc    %A0 \n"
>         " rlc     %B0 \n"
>         " sub     %A0,%A1 \n"
>         " subc    %B0,%B1 \n"
>         " jhs    2f \n"
>         " add    %A0,%A1 \n"
>         " addc    %B0,%B1 \n"
>         " sub    #2,%A0 \n"
>         "2: \n"
>         " inc    %A0 \n"
>         " rla    %A2 \n"
>         " rlc    %B2 \n"
>         " rlc    %A1 \n"
>         " rlc    %B1 \n"
>         " rla    %A2 \n"
>         " rlc    %B2 \n"
>         " rlc    %A1 \n"
>         " rlc    %B1 \n"
>         " dec    %3 \n"
>         " jne    1b \n"
>
>         : "+r"(x), "+r"(y)
>         : "r"(h), "r"(i));
>
>     return  x;
> }
>
>
> Regards,
> Steve
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

-- 
*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************



Reply via email to