Can anybody explain the code generated for this function?

#include <io.h>

unsigned two;

void foo(void)
{
  two = P6IN + P6IN;
}


  21                    foo:

  26 0000 5F42 3400             mov.b   &0x0034, r15
  27 0004 4E4F                  mov.b   r15, r14
  28 0006 5F42 3400             mov.b   &0x0034, r15
  29 000a 7FF3                  and.b   #-1,r15
  30 000c 0E5F                  add     r15, r14
  31 000e 824E 0000             mov     r14, &two 
  32 0012 3041                  ret

Why the extra mov.b?

Why the and.b?

Why isn't this correct?

        mov.b   &0x0034, r15
        mov.b   &0x0034, r14
        add     r15, r14
        mov     r14, &two 
        ret

-- 
Grant Edwards                   grante             Yow!  Now that I have my
                                  at               "APPLE", I comprehend COST
                               visi.com            ACCOUNTING!!


Reply via email to