1/* AMD64 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
2   the result from a second limb vector.
3   Copyright (C) 2004 Free Software Foundation, Inc.
4   This file is part of the GNU MP Library.
5
6   The GNU MP Library is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or (at your
9   option) any later version.
10
11   The GNU MP Library is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public License
17   along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
18   the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19   MA 02111-1307, USA. */
20
21#include "sysdep.h"
22#include "asm-syntax.h"
23
24	.text
25ENTRY (__mpn_submul_1)
26	movq	%rdx, %r11
27	leaq	(%rsi,%r11,8), %rsi
28	leaq	(%rdi,%r11,8), %rdi
29	negq	%r11
30	xorl	%r8d, %r8d
31	.p2align 3
32L(loop):
33	movq	(%rsi,%r11,8), %rax
34	movq	(%rdi,%r11,8), %r10
35	mulq	%rcx
36	subq	%r8, %r10
37	movl	$0, %r8d
38	adcl	%r8d, %r8d
39	subq	%rax, %r10
40	adcq	%rdx, %r8
41	movq	%r10, (%rdi,%r11,8)
42	incq	%r11
43	jne	L(loop)
44	movq	%r8, %rax
45	ret
46END (__mpn_submul_1)
47