[PATCH v2 05/32] mpi: Use %o5 instead of %g2 in the SPARC V7 umul_ppmm.
Matt Turner
mattst88 at gmail.com
Wed Nov 25 21:19:42 CET 2026
* mpi/longlong.h [__sparc__] (umul_ppmm): Use %o5 instead of %g2 as
the scratch register.
--
The SPARC ABI reserves %g2 for the application, and code built with
-mno-app-regs must not use it. GCC made the same change to its copy
of longlong.h in commit 021b3949590, whose ChangeLog entry reads "Also
don't clobber %g2 register in 32bit SPARC assembly, so that
-mno-app-regs libgcc can be compiled."
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
mpi/longlong.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mpi/longlong.h b/mpi/longlong.h
index 685e26e0..3ca473e0 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -1163,8 +1163,8 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
# define umul_ppmm(w1, w0, u, v) \
__asm__ ("! Inlined umul_ppmm \n" \
" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr \n" \
- " sra %3,31,%%g2 ! Don't move this insn \n" \
- " and %2,%%g2,%%g2 ! Don't move this insn \n" \
+ " sra %3,31,%%o5 ! Don't move this insn \n" \
+ " and %2,%%o5,%%o5 ! Don't move this insn \n" \
" andcc %%g0,0,%%g1 ! Don't move this insn \n" \
" mulscc %%g1,%3,%%g1 \n" \
" mulscc %%g1,%3,%%g1 \n" \
@@ -1199,13 +1199,13 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
" mulscc %%g1,%3,%%g1 \n" \
" mulscc %%g1,%3,%%g1 \n" \
" mulscc %%g1,0,%%g1 \n" \
- " add %%g1,%%g2,%0 \n" \
+ " add %%g1,%%o5,%0 \n" \
" rd %%y,%1" \
: "=r" __ll_check_output (USItype, w1), \
"=r" __ll_check_output (USItype, w0) \
: "%rI" ((USItype)(u)), \
"r" ((USItype)(v)) \
- : "%g1", "%g2" __AND_CLOBBER_CC)
+ : "%g1", "%o5" __AND_CLOBBER_CC)
# define UMUL_TIME 39 /* 39 instructions */
# endif /* umul_ppmm */
# ifndef udiv_qrnnd
--
2.56.1
More information about the Gcrypt-devel
mailing list