Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: gcrypt

[PATCH] Small fix for umul_ppmm on ARM

 

 

GnuPG gcrypt RSS feed   Index | Next | Previous | View Threaded


ken.werner at linaro

Dec 21, 2011, 9:18 AM

Post #1 of 3 (642 views)
Permalink
[PATCH] Small fix for umul_ppmm on ARM

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:
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=487fe72494051de4a7e513c15b6a895dcd0164ce#patch9

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

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

Best Regards,
Ken
--
1.7.5.4


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel


wk at gnupg

Dec 21, 2011, 11:51 AM

Post #2 of 3 (611 views)
Permalink
Re: [PATCH] Small fix for umul_ppmm on ARM [In reply to]

On Wed, 21 Dec 2011 18:18, ken.werner [at] linaro said:

> 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'

What cpp macro is defined for this architecure? I would feel better not
to change 10 years old code, if there is a way to avoid it.


Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel


ken.werner at linaro

Dec 21, 2011, 12:51 PM

Post #3 of 3 (607 views)
Permalink
Re: [PATCH] Small fix for umul_ppmm on ARM [In reply to]

On 12/21/2011 08:51 PM, Werner Koch wrote:
> On Wed, 21 Dec 2011 18:18, ken.werner [at] linaro said:
>
>> 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'
>
> What cpp macro is defined for this architecure? I would feel better not
> to change 10 years old code, if there is a way to avoid it.

$ arm-linux-gnueabi-cpp -march=armv5te -dM /dev/null|grep ARCH
#define __ARM_ARCH_5TE__ 1

However, initially I thought it's because of the inline assembly and I
wrote that tiny patch. But I just noticed when using the toolchain I've
got that even the following code:

unsigned int foo (unsigned int xh, unsigned int xl, unsigned int a,
unsigned int b) {
__asm__ ("%@ Inlined umul_ppmm\n"
"umull %r1, %r0, %r2, %r3"
: "=&r" (xh), "=&r" (xl)
: "r" (a), "r" (b)
: "r0", "r1");
return xl;
}

results in:
Assembler messages:
Error: selected processor does not support Thumb mode `umull r4,r5,r2,r3'

It doesn't occur when using the CSL 2011.03 for example. So, I suspect a
toolchain bug. I'll investigate further.

Regards,
Ken

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel

GnuPG gcrypt RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.