Annotation of OpenXM_contrib2/asir2000/asm/gf2m_mul_w.c, Revision 1.2
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
! 26: * e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification
! 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: *
! 48: * $OpenXM: OpenXM_contrib2/asir2000/asm/gf2m_mul_w.c,v 1.1.1.1 1999/12/03 07:39:06 noro Exp $
! 49: */
1.1 noro 50: unsigned int NNgf2m_mul_11(unsigned int *h, unsigned int a, unsigned int b)
51: {
52: __asm
53: {
54: push ebx
55: mov ecx,a
56: mov edx,b
57: GF2ML0:
58: xor ebx,ebx
59: xor eax,eax
60: add edx,edx
61: jnc GF2ML1
62: xor eax,ecx
63: GF2ML1:
64: add eax,eax
65: adc ebx,ebx
66: add edx,edx
67: jnc GF2ML2
68: xor eax,ecx
69: GF2ML2:
70: add eax,eax
71: adc ebx,ebx
72: add edx,edx
73: jnc GF2ML3
74: xor eax,ecx
75: GF2ML3:
76: add eax,eax
77: adc ebx,ebx
78: add edx,edx
79: jnc GF2ML4
80: xor eax,ecx
81: GF2ML4:
82: add eax,eax
83: adc ebx,ebx
84: add edx,edx
85: jnc GF2ML5
86: xor eax,ecx
87: GF2ML5:
88: add eax,eax
89: adc ebx,ebx
90: add edx,edx
91: jnc GF2ML6
92: xor eax,ecx
93: GF2ML6:
94: add eax,eax
95: adc ebx,ebx
96: add edx,edx
97: jnc GF2ML7
98: xor eax,ecx
99: GF2ML7:
100: add eax,eax
101: adc ebx,ebx
102: add edx,edx
103: jnc GF2ML8
104: xor eax,ecx
105: GF2ML8:
106: add eax,eax
107: adc ebx,ebx
108: add edx,edx
109: jnc GF2ML9
110: xor eax,ecx
111: GF2ML9:
112: add eax,eax
113: adc ebx,ebx
114: add edx,edx
115: jnc GF2ML10
116: xor eax,ecx
117: GF2ML10:
118: add eax,eax
119: adc ebx,ebx
120: add edx,edx
121: jnc GF2ML11
122: xor eax,ecx
123: GF2ML11:
124: add eax,eax
125: adc ebx,ebx
126: add edx,edx
127: jnc GF2ML12
128: xor eax,ecx
129: GF2ML12:
130: add eax,eax
131: adc ebx,ebx
132: add edx,edx
133: jnc GF2ML13
134: xor eax,ecx
135: GF2ML13:
136: add eax,eax
137: adc ebx,ebx
138: add edx,edx
139: jnc GF2ML14
140: xor eax,ecx
141: GF2ML14:
142: add eax,eax
143: adc ebx,ebx
144: add edx,edx
145: jnc GF2ML15
146: xor eax,ecx
147: GF2ML15:
148: add eax,eax
149: adc ebx,ebx
150: add edx,edx
151: jnc GF2ML16
152: xor eax,ecx
153: GF2ML16:
154: add eax,eax
155: adc ebx,ebx
156: add edx,edx
157: jnc GF2ML17
158: xor eax,ecx
159: GF2ML17:
160: add eax,eax
161: adc ebx,ebx
162: add edx,edx
163: jnc GF2ML18
164: xor eax,ecx
165: GF2ML18:
166: add eax,eax
167: adc ebx,ebx
168: add edx,edx
169: jnc GF2ML19
170: xor eax,ecx
171: GF2ML19:
172: add eax,eax
173: adc ebx,ebx
174: add edx,edx
175: jnc GF2ML20
176: xor eax,ecx
177: GF2ML20:
178: add eax,eax
179: adc ebx,ebx
180: add edx,edx
181: jnc GF2ML21
182: xor eax,ecx
183: GF2ML21:
184: add eax,eax
185: adc ebx,ebx
186: add edx,edx
187: jnc GF2ML22
188: xor eax,ecx
189: GF2ML22:
190: add eax,eax
191: adc ebx,ebx
192: add edx,edx
193: jnc GF2ML23
194: xor eax,ecx
195: GF2ML23:
196: add eax,eax
197: adc ebx,ebx
198: add edx,edx
199: jnc GF2ML24
200: xor eax,ecx
201: GF2ML24:
202: add eax,eax
203: adc ebx,ebx
204: add edx,edx
205: jnc GF2ML25
206: xor eax,ecx
207: GF2ML25:
208: add eax,eax
209: adc ebx,ebx
210: add edx,edx
211: jnc GF2ML26
212: xor eax,ecx
213: GF2ML26:
214: add eax,eax
215: adc ebx,ebx
216: add edx,edx
217: jnc GF2ML27
218: xor eax,ecx
219: GF2ML27:
220: add eax,eax
221: adc ebx,ebx
222: add edx,edx
223: jnc GF2ML28
224: xor eax,ecx
225: GF2ML28:
226: add eax,eax
227: adc ebx,ebx
228: add edx,edx
229: jnc GF2ML29
230: xor eax,ecx
231: GF2ML29:
232: add eax,eax
233: adc ebx,ebx
234: add edx,edx
235: jnc GF2ML30
236: xor eax,ecx
237: GF2ML30:
238: add eax,eax
239: adc ebx,ebx
240: add edx,edx
241: jnc GF2ML31
242: xor eax,ecx
243: GF2ML31:
244: add eax,eax
245: adc ebx,ebx
246: add edx,edx
247: jnc GF2ML32
248: xor eax,ecx
249: GF2ML32:
250: mov ecx,h
251: mov DWORD PTR [ecx], ebx
252: pop ebx
253: }
254: }
255:
256: unsigned int NNgf2m_mul_1h(unsigned int *h, unsigned int a, unsigned int b)
257: {
258: __asm
259: {
260: push ebx
261: mov ecx,a
262: mov edx,b
263: shl edx,0x10
264: GF2MLL0:
265: xor ebx,ebx
266: xor eax,eax
267: add edx,edx
268: jnc GF2MLL1
269: xor eax,ecx
270: GF2MLL1:
271: add eax,eax
272: adc ebx,ebx
273: add edx,edx
274: jnc GF2MLL2
275: xor eax,ecx
276: GF2MLL2:
277: add eax,eax
278: adc ebx,ebx
279: add edx,edx
280: jnc GF2MLL3
281: xor eax,ecx
282: GF2MLL3:
283: add eax,eax
284: adc ebx,ebx
285: add edx,edx
286: jnc GF2MLL4
287: xor eax,ecx
288: GF2MLL4:
289: add eax,eax
290: adc ebx,ebx
291: add edx,edx
292: jnc GF2MLL5
293: xor eax,ecx
294: GF2MLL5:
295: add eax,eax
296: adc ebx,ebx
297: add edx,edx
298: jnc GF2MLL6
299: xor eax,ecx
300: GF2MLL6:
301: add eax,eax
302: adc ebx,ebx
303: add edx,edx
304: jnc GF2MLL7
305: xor eax,ecx
306: GF2MLL7:
307: add eax,eax
308: adc ebx,ebx
309: add edx,edx
310: jnc GF2MLL8
311: xor eax,ecx
312: GF2MLL8:
313: add eax,eax
314: adc ebx,ebx
315: add edx,edx
316: jnc GF2MLL9
317: xor eax,ecx
318: GF2MLL9:
319: add eax,eax
320: adc ebx,ebx
321: add edx,edx
322: jnc GF2MLL10
323: xor eax,ecx
324: GF2MLL10:
325: add eax,eax
326: adc ebx,ebx
327: add edx,edx
328: jnc GF2MLL11
329: xor eax,ecx
330: GF2MLL11:
331: add eax,eax
332: adc ebx,ebx
333: add edx,edx
334: jnc GF2MLL12
335: xor eax,ecx
336: GF2MLL12:
337: add eax,eax
338: adc ebx,ebx
339: add edx,edx
340: jnc GF2MLL13
341: xor eax,ecx
342: GF2MLL13:
343: add eax,eax
344: adc ebx,ebx
345: add edx,edx
346: jnc GF2MLL14
347: xor eax,ecx
348: GF2MLL14:
349: add eax,eax
350: adc ebx,ebx
351: add edx,edx
352: jnc GF2MLL15
353: xor eax,ecx
354: GF2MLL15:
355: add eax,eax
356: adc ebx,ebx
357: add edx,edx
358: jnc GF2MLL16
359: xor eax,ecx
360: GF2MLL16:
361: mov ecx,h
362: mov DWORD PTR [ecx],ebx;
363: pop ebx
364: }
365: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>