Author mark.dickinson
Recipients christian.heimes, gregsmith, loewis, mark.dickinson, pitrou, rhettinger, sopoforic, tim.peters
Date 2009-10-24.09:23:13
SpamBayes Score 0.123821
Marked as misclassified No
Message-id <1256376195.38.0.79577326477.issue1087418@psf.upfronthosting.co.za>
In-reply-to
Content
Here's the inline assembly version, for comparison:

#define SUM2_BIN64(sumhigh, sumlow, ahigh, alow, bhigh, blow)    \
  __asm__ ("addq\t%5, %1\n\t"                                    \
           "adcq\t%3, %0"                                        \
           : "=r" (sumhigh), "=&r" (sumlow)                      \
           : "0" ((uint64_t)(ahigh)), "rm" ((uint64_t)(bhigh)),  \
             "%1" ((uint64_t)(alow)), "rm" ((uint64_t)(blow))    \
           : "cc")

void
add_128_asm(uint64_t *sumhigh, uint64_t *sumlow,
           uint64_t ahigh, uint64_t alow,
           uint64_t bhigh, uint64_t blow)
{
  SUM2_BIN64(ahigh, alow, ahigh, alow, bhigh, blow);
  *sumlow = alow;
  *sumhigh = ahigh;
}

And the generated output (again gcc-4.4 with -O3):

_add_128_asm:
LFB1:
        pushq   %rbp
LCFI2:
# 29 "test.c" 1
        addq    %r9, %rcx
        adcq    %r8, %rdx
# 0 "" 2
        movq    %rsp, %rbp
LCFI3:
        movq    %rcx, (%rsi)
        movq    %rdx, (%rdi)
        leave
        ret
History
Date User Action Args
2009-10-24 09:23:15mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, loewis, gregsmith, rhettinger, pitrou, christian.heimes, sopoforic
2009-10-24 09:23:15mark.dickinsonsetmessageid: <1256376195.38.0.79577326477.issue1087418@psf.upfronthosting.co.za>
2009-10-24 09:23:13mark.dickinsonlinkissue1087418 messages
2009-10-24 09:23:13mark.dickinsoncreate