This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MS/CW-style inline assembly for GCC


For reference, the code on the x86 should look something like
(in Intel syntax):

     lp:   mov  eax, [ebx]
           adc  eax, [ecx]
           inc  ebx
           inc  ecx
           loop lp

By the way, this loop is precisely the reason that inc does
not clobber CF :-)

If you can write:

  do
    {
      ul = *up++;
      vl = *vp++;
      sl = ul + vl;
      cy1 = sl < ul;
      rl = sl + cy;
      cy2 = rl < sl;
      cy = cy1 | cy2;
      *rp++ = rl;
    }
  while (--n != 0);

in C, and get the above ASM, I am impressed, but I still
find the ASM easier to read :-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]