📄 pa-risc2.s
字号:
FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) XMPYU fht_0,fw_l,fm1 ; m1 = ht*fw_l FSTD fm1,-16(%sp) ; -16(sp) = m1 XMPYU flt_0,fw_h,fm ; m = lt*fw_h FSTD fm,-8(%sp) ; -8(sp) = m XMPYU fht_0,fw_h,ht_temp ; ht_temp = ht*fw_h FSTD ht_temp,-24(%sp) ; -24(sp) = ht XMPYU flt_0,fw_l,lt_temp ; lt_temp = lt*fw_l FSTD lt_temp,-32(%sp) ; -32(sp) = lt LDD -8(%sp),m_0 LDD -16(%sp),m1_0 ADD,L m_0,m1_0,tmp_0 ; tmp_0 = m + m1; LDD -24(%sp),ht_0 LDD -32(%sp),lt_0 CMPCLR,*>>= tmp_0,m1_0,%r0 ; if (m < m1) ADD,L ht_0,top_overflow,ht_0 ; ht += (1<<32) EXTRD,U tmp_0,31,32,m_0 ; m>>32 DEPD,Z tmp_0,31,32,m1_0 ; m1 = m<<32 ADD,L ht_0,m_0,ht_0 ; ht+= (m>>32) ADD lt_0,m1_0,lt_0 ; lt= lt+m1; ADD,DC ht_0,%r0,ht_0 ; ht++ ADD %ret1,lt_0,lt_0 ; lt = lt + c; ADD,DC ht_0,%r0,ht_0 ; ht++ COPY ht_0,%ret1 ; copy carry STD lt_0,0(r_ptr) ; rp[0] = ltbn_mul_words_exit .EXIT EXTRD,U %ret1,31,32,%ret0 ; for 32-bit, return in ret0/ret1 LDD -96(%sp),%r7 ; restore r7 LDD -104(%sp),%r6 ; restore r6 LDD -112(%sp),%r5 ; restore r5 LDD -120(%sp),%r4 ; restore r4 BVE (%rp) LDD,MB -128(%sp),%r3 ; restore r3 .PROCEND ;----------------------------------------------------------------------------;;void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num);; arg0 = rp; arg1 = ap; arg2 = num;bn_sqr_words .proc .callinfo FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE .EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN .entry .align 64 STD %r3,0(%sp) ; save r3 STD %r4,8(%sp) ; save r4 NOP STD %r5,16(%sp) ; save r5 CMPIB,>= 0,num,bn_sqr_words_exit LDO 128(%sp),%sp ; bump stack ; ; If only 1, the goto straight to cleanup ; CMPIB,= 1,num,bn_sqr_words_single_top DEPDI,Z -1,32,33,high_mask ; Create Mask 0xffffffff80000000L ; ; This loop is unrolled 2 times (64-byte aligned as well) ;bn_sqr_words_unroll2 FLDD 0(a_ptr),t_float_0 ; a[0] FLDD 8(a_ptr),t_float_1 ; a[1] XMPYU fht_0,flt_0,fm ; m[0] XMPYU fht_1,flt_1,fm_1 ; m[1] FSTD fm,-24(%sp) ; store m[0] FSTD fm_1,-56(%sp) ; store m[1] XMPYU flt_0,flt_0,lt_temp ; lt[0] XMPYU flt_1,flt_1,lt_temp_1 ; lt[1] FSTD lt_temp,-16(%sp) ; store lt[0] FSTD lt_temp_1,-48(%sp) ; store lt[1] XMPYU fht_0,fht_0,ht_temp ; ht[0] XMPYU fht_1,fht_1,ht_temp_1 ; ht[1] FSTD ht_temp,-8(%sp) ; store ht[0] FSTD ht_temp_1,-40(%sp) ; store ht[1] LDD -24(%sp),m_0 LDD -56(%sp),m_1 AND m_0,high_mask,tmp_0 ; m[0] & Mask AND m_1,high_mask,tmp_1 ; m[1] & Mask DEPD,Z m_0,30,31,m_0 ; m[0] << 32+1 DEPD,Z m_1,30,31,m_1 ; m[1] << 32+1 LDD -16(%sp),lt_0 LDD -48(%sp),lt_1 EXTRD,U tmp_0,32,33,tmp_0 ; tmp_0 = m[0]&Mask >> 32-1 EXTRD,U tmp_1,32,33,tmp_1 ; tmp_1 = m[1]&Mask >> 32-1 LDD -8(%sp),ht_0 LDD -40(%sp),ht_1 ADD,L ht_0,tmp_0,ht_0 ; ht[0] += tmp_0 ADD,L ht_1,tmp_1,ht_1 ; ht[1] += tmp_1 ADD lt_0,m_0,lt_0 ; lt = lt+m ADD,DC ht_0,%r0,ht_0 ; ht[0]++ STD lt_0,0(r_ptr) ; rp[0] = lt[0] STD ht_0,8(r_ptr) ; rp[1] = ht[1] ADD lt_1,m_1,lt_1 ; lt = lt+m ADD,DC ht_1,%r0,ht_1 ; ht[1]++ STD lt_1,16(r_ptr) ; rp[2] = lt[1] STD ht_1,24(r_ptr) ; rp[3] = ht[1] LDO -2(num),num ; num = num - 2; LDO 16(a_ptr),a_ptr ; ap += 2 CMPIB,<= 2,num,bn_sqr_words_unroll2 LDO 32(r_ptr),r_ptr ; rp += 4 CMPIB,=,N 0,num,bn_sqr_words_exit ; are we done? ; ; Top of loop aligned on 64-byte boundary ;bn_sqr_words_single_top FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) XMPYU fht_0,flt_0,fm ; m FSTD fm,-24(%sp) ; store m XMPYU flt_0,flt_0,lt_temp ; lt FSTD lt_temp,-16(%sp) ; store lt XMPYU fht_0,fht_0,ht_temp ; ht FSTD ht_temp,-8(%sp) ; store ht LDD -24(%sp),m_0 ; load m AND m_0,high_mask,tmp_0 ; m & Mask DEPD,Z m_0,30,31,m_0 ; m << 32+1 LDD -16(%sp),lt_0 ; lt LDD -8(%sp),ht_0 ; ht EXTRD,U tmp_0,32,33,tmp_0 ; tmp_0 = m&Mask >> 32-1 ADD m_0,lt_0,lt_0 ; lt = lt+m ADD,L ht_0,tmp_0,ht_0 ; ht += tmp_0 ADD,DC ht_0,%r0,ht_0 ; ht++ STD lt_0,0(r_ptr) ; rp[0] = lt STD ht_0,8(r_ptr) ; rp[1] = htbn_sqr_words_exit .EXIT LDD -112(%sp),%r5 ; restore r5 LDD -120(%sp),%r4 ; restore r4 BVE (%rp) LDD,MB -128(%sp),%r3 .PROCEND ;in=23,24,25,26,29;out=28;;----------------------------------------------------------------------------;;BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n);; arg0 = rp ; arg1 = ap; arg2 = bp ; arg3 = nt .reg %r22b .reg %r21l .reg %r20bn_add_words .proc .entry .callinfo .EXPORT bn_add_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN .align 64 CMPIB,>= 0,n,bn_add_words_exit COPY %r0,%ret1 ; return 0 by default ; ; If 2 or more numbers do the loop ; CMPIB,= 1,n,bn_add_words_single_top NOP ; ; This loop is unrolled 2 times (64-byte aligned as well) ;bn_add_words_unroll2 LDD 0(a_ptr),t LDD 0(b_ptr),b ADD t,%ret1,t ; t = t+c; ADD,DC %r0,%r0,%ret1 ; set c to carry ADD t,b,l ; l = t + b[0] ADD,DC %ret1,%r0,%ret1 ; c+= carry STD l,0(r_ptr) LDD 8(a_ptr),t LDD 8(b_ptr),b ADD t,%ret1,t ; t = t+c; ADD,DC %r0,%r0,%ret1 ; set c to carry ADD t,b,l ; l = t + b[0] ADD,DC %ret1,%r0,%ret1 ; c+= carry STD l,8(r_ptr) LDO -2(n),n LDO 16(a_ptr),a_ptr LDO 16(b_ptr),b_ptr CMPIB,<= 2,n,bn_add_words_unroll2 LDO 16(r_ptr),r_ptr CMPIB,=,N 0,n,bn_add_words_exit ; are we done?bn_add_words_single_top LDD 0(a_ptr),t LDD 0(b_ptr),b ADD t,%ret1,t ; t = t+c; ADD,DC %r0,%r0,%ret1 ; set c to carry (could use CMPCLR??) ADD t,b,l ; l = t + b[0] ADD,DC %ret1,%r0,%ret1 ; c+= carry STD l,0(r_ptr)bn_add_words_exit .EXIT BVE (%rp) EXTRD,U %ret1,31,32,%ret0 ; for 32-bit, return in ret0/ret1 .PROCEND ;in=23,24,25,26,29;out=28;;----------------------------------------------------------------------------;;BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n);; arg0 = rp ; arg1 = ap; arg2 = bp ; arg3 = nt1 .reg %r22t2 .reg %r21sub_tmp1 .reg %r20sub_tmp2 .reg %r19bn_sub_words .proc .callinfo .EXPORT bn_sub_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN .entry .align 64 CMPIB,>= 0,n,bn_sub_words_exit COPY %r0,%ret1 ; return 0 by default ; ; If 2 or more numbers do the loop ; CMPIB,= 1,n,bn_sub_words_single_top NOP ; ; This loop is unrolled 2 times (64-byte aligned as well) ;bn_sub_words_unroll2 LDD 0(a_ptr),t1 LDD 0(b_ptr),t2 SUB t1,t2,sub_tmp1 ; t3 = t1-t2; SUB sub_tmp1,%ret1,sub_tmp1 ; t3 = t3- c; CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 LDO 1(%r0),sub_tmp2 CMPCLR,*= t1,t2,%r0 COPY sub_tmp2,%ret1 STD sub_tmp1,0(r_ptr) LDD 8(a_ptr),t1 LDD 8(b_ptr),t2 SUB t1,t2,sub_tmp1 ; t3 = t1-t2; SUB sub_tmp1,%ret1,sub_tmp1 ; t3 = t3- c; CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 LDO 1(%r0),sub_tmp2 CMPCLR,*= t1,t2,%r0 COPY sub_tmp2,%ret1 STD sub_tmp1,8(r_ptr) LDO -2(n),n LDO 16(a_ptr),a_ptr LDO 16(b_ptr),b_ptr CMPIB,<= 2,n,bn_sub_words_unroll2 LDO 16(r_ptr),r_ptr CMPIB,=,N 0,n,bn_sub_words_exit ; are we done?bn_sub_words_single_top LDD 0(a_ptr),t1 LDD 0(b_ptr),t2 SUB t1,t2,sub_tmp1 ; t3 = t1-t2; SUB sub_tmp1,%ret1,sub_tmp1 ; t3 = t3- c; CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 LDO 1(%r0),sub_tmp2 CMPCLR,*= t1,t2,%r0 COPY sub_tmp2,%ret1 STD sub_tmp1,0(r_ptr)bn_sub_words_exit .EXIT BVE (%rp) EXTRD,U %ret1,31,32,%ret0 ; for 32-bit, return in ret0/ret1 .PROCEND ;in=23,24,25,26,29;out=28;;------------------------------------------------------------------------------;; unsigned long bn_div_words(unsigned long h, unsigned long l, unsigned long d);; arg0 = h; arg1 = l; arg2 = d;; This is mainly just output from the HP C compiler. ;;------------------------------------------------------------------------------bn_div_words .PROC .EXPORT bn_div_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR,LONG_RETURN .IMPORT BN_num_bits_word,CODE ;--- not PIC .IMPORT __iob,DATA ;--- not PIC .IMPORT fprintf,CODE .IMPORT abort,CODE .IMPORT $$div2U,MILLICODE .CALLINFO CALLER,FRAME=144,ENTRY_GR=%r9,SAVE_RP,ARGS_SAVED,ORDERING_AWARE .ENTRY STW %r2,-20(%r30) ;offset 0x8ec STW,MA %r3,192(%r30) ;offset 0x8f0 STW %r4,-188(%r30) ;offset 0x8f4 DEPD %r5,31,32,%r6 ;offset 0x8f8 STD %r6,-184(%r30) ;offset 0x8fc DEPD %r7,31,32,%r8 ;offset 0x900 STD %r8,-176(%r30) ;offset 0x904 STW %r9,-168(%r30) ;offset 0x908 LDD -248(%r30),%r3 ;offset 0x90c COPY %r26,%r4 ;offset 0x910 COPY %r24,%r5 ;offset 0x914 DEPD %r25,31,32,%r4 ;offset 0x918 CMPB,*<> %r3,%r0,$0006000C ;offset 0x91c DEPD %r23,31,32,%r5 ;offset 0x920 MOVIB,TR -1,%r29,$00060002 ;offset 0x924 EXTRD,U %r29,31,32,%r28 ;offset 0x928$0006002A LDO -1(%r29),%r29 ;offset 0x92c SUB %r23,%r7,%r23 ;offset 0x930$00060024 SUB %r4,%r31,%r25 ;offset 0x934 AND %r25,%r19,%r26 ;offset 0x938 CMPB,*<>,N %r0,%r26,$00060046 ;offset 0x93c DEPD,Z %r25,31,32,%r20 ;offset 0x940 OR %r20,%r24,%r21 ;offset 0x944 CMPB,*<<,N %r21,%r23,$0006002A ;offset 0x948 SUB %r31,%r2,%r31 ;offset 0x94c$00060046$0006002E DEPD,Z %r23,31,32,%r25 ;offset 0x950 EXTRD,U %r23,31,32,%r26 ;offset 0x954 AND %r25,%r19,%r24 ;offset 0x958 ADD,L %r31,%r26,%r31 ;offset 0x95c CMPCLR,*>>= %r5,%r24,%r0 ;offset 0x960 LDO 1(%r31),%r31 ;offset 0x964$00060032 CMPB,*<<=,N %r31,%r4,$00060036 ;offset 0x968 LDO -1(%r29),%r29 ;offset 0x96c ADD,L %r4,%r3,%r4 ;offset 0x970$00060036 ADDIB,=,N -1,%r8,$D0 ;offset 0x974 SUB %r5,%r24,%r28 ;offset 0x978$0006003A SUB %r4,%r31,%r24 ;offset 0x97c SHRPD %r24,%r28,32,%r4 ;offset 0x980 DEPD,Z %r29,31,32,%r9 ;offset 0x984 DEPD,Z %r28,31,32,%r5 ;offset 0x988$0006001C EXTRD,U %r4,31,32,%r31 ;offset 0x98c CMPB,*<>,N %r31,%r2,$00060020 ;offset 0x990 MOVB,TR %r6,%r29,$D1 ;offset 0x994 STD %r29,-152(%r30) ;offset 0x998$0006000C EXTRD,U %r3,31,32,%r25 ;offset 0x99c COPY %r3,%r26 ;offset 0x9a0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -