X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbn%2Fasm%2Fvms.mar;h=2a752489f551b66534a64f8fd72b4c9b9f509f7a;hp=402ff87aef706c90cd17b8ad129a86f6f3ea60b4;hb=6ab285bf4c9e0f48f3e8af1ad952cd5224c7d461;hpb=f60ceb54eb959ce1b3e7fa22a0ec2ce7ee283788 diff --git a/crypto/bn/asm/vms.mar b/crypto/bn/asm/vms.mar index 402ff87aef..2a752489f5 100644 --- a/crypto/bn/asm/vms.mar +++ b/crypto/bn/asm/vms.mar @@ -1,4 +1,4 @@ - .title vax_bn_mul_add_word unsigned multiply & add, 32*32+32+32=>64 + .title vax_bn_mul_add_words unsigned multiply & add, 32*32+32+32=>64 ; ; w.j.m. 15-jan-1999 ; @@ -59,7 +59,7 @@ w=16 ;(AP) w by value (input) movl r6,r0 ; return c ret - .title vax_bn_mul_word unsigned multiply & add, 32*32+32=>64 + .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64 ; ; w.j.m. 15-jan-1999 ; @@ -187,11 +187,8 @@ n=12 ;(AP) n by value (input) ; view, i.e. when the highest bit is set), dividing the dividend by ; 2 isn't enough, it needs to be divided by 4. Furthermore, the ; divisor needs to be divided by 2 (unsigned) as well, to avoid more -; problems with the sign. In this case, the divisor is so large, -; from an unsigned point of view, that the dropped lowest bit is -; insignificant for the operation, and therefore doesn't need -; bothering with. The remainder might end up incorrect, bit that's -; adjusted at the end of the routine anyway. +; problems with the sign. In this case, a little extra fiddling with +; the remainder is required. ; ; So, the simplest way to handle this is always to divide the dividend ; by 4, and to divide the divisor by 2 if it's highest bit is set. @@ -213,10 +210,20 @@ n=12 ;(AP) n by value (input) ; if (q < 0) q = -q # I doubt this is necessary any more ; ; r' = r >> 30 -; if (d' > 0) q = q << 1 +; if (d' >= 0) q = q << 1 ; q = q << 1 ; r = (r << 2) + l' ; +; if (d' < 0) +; { +; [r',r] = [r',r] - q +; while ([r',r] < 0) +; { +; [r',r] = [r',r] + d +; q = q - 1 +; } +; } +; ; while ([r',r] >= d) ; { ; [r',r] = [r',r] - d @@ -278,13 +285,26 @@ d=12 ;(AP) d by value (input) bicl3 #^X00000003,r3,r3 addl r5,r3 ; r = r + l' + tstl r7 + bgeq 5$ + bitl #1,r7 + beql 5$ ; if d < 0 && d & 1 + subl r2,r3 ; [r',r] = [r',r] - q + sbwc #0,r6 +45$: + bgeq 5$ ; while r < 0 + decl r2 ; q = q - 1 + addl r7,r3 ; [r',r] = [r',r] + d + adwc #0,r6 + brb 45$ + 5$: tstl r6 bneq 6$ cmpl r3,r7 blssu 42$ ; while [r',r] >= d' 6$: - subl r7,r3 ; r = r - d + subl r7,r3 ; [r',r] = [r',r] - d sbwc #0,r6 incl r2 ; q = q + 1 brb 5$