/usr/include/NTL/SPMM_ASM.h is in libntl-dev 5.4.2-4.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /*************************************************************
Assembly code support for computing the high-order
word of a word * word product (unsigned).
Note that these typically only make a significant difference
on some 64-bit machines, as on 32-bit machines, the "long long"
solution is usually just as good.
These code sequences were extracted from a recent version of
the file longlong.h from gmp. Copyright notice follows:
Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file 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.
This file 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 file; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*************************************************************/
#if (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)))
// To simplify things, we require gcc v2.7 or higher.
// ------ POWERPC ------
#if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \
|| defined (__ppc__) || defined(__ppc64__) \
|| (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \
|| (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \
&& CPU_FAMILY == PPC)
#if (NTL_BITS_PER_LONG == 32)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi;
__asm__ ("mulhwu %0,%1,%2" : "=r" (hi) : "%r" (a), "r" (b));
return hi;
}
#elif (NTL_BITS_PER_LONG == 64)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi;
__asm__ ("mulhdu %0,%1,%2" : "=r" (hi) : "%r" (a), "r" (b));
return hi;
}
#endif
#endif
// ------ ALPHA ------
#if (defined (__alpha) && NTL_BITS_PER_LONG == 64)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi;
__asm__ ("umulh %r1,%2,%0" : "=r" (hi) : "%rJ" (a), "rI" (b));
return hi;
}
#endif
// ------ IA64 ------
#if (defined (__ia64) && NTL_BITS_PER_LONG == 64)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi;
__asm__ ("xma.hu %0 = %1, %2, f0" : "=f" (hi) : "f" (a), "f" (b));
return hi;
}
#endif
// ------ x86 ------
#if ((defined (__i386__) || defined (__i486__)) && NTL_BITS_PER_LONG == 32)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi, lo;
__asm__ ("mull %3" : "=a" (lo), "=d" (hi) : "%0" (a), "rm" (b));
return hi;
}
#endif
// ------ x86-64 ------
#if (defined (__x86_64__) && NTL_BITS_PER_LONG == 64)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi, lo;
__asm__ ("mulq %3" : "=a" (lo), "=d" (hi) : "%0" (a), "rm" (b));
return hi;
}
#endif
// ------ MIPS ------
#if (defined (__mips))
#if (NTL_BITS_PER_LONG == 32)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi;
hi = ((unsigned long long) a * b) >> 32;
return hi;
}
#elif (NTL_BITS_PER_LONG == 64)
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
typedef unsigned int uint128_t __attribute__((mode(TI)));
unsigned long hi;
hi = ((uint128_t) a * b) >> 64;
return hi;
}
#endif
#endif
// -------- SPARC --------
#if (defined (__sparc__) && NTL_BITS_PER_LONG == 32)
#if (defined (__sparc_v9__) || defined (__sparcv9) || \
defined (__sparc_v8__) || defined (__sparcv8) || defined (__sparclite__))
static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
{
unsigned long hi, lo;
__asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (hi), "=r" (lo) : "r" (a), "r" (b));
return hi;
}
#endif
#endif
#endif // __GNUC__
|