[PATCH] Small fix for umul_ppmm on ARM

Ken Werner ken.werner at linaro.org
Wed Dec 21 18:18:44 CET 2011

Hi There,

Currently the definition of umul_ppmm (longlong.h) looks like this:
#define umul_ppmm(xh, xl, a, b)                                         \
  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
           "umull %r1, %r0, %r2, %r3"                                   \
                   : "=&r" ((USItype)(xh)),                             \
                     "=r" ((USItype)(xl))                               \
                   : "r" ((USItype)(a)),                                \
                     "r" ((USItype)(b))                                 \
                   : "r0", "r1")

This code generates the following assembler error message when compiling
for -march=armv5te:
  Error: selected processor does not support Thumb mode `umull r5,ip,r5,r3'

In ARM mode the input register of the umull must be different from the output
register. This limitation does not exists for the Thumb mode but in my case
the compiler was restricted to ARMv5 that doesn't support Thumb.

One way to fix this would be to mark "xl" as early clobbered.

The code was introduced by this patch:

Ken Werner (1):
  Mark 'xl' as early clobbered

 mpi/longlong.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Best Regards,

More information about the Gcrypt-devel mailing list