>Hopefully it now works, but there might be 1 in 2**32 (or 1 in 2**64)
>cases where it still doesn't

That change didn't seem to produce the goods on its own.  I've ended up with 
this, 
which works for the cases I tested.

#if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
#define umul_ppmm(xh, xl, a, b) \
  do {                                                                  \
        register USItype i0, i1, i2;                                    \
  __asm__ ("%@ Inlined umul_ppmm
        mov     %2, %5, lsr #16         @ AAAA
        mov     %4, %6, lsr #16         @ BBBB
        bic     %3, %5, %2, lsl #16     @ aaaa
        bic     %0, %6, %4, lsl #16     @ bbbb
        mul     %1, %3, %4              @ aaaa * BBBB
        mul     %4, %2, %4              @ AAAA * BBBB
        mul     %3, %0, %3              @ aaaa * bbbb
        mul     %0, %2, %0              @ AAAA * bbbb
        adds    %2, %1, %0
        addcs   %4, %4, #65536
        adds    %1, %3, %2, lsl #16
        adc     %0, %4, %2, lsr #16"                                    \
           : "=&r" ((USItype)(xh)),                                     \
             "=r" ((USItype)(xl)),                                      \
             "=&r" ((USItype)(i0)),                                     \
             "=&r" ((USItype)(i1)),                                     \
             "=&r" ((USItype)(i2)),                                     \
           : "r" ((USItype)(a)),                                        \
             "r" ((USItype)(b)));                                       \
  } while (0)
#else
#define umul_ppmm(xh, xl, a, b) \
  __asm__ ("%@ Inlined umul_ppmm
        umull   %r1, %r0, %r2, %r3" \
                   : "=&r" ((USItype)(xh)), \
                     "=r" ((USItype)(xl)) \
                   : "r" ((USItype)(a)), \
                     "r" ((USItype)(b)) \
                   : "r0", "r1")
#endif

I'll dispatch this to the BTS.

p.



Reply via email to