Blame mpn/x86_64/missing-inline.m4

Packit 5c3484
dnl  AMD64 MULX/ADX simulation support, inline version.
Packit 5c3484
Packit 5c3484
dnl  Contributed to the GNU project by Torbjörn Granlund.
Packit 5c3484
Packit 5c3484
dnl  Copyright 2013 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
dnl  This file is part of the GNU MP Library.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
dnl  it under the terms of either:
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
dnl      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
dnl      option) any later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU General Public License as published by the Free Software
Packit 5c3484
dnl      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
dnl      later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or both in parallel, as here.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
dnl  for more details.
Packit 5c3484
dnl
Packit 5c3484
dnl  You should have received copies of the GNU General Public License and the
Packit 5c3484
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
dnl  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
Packit 5c3484
define(`adox',`
Packit 5c3484
	push	$2
Packit 5c3484
	push	%rcx
Packit 5c3484
	push	%rbx
Packit 5c3484
	push	%rax
Packit 5c3484
	mov	$1, %rcx
Packit 5c3484
	pushfq
Packit 5c3484
	pushfq
Packit 5c3484
C copy 0(%rsp):11 to 0(%rsp):0
Packit 5c3484
	mov	(%rsp), %rbx
Packit 5c3484
	shr	%rbx
Packit 5c3484
	bt	$`'10, %rbx
Packit 5c3484
	adc	%rbx, %rbx
Packit 5c3484
	mov	%rbx, (%rsp)
Packit 5c3484
C put manipulated flags into eflags, execute a plain adc
Packit 5c3484
	popfq
Packit 5c3484
	adc	%rcx, 32(%rsp)
Packit 5c3484
C copy CF to 0(%rsp):11
Packit 5c3484
	mov	(%rsp), %rbx
Packit 5c3484
	sbb	R32(%rax), R32(%rax)
Packit 5c3484
	and	$`'0x800, R32(%rax)
Packit 5c3484
	and	$`'0xfffffffffffff7ff, %rbx
Packit 5c3484
	or	%rax, %rbx
Packit 5c3484
	mov	%rbx, (%rsp)
Packit 5c3484
C put manipulated flags into eflags
Packit 5c3484
	popfq
Packit 5c3484
	pop	%rax
Packit 5c3484
	pop	%rbx
Packit 5c3484
	pop	%rcx
Packit 5c3484
	pop	$2
Packit 5c3484
')
Packit 5c3484
Packit 5c3484
define(`adcx',`
Packit 5c3484
	push	$2
Packit 5c3484
	push	%rcx
Packit 5c3484
	push	%rbx
Packit 5c3484
	push	%rax
Packit 5c3484
	mov	$1, %rcx
Packit 5c3484
	pushfq
Packit 5c3484
	adc	%rcx, 32(%rsp)
Packit 5c3484
	mov	(%rsp), %rbx
Packit 5c3484
	sbb	R32(%rax), R32(%rax)
Packit 5c3484
	and	$`'0xfffffffffffffffe, %rbx
Packit 5c3484
	sub	%rax, %rbx
Packit 5c3484
	mov	%rbx, (%rsp)
Packit 5c3484
	popfq
Packit 5c3484
	pop	%rax
Packit 5c3484
	pop	%rbx
Packit 5c3484
	pop	%rcx
Packit 5c3484
	pop	$2
Packit 5c3484
')
Packit 5c3484
Packit 5c3484
define(`mulx',`
Packit 5c3484
	lea	-16(%rsp), %rsp
Packit 5c3484
	push	%rax
Packit 5c3484
	push	%rdx
Packit 5c3484
	pushfq			C preserve all flags
Packit 5c3484
	mov	$1, %rax
Packit 5c3484
	mul	%rdx
Packit 5c3484
	mov	%rax, 24(%rsp)
Packit 5c3484
	mov	%rdx, 32(%rsp)
Packit 5c3484
	popfq			C restore eflags
Packit 5c3484
	pop	%rdx
Packit 5c3484
	pop	%rax
Packit 5c3484
	pop	$2
Packit 5c3484
	pop	$3
Packit 5c3484
')