Blame sysdeps/powerpc/powerpc32/mul_1.S

Packit 6c4009
/* Multiply a limb vector by a limb, for PowerPC.
Packit 6c4009
   Copyright (C) 1993-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
Packit 6c4009
/* mp_limb_t mpn_mul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr,
Packit 6c4009
                        mp_size_t s1_size, mp_limb_t s2_limb)
Packit 6c4009
   Calculate s1*s2 and put result in res_ptr; return carry.  */
Packit 6c4009
Packit 6c4009
ENTRY (__mpn_mul_1)
Packit 6c4009
	mtctr	r5
Packit 6c4009
Packit 6c4009
	lwz	r0,0(r4)
Packit 6c4009
	mullw	r7,r0,r6
Packit 6c4009
	mulhwu	r10,r0,r6
Packit 6c4009
	addi	r3,r3,-4		# adjust res_ptr
Packit 6c4009
	addic	r5,r5,0			# clear cy with dummy insn
Packit 6c4009
	bdz	L(1)
Packit 6c4009
Packit 6c4009
L(0):	lwzu	r0,4(r4)
Packit 6c4009
	stwu	r7,4(r3)
Packit 6c4009
	mullw	r8,r0,r6
Packit 6c4009
	adde	r7,r8,r10
Packit 6c4009
	mulhwu	r10,r0,r6
Packit 6c4009
	bdnz	L(0)
Packit 6c4009
Packit 6c4009
L(1):	stw	r7,4(r3)
Packit 6c4009
	addze	r3,r10
Packit 6c4009
	blr
Packit 6c4009
END (__mpn_mul_1)