1 /* This assember is for R4000 and above machines. It takes advantage
2 * of the 64 bit registers present on these CPUs.
3 * Make sure that the SSLeay bignum library is compiled with
4 * SIXTY_FOUR_BIT set and BN_LLONG undefined.
5 * This must either be compiled with the system CC, or, if you use GNU gas,
6 * cc -E mips3.s|gas -o mips3.o
32 .globl bn_mul_add_words
97 sd R4,-8(P1) # delay slot
127 .end bn_mul_add_words
130 # Program Unit: bn_mul_words
202 # Program Unit: bn_sqr_words
270 # Program Unit: bn_add_words
274 bn_add_words: # 0x590
349 # Program Unit: bn_div64
361 .mask 0x80010000, -56
366 # 322 BN_ULONG dh,dl,q,ret=0,th,tl,t;
371 # 325 if (d == 0) return(BN_MASK2);
377 # 327 i=BN_num_bits_word(d);
383 .livereg 0x800ff0e,0xfff
391 # 328 if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i))
397 # 330 #if !defined(NO_STDIO) && !defined(WIN16)
398 # 331 fprintf(stderr,"Division would overflow (%d)\n",i);
406 .livereg 0xff0e,0xfff
418 # 336 if (h >= d) h-=d;
428 # 341 h=(h<<i)|(l>>(BN_BITS2-i));
437 # 344 dh=(d&BN_MASK2h)>>BN_BITS4;
438 # 345 dl=(d&BN_MASK2l);
439 and $8, $16,0xFFFFFFFF00000000
441 # dli $10,0xFFFFFFFF # Is this needed?
445 dli $6,0xFFFFFFFF00000000
449 # 348 if ((h>>BN_BITS4) == dh)
467 # 356 if ((t&BN_MASK2h) ||
470 # 359 ((l&BN_MASK2h)>>BN_BITS4))))
491 # 365 t=(tl>>BN_BITS4);
492 # 366 tl=(tl<<BN_BITS4)&BN_MASK2h;
500 # 369 if (l < tl) th++;
518 # 378 if (--count == 0) break;
522 # 380 ret=q<<BN_BITS4;
524 # 381 h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2;
528 # 382 l=(l&BN_MASK2l)<<BN_BITS4;
529 and $12, $12, 0xFFFFFFFF