source: grub-pc/trunk/fuentes/grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul1.S @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 2.5 KB
Line 
1/* Intel Pentium-4 mpn_mul_1 -- Multiply a limb vector with a limb and store
2 * the result in a second limb vector.
3 *
4 * Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
5 *
6 * This file is part of Libgcrypt.
7 *
8 * Libgcrypt is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * Libgcrypt is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 *
22 * Note: This code is heavily based on the GNU MP Library.
23 *       Actually it's the same code with only minor changes in the
24 *       way the data is stored; this is to support the abstraction
25 *       of an optional secure memory allocation which may be used
26 *       to avoid revealing of sensitive data due to paging etc.
27 */
28
29
30#include "sysdep.h"
31#include "asm-syntax.h"
32
33
34/*******************
35 * mpi_limb_t
36 * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (sp + 4)
37 *                mpi_ptr_t s1_ptr,     (sp + 8)
38 *                mpi_size_t s1_size,   (sp + 12)
39 *                mpi_limb_t s2_limb)   (sp + 16)
40 *
41 *                           src != dst      src == dst
42 * P6 model 9  (Banias)          ?.?
43 * P6 model 13 (Dothan)          4.75            4.75
44 * P4 model 0  (Willamette)      4.0             6.0
45 * P4 model 1  (?)               4.0             6.0
46 * P4 model 2  (Northwood)       4.0             6.0
47 * P4 model 3  (Prescott)        ?.?             ?.?
48 * P4 model 4  (Nocona)          ?.?             ?.?
49 * Unfortunately when src==dst the write-combining described in
50 * pentium4/README takes us up to 6 c/l.
51 *
52 */
53
54        TEXT
55        ALIGN (3)
56        GLOBL   C_SYMBOL_NAME(_gcry_mpih_mul_1)
57C_SYMBOL_NAME(_gcry_mpih_mul_1:);
58
59        pxor    %mm0, %mm0
60
61.Lstart_1c:
62        movl    8(%esp), %eax
63        movd    16(%esp), %mm7
64        movl    4(%esp), %edx
65        movl    12(%esp), %ecx
66
67.Ltop:
68
69/*
70        C eax   src, incrementing
71        C ebx
72        C ecx   counter, size iterations
73        C edx   dst, incrementing
74        C
75        C mm0   carry limb
76        C mm7   multiplier
77*/
78       
79        movd    (%eax), %mm1
80        addl    $4, %eax
81        pmuludq %mm7, %mm1
82
83        paddq   %mm1, %mm0
84        movd    %mm0, (%edx)
85        addl    $4, %edx
86
87        psrlq   $32, %mm0
88
89        subl    $1, %ecx
90        jnz     .Ltop
91
92
93        movd    %mm0, %eax
94        emms
95        ret
96
Note: See TracBrowser for help on using the repository browser.