mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-24 08:09:22 +00:00
libgcrypt: Import libgcrypt 1.11
We currently use an old version of libgcrypt which results in us having fewer ciphers and missing on many other improvements. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
a0d4c94ef6
commit
3312af6e07
468 files changed
+210508
-33178
No files matched your search
@@ -1,3 +1,4 @@
|
||||
func_abi.h
|
||||
mpih-add1.S
|
||||
mpih-lshift.S
|
||||
mpih-mul1.S
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "asm-common-amd64.h"
|
||||
|
||||
#ifdef USE_MS_ABI
|
||||
/* Store registers and move four first input arguments from MS ABI to
|
||||
* SYSV ABI. */
|
||||
#define FUNC_ENTRY() \
|
||||
CFI_STARTPROC(); \
|
||||
pushq %rsi; \
|
||||
CFI_PUSH(%rsi); \
|
||||
pushq %rdi; \
|
||||
CFI_PUSH(%rdi); \
|
||||
movq %rdx, %rsi; \
|
||||
movq %rcx, %rdi; \
|
||||
movq %r8, %rdx; \
|
||||
movq %r9, %rcx;
|
||||
|
||||
/* Restore registers. */
|
||||
#define FUNC_EXIT() \
|
||||
popq %rdi; \
|
||||
CFI_POP(%rdi); \
|
||||
popq %rsi; \
|
||||
CFI_POP(%rsi); \
|
||||
ret_spec_stop; \
|
||||
CFI_ENDPROC();
|
||||
#else
|
||||
#define FUNC_ENTRY() \
|
||||
CFI_STARTPROC();
|
||||
|
||||
#define FUNC_EXIT() \
|
||||
ret_spec_stop; \
|
||||
CFI_ENDPROC();
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* This file defines some basic constants for the MPI machinery. We
|
||||
* need to define the types on a per-CPU basis, so it is done with
|
||||
* this file here. */
|
||||
#define BYTES_PER_MPI_LIMB 8
|
||||
#define BYTES_PER_MPI_LIMB (SIZEOF_UNSIGNED_LONG_LONG)
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1992, 1994, 1995, 1998,
|
||||
* 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2023 Jussi Kivilinna <jussi.kivilinna@iki.fi>
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
*
|
||||
@@ -17,8 +18,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -39,25 +40,80 @@
|
||||
* mpi_ptr_t s2_ptr, rdx
|
||||
* mpi_size_t size) rcx
|
||||
*/
|
||||
|
||||
.text
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
.globl C_SYMBOL_NAME(_gcry_mpih_add_n)
|
||||
C_SYMBOL_NAME(_gcry_mpih_add_n:)
|
||||
leaq (%rsi,%rcx,8), %rsi
|
||||
leaq (%rdi,%rcx,8), %rdi
|
||||
leaq (%rdx,%rcx,8), %rdx
|
||||
negq %rcx
|
||||
xorl %eax, %eax /* clear cy */
|
||||
FUNC_ENTRY()
|
||||
movl %ecx, %r9d
|
||||
andl $3, %r9d
|
||||
je .Lprehandle0
|
||||
cmpl $2, %r9d
|
||||
jb .Lprehandle1
|
||||
je .Lprehandle2
|
||||
|
||||
#define FIRST_ADD() \
|
||||
movq (%rsi), %rax; \
|
||||
addq (%rdx), %rax; \
|
||||
movq %rax, (%rdi)
|
||||
|
||||
#define NEXT_ADD(offset) \
|
||||
movq offset(%rsi), %rax; \
|
||||
adcq offset(%rdx), %rax; \
|
||||
movq %rax, offset(%rdi)
|
||||
|
||||
.Lprehandle3:
|
||||
leaq -2(%rcx), %rcx
|
||||
FIRST_ADD();
|
||||
NEXT_ADD(8);
|
||||
NEXT_ADD(16);
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 24(%rsi), %rsi
|
||||
leaq 24(%rdx), %rdx
|
||||
leaq 24(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle2:
|
||||
leaq -1(%rcx), %rcx
|
||||
FIRST_ADD();
|
||||
NEXT_ADD(8);
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 16(%rsi), %rsi
|
||||
leaq 16(%rdx), %rdx
|
||||
leaq 16(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle1:
|
||||
FIRST_ADD();
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 8(%rsi), %rsi
|
||||
leaq 8(%rdx), %rdx
|
||||
leaq 8(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle0:
|
||||
clc /* clear cy */
|
||||
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq (%rsi,%rcx,8), %rax
|
||||
movq (%rdx,%rcx,8), %r10
|
||||
adcq %r10, %rax
|
||||
movq %rax, (%rdi,%rcx,8)
|
||||
incq %rcx
|
||||
.Loop: leaq -3(%rcx), %rcx
|
||||
NEXT_ADD(0);
|
||||
NEXT_ADD(8);
|
||||
NEXT_ADD(16);
|
||||
NEXT_ADD(24);
|
||||
leaq 32(%rsi), %rsi
|
||||
leaq 32(%rdx), %rdx
|
||||
leaq 32(%rdi), %rdi
|
||||
decq %rcx
|
||||
jne .Loop
|
||||
|
||||
movq %rcx, %rax /* zero %rax */
|
||||
adcq %rax, %rax
|
||||
ret
|
||||
|
||||
ALIGN(2)
|
||||
.Lend:
|
||||
movl $0, %eax /* zero %rax */
|
||||
adcl %eax, %eax
|
||||
FUNC_EXIT()
|
||||
@@ -17,8 +17,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -39,39 +39,41 @@
|
||||
* unsigned cnt) rcx
|
||||
*/
|
||||
|
||||
.text
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
.globl C_SYMBOL_NAME(_gcry_mpih_lshift)
|
||||
C_SYMBOL_NAME(_gcry_mpih_lshift:)
|
||||
movq -8(%rsi,%rdx,8), %mm7
|
||||
movd %ecx, %mm1
|
||||
FUNC_ENTRY()
|
||||
/* Note: %xmm6 and %xmm7 not used for WIN64 ABI compatibility. */
|
||||
movq -8(%rsi,%rdx,8), %xmm4
|
||||
movd %ecx, %xmm1
|
||||
movl $64, %eax
|
||||
subl %ecx, %eax
|
||||
movd %eax, %mm0
|
||||
movq %mm7, %mm3
|
||||
psrlq %mm0, %mm7
|
||||
movd %mm7, %rax
|
||||
movd %eax, %xmm0
|
||||
movdqa %xmm4, %xmm3
|
||||
psrlq %xmm0, %xmm4
|
||||
movq %xmm4, %rax
|
||||
subq $2, %rdx
|
||||
jl .Lendo
|
||||
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq (%rsi,%rdx,8), %mm6
|
||||
movq %mm6, %mm2
|
||||
psrlq %mm0, %mm6
|
||||
psllq %mm1, %mm3
|
||||
por %mm6, %mm3
|
||||
movq %mm3, 8(%rdi,%rdx,8)
|
||||
.Loop: movq (%rsi,%rdx,8), %xmm5
|
||||
movdqa %xmm5, %xmm2
|
||||
psrlq %xmm0, %xmm5
|
||||
psllq %xmm1, %xmm3
|
||||
por %xmm5, %xmm3
|
||||
movq %xmm3, 8(%rdi,%rdx,8)
|
||||
je .Lende
|
||||
movq -8(%rsi,%rdx,8), %mm7
|
||||
movq %mm7, %mm3
|
||||
psrlq %mm0, %mm7
|
||||
psllq %mm1, %mm2
|
||||
por %mm7, %mm2
|
||||
movq %mm2, (%rdi,%rdx,8)
|
||||
movq -8(%rsi,%rdx,8), %xmm4
|
||||
movdqa %xmm4, %xmm3
|
||||
psrlq %xmm0, %xmm4
|
||||
psllq %xmm1, %xmm2
|
||||
por %xmm4, %xmm2
|
||||
movq %xmm2, (%rdi,%rdx,8)
|
||||
subq $2, %rdx
|
||||
jge .Loop
|
||||
|
||||
.Lendo: movq %mm3, %mm2
|
||||
.Lende: psllq %mm1, %mm2
|
||||
movq %mm2, (%rdi)
|
||||
emms
|
||||
ret
|
||||
.Lendo: movdqa %xmm3, %xmm2
|
||||
.Lende: psllq %xmm1, %xmm2
|
||||
movq %xmm2, (%rdi)
|
||||
FUNC_EXIT()
|
||||
@@ -16,8 +16,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -40,18 +40,19 @@
|
||||
|
||||
|
||||
TEXT
|
||||
ALIGN(5)
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
ALIGN(4)
|
||||
|
||||
GLOBL C_SYMBOL_NAME(_gcry_mpih_mul_1)
|
||||
C_SYMBOL_NAME(_gcry_mpih_mul_1:)
|
||||
|
||||
FUNC_ENTRY()
|
||||
movq %rdx, %r11
|
||||
leaq (%rsi,%rdx,8), %rsi
|
||||
leaq (%rdi,%rdx,8), %rdi
|
||||
negq %r11
|
||||
xorl %r8d, %r8d
|
||||
|
||||
ALIGN(4)
|
||||
.Loop: movq (%rsi,%r11,8), %rax
|
||||
mulq %rcx
|
||||
addq %r8, %rax
|
||||
@@ -62,4 +63,4 @@ C_SYMBOL_NAME(_gcry_mpih_mul_1:)
|
||||
jne .Loop
|
||||
|
||||
movq %r8, %rax
|
||||
ret
|
||||
FUNC_EXIT()
|
||||
@@ -17,8 +17,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -31,49 +31,6 @@
|
||||
#include "sysdep.h"
|
||||
#include "asm-syntax.h"
|
||||
|
||||
|
||||
/*******************
|
||||
* mpi_limb_t
|
||||
* _gcry_mpih_addmul_2( mpi_ptr_t res_ptr, (sp + 4)
|
||||
* mpi_ptr_t s1_ptr, (sp + 8)
|
||||
* mpi_size_t s1_size, (sp + 12)
|
||||
* mpi_limb_t s2_limb) (sp + 16)
|
||||
*/
|
||||
|
||||
/* i80386 addmul_1 -- Multiply a limb vector with a limb and add
|
||||
* the result to a second limb vector.
|
||||
*
|
||||
* Copyright (C) 1992, 1994, 1998,
|
||||
* 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
*
|
||||
* Libgcrypt is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Libgcrypt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
* way the data is stored; this is to support the abstraction
|
||||
* of an optional secure memory allocation which may be used
|
||||
* to avoid revealing of sensitive data due to paging etc.
|
||||
*/
|
||||
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "asm-syntax.h"
|
||||
|
||||
|
||||
/*******************
|
||||
* mpi_limb_t
|
||||
* _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (rdi)
|
||||
@@ -82,8 +39,10 @@
|
||||
* mpi_limb_t s2_limb) (rcx)
|
||||
*/
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
GLOBL C_SYMBOL_NAME(_gcry_mpih_addmul_1)
|
||||
C_SYMBOL_NAME(_gcry_mpih_addmul_1:)
|
||||
FUNC_ENTRY()
|
||||
movq %rdx, %r11
|
||||
leaq (%rsi,%rdx,8), %rsi
|
||||
leaq (%rdi,%rdx,8), %rdi
|
||||
@@ -91,7 +50,7 @@ C_SYMBOL_NAME(_gcry_mpih_addmul_1:)
|
||||
xorl %r8d, %r8d
|
||||
xorl %r10d, %r10d
|
||||
|
||||
ALIGN(3) /* minimal alignment for claimed speed */
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq (%rsi,%r11,8), %rax
|
||||
mulq %rcx
|
||||
addq (%rdi,%r11,8), %rax
|
||||
@@ -104,4 +63,4 @@ C_SYMBOL_NAME(_gcry_mpih_addmul_1:)
|
||||
jne .Loop
|
||||
|
||||
movq %r8, %rax
|
||||
ret
|
||||
FUNC_EXIT()
|
||||
@@ -17,8 +17,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -40,16 +40,17 @@
|
||||
* mpi_limb_t s2_limb) (rcx)
|
||||
*/
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
GLOBL C_SYMBOL_NAME(_gcry_mpih_submul_1)
|
||||
C_SYMBOL_NAME(_gcry_mpih_submul_1:)
|
||||
|
||||
FUNC_ENTRY()
|
||||
movq %rdx, %r11
|
||||
leaq (%rsi,%r11,8), %rsi
|
||||
leaq (%rdi,%r11,8), %rdi
|
||||
negq %r11
|
||||
xorl %r8d, %r8d
|
||||
|
||||
ALIGN(3) /* minimal alignment for claimed speed */
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq (%rsi,%r11,8), %rax
|
||||
movq (%rdi,%r11,8), %r10
|
||||
mulq %rcx
|
||||
@@ -63,4 +64,4 @@ C_SYMBOL_NAME(_gcry_mpih_submul_1:)
|
||||
jne .Loop
|
||||
|
||||
movq %r8, %rax
|
||||
ret
|
||||
FUNC_EXIT()
|
||||
@@ -17,8 +17,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -39,42 +39,44 @@
|
||||
* unsigned cnt) rcx
|
||||
*/
|
||||
|
||||
.text
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
.globl C_SYMBOL_NAME(_gcry_mpih_rshift)
|
||||
C_SYMBOL_NAME(_gcry_mpih_rshift:)
|
||||
movq (%rsi), %mm7
|
||||
movd %ecx, %mm1
|
||||
FUNC_ENTRY()
|
||||
/* Note: %xmm6 and %xmm7 not used for WIN64 ABI compatibility. */
|
||||
movq (%rsi), %xmm4
|
||||
movd %ecx, %xmm1
|
||||
movl $64, %eax
|
||||
subl %ecx, %eax
|
||||
movd %eax, %mm0
|
||||
movq %mm7, %mm3
|
||||
psllq %mm0, %mm7
|
||||
movd %mm7, %rax
|
||||
movd %eax, %xmm0
|
||||
movdqa %xmm4, %xmm3
|
||||
psllq %xmm0, %xmm4
|
||||
movq %xmm4, %rax
|
||||
leaq (%rsi,%rdx,8), %rsi
|
||||
leaq (%rdi,%rdx,8), %rdi
|
||||
negq %rdx
|
||||
addq $2, %rdx
|
||||
jg .Lendo
|
||||
|
||||
ALIGN(8) /* minimal alignment for claimed speed */
|
||||
.Loop: movq -8(%rsi,%rdx,8), %mm6
|
||||
movq %mm6, %mm2
|
||||
psllq %mm0, %mm6
|
||||
psrlq %mm1, %mm3
|
||||
por %mm6, %mm3
|
||||
movq %mm3, -16(%rdi,%rdx,8)
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq -8(%rsi,%rdx,8), %xmm5
|
||||
movdqa %xmm5, %xmm2
|
||||
psllq %xmm0, %xmm5
|
||||
psrlq %xmm1, %xmm3
|
||||
por %xmm5, %xmm3
|
||||
movq %xmm3, -16(%rdi,%rdx,8)
|
||||
je .Lende
|
||||
movq (%rsi,%rdx,8), %mm7
|
||||
movq %mm7, %mm3
|
||||
psllq %mm0, %mm7
|
||||
psrlq %mm1, %mm2
|
||||
por %mm7, %mm2
|
||||
movq %mm2, -8(%rdi,%rdx,8)
|
||||
movq (%rsi,%rdx,8), %xmm4
|
||||
movdqa %xmm4, %xmm3
|
||||
psllq %xmm0, %xmm4
|
||||
psrlq %xmm1, %xmm2
|
||||
por %xmm4, %xmm2
|
||||
movq %xmm2, -8(%rdi,%rdx,8)
|
||||
addq $2, %rdx
|
||||
jle .Loop
|
||||
|
||||
.Lendo: movq %mm3, %mm2
|
||||
.Lende: psrlq %mm1, %mm2
|
||||
movq %mm2, -8(%rdi)
|
||||
emms
|
||||
ret
|
||||
.Lendo: movdqa %xmm3, %xmm2
|
||||
.Lende: psrlq %xmm1, %xmm2
|
||||
movq %xmm2, -8(%rdi)
|
||||
FUNC_EXIT()
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1992, 1994, 1995, 1998,
|
||||
* 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2023 Jussi Kivilinna <jussi.kivilinna@iki.fi>
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
*
|
||||
@@ -17,8 +18,8 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Note: This code is heavily based on the GNU MP Library.
|
||||
* Actually it's the same code with only minor changes in the
|
||||
@@ -39,23 +40,80 @@
|
||||
* mpi_ptr_t s2_ptr, rdx
|
||||
* mpi_size_t size) rcx
|
||||
*/
|
||||
.text
|
||||
TEXT
|
||||
ALIGN(4)
|
||||
.globl C_SYMBOL_NAME(_gcry_mpih_sub_n)
|
||||
C_SYMBOL_NAME(_gcry_mpih_sub_n:)
|
||||
leaq (%rsi,%rcx,8), %rsi
|
||||
leaq (%rdi,%rcx,8), %rdi
|
||||
leaq (%rdx,%rcx,8), %rdx
|
||||
negq %rcx
|
||||
xorl %eax, %eax /* clear cy */
|
||||
FUNC_ENTRY()
|
||||
movl %ecx, %r9d
|
||||
andl $3, %r9d
|
||||
je .Lprehandle0
|
||||
cmpl $2, %r9d
|
||||
jb .Lprehandle1
|
||||
je .Lprehandle2
|
||||
|
||||
#define FIRST_SUB() \
|
||||
movq (%rsi), %rax; \
|
||||
subq (%rdx), %rax; \
|
||||
movq %rax, (%rdi)
|
||||
|
||||
#define NEXT_SUB(offset) \
|
||||
movq offset(%rsi), %rax; \
|
||||
sbbq offset(%rdx), %rax; \
|
||||
movq %rax, offset(%rdi)
|
||||
|
||||
.Lprehandle3:
|
||||
leaq -2(%rcx), %rcx
|
||||
FIRST_SUB();
|
||||
NEXT_SUB(8);
|
||||
NEXT_SUB(16);
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 24(%rsi), %rsi
|
||||
leaq 24(%rdx), %rdx
|
||||
leaq 24(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle2:
|
||||
leaq -1(%rcx), %rcx
|
||||
FIRST_SUB();
|
||||
NEXT_SUB(8);
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 16(%rsi), %rsi
|
||||
leaq 16(%rdx), %rdx
|
||||
leaq 16(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle1:
|
||||
FIRST_SUB();
|
||||
decq %rcx
|
||||
je .Lend
|
||||
leaq 8(%rsi), %rsi
|
||||
leaq 8(%rdx), %rdx
|
||||
leaq 8(%rdi), %rdi
|
||||
jmp .Loop
|
||||
|
||||
ALIGN(3)
|
||||
.Lprehandle0:
|
||||
clc /* clear cy */
|
||||
|
||||
ALIGN(4) /* minimal alignment for claimed speed */
|
||||
.Loop: movq (%rsi,%rcx,8), %rax
|
||||
movq (%rdx,%rcx,8), %r10
|
||||
sbbq %r10, %rax
|
||||
movq %rax, (%rdi,%rcx,8)
|
||||
incq %rcx
|
||||
.Loop: leaq -3(%rcx), %rcx
|
||||
NEXT_SUB(0);
|
||||
NEXT_SUB(8);
|
||||
NEXT_SUB(16);
|
||||
NEXT_SUB(24);
|
||||
leaq 32(%rsi), %rsi
|
||||
leaq 32(%rdx), %rdx
|
||||
leaq 32(%rdi), %rdi
|
||||
decq %rcx
|
||||
jne .Loop
|
||||
|
||||
movq %rcx, %rax /* zero %rax */
|
||||
adcq %rax, %rax
|
||||
ret
|
||||
ALIGN(2)
|
||||
.Lend:
|
||||
movl $0, %eax /* zero %rax */
|
||||
adcl %eax, %eax
|
||||
FUNC_EXIT()
|
||||
Reference in new issue
Block a user