[PATCH v2 07/32] mpi: Use __builtin_alpha_umulh in the Alpha umul_ppmm.

Matt Turner mattst88 at gmail.com
Wed Nov 25 21:19:44 CET 2026


* mpi/longlong.h [__alpha] (umul_ppmm): Use __builtin_alpha_umulh
instead of asm.

--

GCC folds __builtin_alpha_umulh into a MULT_HIGHPART_EXPR, so the
optimizers can see through it, which they cannot do with asm.  GCC
made the same change to its copy of longlong.h in commit 496e1c4bdf3
("longlong.h (umul_ppmm) [alpha]: Use __builtin_alpha_umulh.").

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 mpi/longlong.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mpi/longlong.h b/mpi/longlong.h
index a09dc491..dc85775c 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -140,10 +140,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
 # define umul_ppmm(ph, pl, m0, m1) \
   do {									\
     UDItype __m0 = (m0), __m1 = (m1);					\
-    __asm__ ("umulh %r1,%2,%0"                                          \
-	     : "=r" __ll_check_output (UDItype, ph)                     \
-	     : "%rJ" (__m0),                                            \
-	       "rI" (__m1));                                            \
+    (ph) = __builtin_alpha_umulh (__m0, __m1);				\
     (pl) = __m0 * __m1; 						\
   } while (0)
 # define UMUL_TIME 46

-- 
2.56.1



More information about the Gcrypt-devel mailing list