[PATCH] fix register constraints in fp_montgomery_reduce

37 views
Skip to first unread message

Patrick

unread,
Jul 21, 2010, 10:07:11 PM7/21/10
to lib...@googlegroups.com
Constraining _c[0] to memory only causes the following gcc warning:

fp_montgomery_reduce.c:470: warning: matching constraint does not allow a register.

-Patrick

---
usr/e7/crypt/tfm/src/mont/fp_montgomery_reduce.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/e7/crypt/tfm/src/mont/fp_montgomery_reduce.c b/usr/e7/crypt/tfm/src/mont/fp_montgomery_reduce.c
index 73f82ad..f8188a2 100644
--- a/usr/e7/crypt/tfm/src/mont/fp_montgomery_reduce.c
+++ b/usr/e7/crypt/tfm/src/mont/fp_montgomery_reduce.c
@@ -331,7 +331,7 @@ asm( \
" addc 16,16,18 \n\t" \
" addze %0,17 \n\t" \
" stw 16,%1 \n\t" \
-:"=r"(cy),"=m"(_c[0]):"0"(cy),"r"(mu),"r"(tmpm[0]),"1"(_c[0]):"16", "17", "18","%cc"); ++tmpm;
+:"=r"(cy),"=g"(_c[0]):"0"(cy),"r"(mu),"r"(tmpm[0]),"1"(_c[0]):"16", "17", "18","%cc"); ++tmpm;

#define PROPCARRY \
asm( \
@@ -340,7 +340,7 @@ asm( \
" stw 16,%1 \n\t" \
" xor %0,%0,%0 \n\t" \
" addze %0,%0 \n\t" \
-:"=r"(cy),"=m"(_c[0]):"0"(cy),"1"(_c[0]):"16","%cc");
+:"=r"(cy),"=g"(_c[0]):"0"(cy),"1"(_c[0]):"16","%cc");

/******************************************************************/
#elif defined(TFM_PPC64)
--
1.7.1.1

Patrick Oppenlander

unread,
Jul 21, 2010, 9:55:07 PM7/21/10
to lib...@googlegroups.com, Patrick Oppenlander
As of gcc 4.3.2 constraining _c[0] to memory only causes the following:

fp_montgomery_reduce.c:470: warning: matching constraint does not allow a register.

---

Steffen Jaeckel

unread,
Jul 22, 2010, 4:51:45 AM7/22/10
to Patrick Oppenlander, lib...@googlegroups.com
thanks alot patrick!

I've integrated your patch already and pushed to

http://github.com/sjaeckel/tomsfastmath

Steffen

Reply all
Reply to author
Forward
0 new messages