📄 vms.mar
字号:
.title vax_bn_mul_add_word unsigned multiply & add, 32*32+32+32=>64;; w.j.m. 15-jan-1999;; it's magic ...;; ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) {; ULONG c = 0;; int i;; for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ;; return c;; }r=4 ;(AP)a=8 ;(AP)n=12 ;(AP) n by value (input)w=16 ;(AP) w by value (input) .psect code,nowrt.entry bn_mul_add_words,^m<r2,r3,r4,r5,r6> moval @r(ap),r2 moval @a(ap),r3 movl n(ap),r4 ; assumed >0 by C code movl w(ap),r5 clrl r6 ; c0$: emul r5,(r3),(r2),r0 ; w, a[], r[] considered signed ; fixup for "negative" r[] tstl (r2) bgeq 10$ incl r110$: ; add in c addl2 r6,r0 adwc #0,r1 ; combined fixup for "negative" w, a[] tstl r5 bgeq 20$ addl2 (r3),r120$: tstl (r3) bgeq 30$ addl2 r5,r130$: movl r0,(r2)+ ; store lo result in r[] & advance addl #4,r3 ; advance a[] movl r1,r6 ; store hi result => c sobgtr r4,0$ movl r6,r0 ; return c ret .title vax_bn_mul_word unsigned multiply & add, 32*32+32=>64;; w.j.m. 15-jan-1999;; it's magic ...;; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) {; ULONG c = 0;; int i;; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ;; return(c);; }r=4 ;(AP)a=8 ;(AP)n=12 ;(AP) n by value (input)w=16 ;(AP) w by value (input) .psect code,nowrt.entry bn_mul_words,^m<r2,r3,r4,r5,r6> moval @r(ap),r2 ; r2 -> r[] moval @a(ap),r3 ; r3 -> a[] movl n(ap),r4 ; r4 = loop count (assumed >0 by C code) movl w(ap),r5 ; r5 = w clrl r6 ; r6 = c0$: ; <r1,r0> := w * a[] + c emul r5,(r3),r6,r0 ; w, a[], c considered signed ; fixup for "negative" c tstl r6 ; c bgeq 10$ incl r110$: ; combined fixup for "negative" w, a[] tstl r5 ; w bgeq 20$ addl2 (r3),r1 ; a[]20$: tstl (r3) ; a[] bgeq 30$ addl2 r5,r1 ; w30$: movl r0,(r2)+ ; store lo result in r[] & advance addl #4,r3 ; advance a[] movl r1,r6 ; store hi result => c sobgtr r4,0$ movl r6,r0 ; return c ret .title vax_bn_sqr_words unsigned square, 32*32=>64;; w.j.m. 15-jan-1999;; it's magic ...;; void bn_sqr_words(ULONG r[],ULONG a[],int n) {; int i;; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ;; }r=4 ;(AP)a=8 ;(AP)n=12 ;(AP) n by value (input) .psect code,nowrt.entry bn_sqr_words,^m<r2,r3,r4,r5> moval @r(ap),r2 ; r2 -> r[] moval @a(ap),r3 ; r3 -> a[] movl n(ap),r4 ; r4 = n (assumed >0 by C code)0$: movl (r3)+,r5 ; r5 = a[] & advance ; <r1,r0> := a[] * a[] emul r5,r5,#0,r0 ; a[] considered signed ; fixup for "negative" a[] tstl r5 ; a[] bgeq 30$ addl2 r5,r1 ; a[] addl2 r5,r1 ; a[]30$: movl r0,(r2)+ ; store lo result in r[] & advance movl r1,(r2)+ ; store hi result in r[] & advance sobgtr r4,0$ movl #1,r0 ; return SS$_NORMAL ret .title (generated) .psect code,nowrt.entry BN_DIV_WORDS,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10> subl2 #4,sp clrl r9 movl #2,r8 tstl 12(ap) bneq noname.2 mnegl #1,r10 brw noname.3 tstl r0 nop noname.2: pushl 12(ap) calls #1,BN_NUM_BITS_WORD movl r0,r7 cmpl r7,#32 beql noname.4 ashl r7,#1,r2 cmpl 4(ap),r2 blequ noname.4 pushl r7 calls #1,BN_DIV_WORDS_ABORTnoname.4: subl3 r7,#32,r7 movl 12(ap),r2 cmpl 4(ap),r2 blssu noname.5 subl2 r2,4(ap)noname.5: tstl r7 beql noname.6 ashl r7,r2,12(ap) ashl r7,4(ap),r4 subl3 r7,#32,r3 subl3 r3,#32,r2 extzv r3,r2,8(ap),r2 bisl3 r4,r2,4(ap) ashl r7,8(ap),8(ap)noname.6: bicl3 #65535,12(ap),r2 extzv #16,#16,r2,r5 bicl3 #-65536,12(ap),r6noname.7: moval 4(ap),r2 movzwl 2(r2),r0 cmpl r0,r5 bneq noname.8 movzwl #65535,r4 brb noname.9noname.8: clrl r1 movl (r2),r0 movl r5,r2 bgeq vcg.1 cmpl r2,r0 bgtru vcg.2 incl r1 brb vcg.2 nop vcg.1: ediv r2,r0,r1,r0vcg.2: movl r1,r4noname.9:noname.10: mull3 r5,r4,r0 subl3 r0,4(ap),r3 bicl3 #65535,r3,r0 bneq noname.13 mull3 r6,r4,r2 ashl #16,r3,r1 bicl3 #65535,8(ap),r0 extzv #16,#16,r0,r0 addl2 r0,r1 cmpl r2,r1 bgtru noname.12noname.11: brb noname.13 nop noname.12: decl r4 brb noname.10noname.13: mull3 r5,r4,r1 mull3 r6,r4,r0 extzv #16,#16,r0,r3 ashl #16,r0,r2 bicl3 #65535,r2,r0 addl2 r3,r1 moval 8(ap),r3 cmpl (r3),r0 bgequ noname.15 incl r1noname.15: subl2 r0,(r3) cmpl 4(ap),r1 bgequ noname.16 addl2 12(ap),4(ap) decl r4noname.16: subl2 r1,4(ap) decl r8 beql noname.18noname.17: ashl #16,r4,r9 ashl #16,4(ap),r2 movzwl 2(r3),r0 bisl2 r0,r2 bicl3 #0,r2,4(ap) bicl3 #-65536,(r3),r0 ashl #16,r0,(r3) brw noname.7 nop noname.18: bisl2 r4,r9 movl r9,r10noname.3: movl r10,r0 ret tstl r0 .psect code,nowrt.entry BN_ADD_WORDS,^m<r2,r3,r4,r5,r6,r7> tstl 16(ap) bgtr noname.21 clrl r7 brw noname.22noname.21: clrl r4 tstl r0noname.23: movl 8(ap),r6 addl3 r4,(r6),r2 bicl2 #0,r2 clrl r0 cmpl r2,r4 bgequ vcg.3 incl r0vcg.3: movl r0,r4 movl 12(ap),r5 addl3 (r5),r2,r1 bicl2 #0,r1 clrl r0 cmpl r1,r2 bgequ vcg.4 incl r0vcg.4: addl2 r0,r4 movl 4(ap),r3 movl r1,(r3) decl 16(ap) bgtr gen.1 brw noname.25gen.1:noname.24: addl3 r4,4(r6),r2 bicl2 #0,r2 clrl r0 cmpl r2,r4 bgequ vcg.5 incl r0vcg.5: movl r0,r4 addl3 4(r5),r2,r1 bicl2 #0,r1 clrl r0 cmpl r1,r2 bgequ vcg.6 incl r0vcg.6: addl2 r0,r4 movl r1,4(r3) decl 16(ap) bleq noname.25noname.26: addl3 r4,8(r6),r2 bicl2 #0,r2 clrl r0 cmpl r2,r4 bgequ vcg.7 incl r0vcg.7: movl r0,r4 addl3 8(r5),r2,r1 bicl2 #0,r1 clrl r0 cmpl r1,r2 bgequ vcg.8 incl r0vcg.8: addl2 r0,r4 movl r1,8(r3) decl 16(ap) bleq noname.25noname.27: addl3 r4,12(r6),r2 bicl2 #0,r2 clrl r0 cmpl r2,r4 bgequ vcg.9 incl r0vcg.9: movl r0,r4 addl3 12(r5),r2,r1 bicl2 #0,r1 clrl r0 cmpl r1,r2 bgequ vcg.10 incl r0vcg.10: addl2 r0,r4 movl r1,12(r3) decl 16(ap) bleq noname.25noname.28: addl3 #16,r6,8(ap) addl3 #16,r5,12(ap) addl3 #16,r3,4(ap) brw noname.23 tstl r0noname.25: movl r4,r7noname.22: movl r7,r0 ret nop ;r=4 ;(AP);a=8 ;(AP);b=12 ;(AP);n=16 ;(AP) n by value (input) .psect code,nowrt.entry BN_SUB_WORDS,^m<r2,r3,r4,r5,r6,r7> clrl r6 tstl 16(ap) bgtr noname.31 clrl r7 brw noname.32 tstl r0noname.31:noname.33: movl 8(ap),r5 movl (r5),r1 movl 12(ap),r4 movl (r4),r2 movl 4(ap),r3 subl3 r2,r1,r0 subl2 r6,r0 bicl3 #0,r0,(r3) cmpl r1,r2 beql noname.34 clrl r0 cmpl r1,r2 bgequ vcg.11 incl r0vcg.11: movl r0,r6noname.34: decl 16(ap) bgtr gen.2 brw noname.36gen.2:noname.35: movl 4(r5),r2 movl 4(r4),r1 subl3 r1,r2,r0 subl2 r6,r0 bicl3 #0,r0,4(r3) cmpl r2,r1 beql noname.37 clrl r0 cmpl r2,r1 bgequ vcg.12 incl r0vcg.12: movl r0,r6noname.37: decl 16(ap) bleq noname.36noname.38: movl 8(r5),r1 movl 8(r4),r2 subl3 r2,r1,r0 subl2 r6,r0 bicl3 #0,r0,8(r3) cmpl r1,r2 beql noname.39 clrl r0 cmpl r1,r2 bgequ vcg.13 incl r0vcg.13: movl r0,r6noname.39: decl 16(ap) bleq noname.36noname.40: movl 12(r5),r1 movl 12(r4),r2 subl3 r2,r1,r0 subl2 r6,r0 bicl3 #0,r0,12(r3) cmpl r1,r2 beql noname.41 clrl r0 cmpl r1,r2 bgequ vcg.14 incl r0vcg.14: movl r0,r6noname.41: decl 16(ap) bleq noname.36noname.42: addl3 #16,r5,8(ap) addl3 #16,r4,12(ap) addl3 #16,r3,4(ap) brw noname.33 tstl r0noname.36: movl r6,r7noname.32: movl r7,r0 ret nop ;r=4 ;(AP);a=8 ;(AP);b=12 ;(AP);n=16 ;(AP) n by value (input) .psect code,nowrt.entry BN_MUL_COMBA8,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> movab -924(sp),sp clrq r8 clrl r10 movl 8(ap),r6 movzwl 2(r6),r3 movl 12(ap),r7 bicl3 #-65536,(r7),r2 movzwl 2(r7),r0 bicl2 #-65536,r0 bicl3 #-65536,(r6),-12(fp) bicl3 #-65536,r3,-16(fp) mull3 r0,-12(fp),-4(fp) mull2 r2,-12(fp) mull3 r2,-16(fp),-8(fp) mull2 r0,-16(fp) addl3 -4(fp),-8(fp),r0 bicl3 #0,r0,-4(fp) cmpl -4(fp),-8(fp) bgequ noname.45 addl2 #65536,-16(fp)noname.45: movzwl -2(fp),r0 bicl2 #-65536,r0 addl2 r0,-16(fp) bicl3 #-65536,-4(fp),r0 ashl #16,r0,-8(fp) addl3 -8(fp),-12(fp),r0 bicl3 #0,r0,-12(fp) cmpl -12(fp),-8(fp) bgequ noname.46 incl -16(fp)noname.46: movl -12(fp),r1 movl -16(fp),r2 addl2 r1,r9 bicl2 #0,r9 cmpl r9,r1 bgequ noname.47 incl r2noname.47: addl2 r2,r8 bicl2 #0,r8 cmpl r8,r2 bgequ noname.48 incl r10noname.48: movl 4(ap),r11 movl r9,(r11) clrl r9 movzwl 2(r6),r2 bicl3 #-65536,4(r7),r3 movzwl 6(r7),r0 bicl2 #-65536,r0 bicl3 #-65536,(r6),-28(fp) bicl3 #-65536,r2,-32(fp) mull3 r0,-28(fp),-20(fp) mull2 r3,-28(fp) mull3 r3,-32(fp),-24(fp) mull2 r0,-32(fp) addl3 -20(fp),-24(fp),r0 bicl3 #0,r0,-20(fp) cmpl -20(fp),-24(fp) bgequ noname.49 addl2 #65536,-32(fp)noname.49: movzwl -18(fp),r0 bicl2 #-65536,r0 addl2 r0,-32(fp) bicl3 #-65536,-20(fp),r0 ashl #16,r0,-24(fp) addl3 -24(fp),-28(fp),r0 bicl3 #0,r0,-28(fp) cmpl -28(fp),-24(fp) bgequ noname.50 incl -32(fp)noname.50: movl -28(fp),r1 movl -32(fp),r2 addl2 r1,r8 bicl2 #0,r8 cmpl r8,r1 bgequ noname.51 incl r2noname.51: addl2 r2,r10 bicl2 #0,r10 cmpl r10,r2 bgequ noname.52 incl r9noname.52: movzwl 6(r6),r2 bicl3 #-65536,(r7),r3 movzwl 2(r7),r0 bicl2 #-65536,r0 bicl3 #-65536,4(r6),-44(fp) bicl3 #-65536,r2,-48(fp) mull3 r0,-44(fp),-36(fp) mull2 r3,-44(fp) mull3 r3,-48(fp),-40(fp) mull2 r0,-48(fp) addl3 -36(fp),-40(fp),r0 bicl3 #0,r0,-36(fp) cmpl -36(fp),-40(fp) bgequ noname.53 addl2 #65536,-48(fp)noname.53: movzwl -34(fp),r0 bicl2 #-65536,r0 addl2 r0,-48(fp) bicl3 #-65536,-36(fp),r0 ashl #16,r0,-40(fp) addl3 -40(fp),-44(fp),r0 bicl3 #0,r0,-44(fp) cmpl -44(fp),-40(fp) bgequ noname.54 incl -48(fp)noname.54: movl -44(fp),r1 movl -48(fp),r2 addl2 r1,r8 bicl2 #0,r8 cmpl r8,r1 bgequ noname.55 incl r2noname.55: addl2 r2,r10 bicl2 #0,r10 cmpl r10,r2 bgequ noname.56 incl r9noname.56: movl r8,4(r11) clrl r8 movzwl 10(r6),r2 bicl3 #-65536,(r7),r3 movzwl 2(r7),r0 bicl2 #-65536,r0 bicl3 #-65536,8(r6),-60(fp) bicl3 #-65536,r2,-64(fp) mull3 r0,-60(fp),-52(fp) mull2 r3,-60(fp) mull3 r3,-64(fp),-56(fp) mull2 r0,-64(fp) addl3 -52(fp),-56(fp),r0 bicl3 #0,r0,-52(fp) cmpl -52(fp),-56(fp) bgequ noname.57 addl2 #65536,-64(fp)noname.57: movzwl -50(fp),r0 bicl2 #-65536,r0 addl2 r0,-64(fp) bicl3 #-65536,-52(fp),r0 ashl #16,r0,-56(fp) addl3 -56(fp),-60(fp),r0 bicl3 #0,r0,-60(fp) cmpl -60(fp),-56(fp) bgequ noname.58 incl -64(fp)noname.58: movl -60(fp),r1 movl -64(fp),r2 addl2 r1,r10 bicl2 #0,r10 cmpl r10,r1 bgequ noname.59 incl r2noname.59: addl2 r2,r9 bicl2 #0,r9 cmpl r9,r2 bgequ noname.60 incl r8noname.60: movzwl 6(r6),r2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -