Annotation of OpenXM_contrib2/asir2000/asm/gf2m_mul_w.c, Revision 1.5
1.2 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.5 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/asm/gf2m_mul_w.c,v 1.4 2001/10/09 01:36:03 noro Exp $
1.2 noro 49: */
1.1 noro 50: unsigned int NNgf2m_mul_11(unsigned int *h, unsigned int a, unsigned int b)
51: {
1.5 ! noro 52: __asm
! 53: {
! 54: push ebx
! 55: mov ecx,a
! 56: mov edx,b
! 57: xor ebx,ebx
! 58: xor eax,eax
! 59: add edx,edx
! 60: jnc GF2ML1
! 61: xor eax,ecx
1.1 noro 62: GF2ML1:
1.5 ! noro 63: add eax,eax
! 64: adc ebx,ebx
! 65: add edx,edx
! 66: jnc GF2ML2
! 67: xor eax,ecx
1.1 noro 68: GF2ML2:
1.5 ! noro 69: add eax,eax
! 70: adc ebx,ebx
! 71: add edx,edx
! 72: jnc GF2ML3
! 73: xor eax,ecx
1.1 noro 74: GF2ML3:
1.5 ! noro 75: add eax,eax
! 76: adc ebx,ebx
! 77: add edx,edx
! 78: jnc GF2ML4
! 79: xor eax,ecx
1.1 noro 80: GF2ML4:
1.5 ! noro 81: add eax,eax
! 82: adc ebx,ebx
! 83: add edx,edx
! 84: jnc GF2ML5
! 85: xor eax,ecx
1.1 noro 86: GF2ML5:
1.5 ! noro 87: add eax,eax
! 88: adc ebx,ebx
! 89: add edx,edx
! 90: jnc GF2ML6
! 91: xor eax,ecx
1.1 noro 92: GF2ML6:
1.5 ! noro 93: add eax,eax
! 94: adc ebx,ebx
! 95: add edx,edx
! 96: jnc GF2ML7
! 97: xor eax,ecx
1.1 noro 98: GF2ML7:
1.5 ! noro 99: add eax,eax
! 100: adc ebx,ebx
! 101: add edx,edx
! 102: jnc GF2ML8
! 103: xor eax,ecx
1.1 noro 104: GF2ML8:
1.5 ! noro 105: add eax,eax
! 106: adc ebx,ebx
! 107: add edx,edx
! 108: jnc GF2ML9
! 109: xor eax,ecx
1.1 noro 110: GF2ML9:
1.5 ! noro 111: add eax,eax
! 112: adc ebx,ebx
! 113: add edx,edx
! 114: jnc GF2ML10
! 115: xor eax,ecx
1.1 noro 116: GF2ML10:
1.5 ! noro 117: add eax,eax
! 118: adc ebx,ebx
! 119: add edx,edx
! 120: jnc GF2ML11
! 121: xor eax,ecx
1.1 noro 122: GF2ML11:
1.5 ! noro 123: add eax,eax
! 124: adc ebx,ebx
! 125: add edx,edx
! 126: jnc GF2ML12
! 127: xor eax,ecx
1.1 noro 128: GF2ML12:
1.5 ! noro 129: add eax,eax
! 130: adc ebx,ebx
! 131: add edx,edx
! 132: jnc GF2ML13
! 133: xor eax,ecx
1.1 noro 134: GF2ML13:
1.5 ! noro 135: add eax,eax
! 136: adc ebx,ebx
! 137: add edx,edx
! 138: jnc GF2ML14
! 139: xor eax,ecx
1.1 noro 140: GF2ML14:
1.5 ! noro 141: add eax,eax
! 142: adc ebx,ebx
! 143: add edx,edx
! 144: jnc GF2ML15
! 145: xor eax,ecx
1.1 noro 146: GF2ML15:
1.5 ! noro 147: add eax,eax
! 148: adc ebx,ebx
! 149: add edx,edx
! 150: jnc GF2ML16
! 151: xor eax,ecx
1.1 noro 152: GF2ML16:
1.5 ! noro 153: add eax,eax
! 154: adc ebx,ebx
! 155: add edx,edx
! 156: jnc GF2ML17
! 157: xor eax,ecx
1.1 noro 158: GF2ML17:
1.5 ! noro 159: add eax,eax
! 160: adc ebx,ebx
! 161: add edx,edx
! 162: jnc GF2ML18
! 163: xor eax,ecx
1.1 noro 164: GF2ML18:
1.5 ! noro 165: add eax,eax
! 166: adc ebx,ebx
! 167: add edx,edx
! 168: jnc GF2ML19
! 169: xor eax,ecx
1.1 noro 170: GF2ML19:
1.5 ! noro 171: add eax,eax
! 172: adc ebx,ebx
! 173: add edx,edx
! 174: jnc GF2ML20
! 175: xor eax,ecx
1.1 noro 176: GF2ML20:
1.5 ! noro 177: add eax,eax
! 178: adc ebx,ebx
! 179: add edx,edx
! 180: jnc GF2ML21
! 181: xor eax,ecx
1.1 noro 182: GF2ML21:
1.5 ! noro 183: add eax,eax
! 184: adc ebx,ebx
! 185: add edx,edx
! 186: jnc GF2ML22
! 187: xor eax,ecx
1.1 noro 188: GF2ML22:
1.5 ! noro 189: add eax,eax
! 190: adc ebx,ebx
! 191: add edx,edx
! 192: jnc GF2ML23
! 193: xor eax,ecx
1.1 noro 194: GF2ML23:
1.5 ! noro 195: add eax,eax
! 196: adc ebx,ebx
! 197: add edx,edx
! 198: jnc GF2ML24
! 199: xor eax,ecx
1.1 noro 200: GF2ML24:
1.5 ! noro 201: add eax,eax
! 202: adc ebx,ebx
! 203: add edx,edx
! 204: jnc GF2ML25
! 205: xor eax,ecx
1.1 noro 206: GF2ML25:
1.5 ! noro 207: add eax,eax
! 208: adc ebx,ebx
! 209: add edx,edx
! 210: jnc GF2ML26
! 211: xor eax,ecx
1.1 noro 212: GF2ML26:
1.5 ! noro 213: add eax,eax
! 214: adc ebx,ebx
! 215: add edx,edx
! 216: jnc GF2ML27
! 217: xor eax,ecx
1.1 noro 218: GF2ML27:
1.5 ! noro 219: add eax,eax
! 220: adc ebx,ebx
! 221: add edx,edx
! 222: jnc GF2ML28
! 223: xor eax,ecx
1.1 noro 224: GF2ML28:
1.5 ! noro 225: add eax,eax
! 226: adc ebx,ebx
! 227: add edx,edx
! 228: jnc GF2ML29
! 229: xor eax,ecx
1.1 noro 230: GF2ML29:
1.5 ! noro 231: add eax,eax
! 232: adc ebx,ebx
! 233: add edx,edx
! 234: jnc GF2ML30
! 235: xor eax,ecx
1.1 noro 236: GF2ML30:
1.5 ! noro 237: add eax,eax
! 238: adc ebx,ebx
! 239: add edx,edx
! 240: jnc GF2ML31
! 241: xor eax,ecx
1.1 noro 242: GF2ML31:
1.5 ! noro 243: add eax,eax
! 244: adc ebx,ebx
! 245: add edx,edx
! 246: jnc GF2ML32
! 247: xor eax,ecx
1.1 noro 248: GF2ML32:
1.5 ! noro 249: mov ecx,h
! 250: mov DWORD PTR [ecx], ebx
! 251: pop ebx
! 252: }
1.1 noro 253: }
254:
255: unsigned int NNgf2m_mul_1h(unsigned int *h, unsigned int a, unsigned int b)
256: {
1.5 ! noro 257: __asm
! 258: {
! 259: push ebx
! 260: mov ecx,a
! 261: mov edx,b
! 262: shl edx,0x10
! 263: xor ebx,ebx
! 264: xor eax,eax
! 265: add edx,edx
! 266: jnc GF2MLL1
! 267: xor eax,ecx
1.1 noro 268: GF2MLL1:
1.5 ! noro 269: add eax,eax
! 270: adc ebx,ebx
! 271: add edx,edx
! 272: jnc GF2MLL2
! 273: xor eax,ecx
1.1 noro 274: GF2MLL2:
1.5 ! noro 275: add eax,eax
! 276: adc ebx,ebx
! 277: add edx,edx
! 278: jnc GF2MLL3
! 279: xor eax,ecx
1.1 noro 280: GF2MLL3:
1.5 ! noro 281: add eax,eax
! 282: adc ebx,ebx
! 283: add edx,edx
! 284: jnc GF2MLL4
! 285: xor eax,ecx
1.1 noro 286: GF2MLL4:
1.5 ! noro 287: add eax,eax
! 288: adc ebx,ebx
! 289: add edx,edx
! 290: jnc GF2MLL5
! 291: xor eax,ecx
1.1 noro 292: GF2MLL5:
1.5 ! noro 293: add eax,eax
! 294: adc ebx,ebx
! 295: add edx,edx
! 296: jnc GF2MLL6
! 297: xor eax,ecx
1.1 noro 298: GF2MLL6:
1.5 ! noro 299: add eax,eax
! 300: adc ebx,ebx
! 301: add edx,edx
! 302: jnc GF2MLL7
! 303: xor eax,ecx
1.1 noro 304: GF2MLL7:
1.5 ! noro 305: add eax,eax
! 306: adc ebx,ebx
! 307: add edx,edx
! 308: jnc GF2MLL8
! 309: xor eax,ecx
1.1 noro 310: GF2MLL8:
1.5 ! noro 311: add eax,eax
! 312: adc ebx,ebx
! 313: add edx,edx
! 314: jnc GF2MLL9
! 315: xor eax,ecx
1.1 noro 316: GF2MLL9:
1.5 ! noro 317: add eax,eax
! 318: adc ebx,ebx
! 319: add edx,edx
! 320: jnc GF2MLL10
! 321: xor eax,ecx
1.1 noro 322: GF2MLL10:
1.5 ! noro 323: add eax,eax
! 324: adc ebx,ebx
! 325: add edx,edx
! 326: jnc GF2MLL11
! 327: xor eax,ecx
1.1 noro 328: GF2MLL11:
1.5 ! noro 329: add eax,eax
! 330: adc ebx,ebx
! 331: add edx,edx
! 332: jnc GF2MLL12
! 333: xor eax,ecx
1.1 noro 334: GF2MLL12:
1.5 ! noro 335: add eax,eax
! 336: adc ebx,ebx
! 337: add edx,edx
! 338: jnc GF2MLL13
! 339: xor eax,ecx
1.1 noro 340: GF2MLL13:
1.5 ! noro 341: add eax,eax
! 342: adc ebx,ebx
! 343: add edx,edx
! 344: jnc GF2MLL14
! 345: xor eax,ecx
1.1 noro 346: GF2MLL14:
1.5 ! noro 347: add eax,eax
! 348: adc ebx,ebx
! 349: add edx,edx
! 350: jnc GF2MLL15
! 351: xor eax,ecx
1.1 noro 352: GF2MLL15:
1.5 ! noro 353: add eax,eax
! 354: adc ebx,ebx
! 355: add edx,edx
! 356: jnc GF2MLL16
! 357: xor eax,ecx
1.1 noro 358: GF2MLL16:
1.5 ! noro 359: mov ecx,h
! 360: mov DWORD PTR [ecx],ebx;
! 361: pop ebx
! 362: }
1.1 noro 363: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>