1 1.1 mrg dnl SPARC mpn_sub_n -- Subtract two limb vectors of the same length > 0 and 2 1.1 mrg dnl store difference in a third limb vector. 3 1.1 mrg 4 1.1 mrg dnl Copyright 2001 Free Software Foundation, Inc. 5 1.1 mrg 6 1.1 mrg dnl This file is part of the GNU MP Library. 7 1.1.1.2 mrg dnl 8 1.1 mrg dnl The GNU MP Library is free software; you can redistribute it and/or modify 9 1.1.1.2 mrg dnl it under the terms of either: 10 1.1.1.2 mrg dnl 11 1.1.1.2 mrg dnl * the GNU Lesser General Public License as published by the Free 12 1.1.1.2 mrg dnl Software Foundation; either version 3 of the License, or (at your 13 1.1.1.2 mrg dnl option) any later version. 14 1.1.1.2 mrg dnl 15 1.1.1.2 mrg dnl or 16 1.1.1.2 mrg dnl 17 1.1.1.2 mrg dnl * the GNU General Public License as published by the Free Software 18 1.1.1.2 mrg dnl Foundation; either version 2 of the License, or (at your option) any 19 1.1.1.2 mrg dnl later version. 20 1.1.1.2 mrg dnl 21 1.1.1.2 mrg dnl or both in parallel, as here. 22 1.1.1.2 mrg dnl 23 1.1 mrg dnl The GNU MP Library is distributed in the hope that it will be useful, but 24 1.1 mrg dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 25 1.1.1.2 mrg dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26 1.1.1.2 mrg dnl for more details. 27 1.1.1.2 mrg dnl 28 1.1.1.2 mrg dnl You should have received copies of the GNU General Public License and the 29 1.1.1.2 mrg dnl GNU Lesser General Public License along with the GNU MP Library. If not, 30 1.1.1.2 mrg dnl see https://www.gnu.org/licenses/. 31 1.1 mrg 32 1.1 mrg 33 1.1 mrg include(`../config.m4') 34 1.1 mrg 35 1.1 mrg C INPUT PARAMETERS 36 1.1 mrg define(rp,%o0) 37 1.1 mrg define(s1p,%o1) 38 1.1 mrg define(s2p,%o2) 39 1.1 mrg define(n,%o3) 40 1.1 mrg define(cy,%g1) 41 1.1 mrg 42 1.1 mrg C This code uses 64-bit operations on `o' and `g' registers. It doesn't 43 1.1 mrg C require that `o' registers' upper 32 bits are preserved by the operating 44 1.1 mrg C system, but if they are not, they must be zeroed. That is indeed what 45 1.1 mrg C happens at least on Slowaris 2.5 and 2.6. 46 1.1 mrg 47 1.1 mrg C On UltraSPARC 1 and 2, this code runs at 3 cycles/limb from the Dcache and at 48 1.1 mrg C about 10 cycles/limb from the Ecache. 49 1.1 mrg 50 1.1 mrg ASM_START() 51 1.1 mrg PROLOGUE(mpn_sub_n) 52 1.1 mrg lduw [s1p+0],%o4 53 1.1 mrg lduw [s2p+0],%o5 54 1.1 mrg addcc n,-2,n 55 1.1 mrg bl,pn %icc,L(end1) 56 1.1 mrg lduw [s1p+4],%g2 57 1.1 mrg lduw [s2p+4],%g3 58 1.1 mrg be,pn %icc,L(end2) 59 1.1 mrg mov 0,cy 60 1.1 mrg 61 1.1 mrg .align 16 62 1.1 mrg L(loop): 63 1.1 mrg sub %o4,%o5,%g4 64 1.1 mrg add rp,8,rp 65 1.1 mrg lduw [s1p+8],%o4 66 1.1 mrg fitod %f0,%f2 67 1.1 mrg C --- 68 1.1 mrg sub %g4,cy,%g4 69 1.1 mrg addcc n,-1,n 70 1.1 mrg lduw [s2p+8],%o5 71 1.1 mrg fitod %f0,%f2 72 1.1 mrg C --- 73 1.1 mrg srlx %g4,63,cy 74 1.1 mrg add s2p,8,s2p 75 1.1 mrg stw %g4,[rp-8] 76 1.1 mrg be,pn %icc,L(exito)+4 77 1.1 mrg C --- 78 1.1 mrg sub %g2,%g3,%g4 79 1.1 mrg addcc n,-1,n 80 1.1 mrg lduw [s1p+12],%g2 81 1.1 mrg fitod %f0,%f2 82 1.1 mrg C --- 83 1.1 mrg sub %g4,cy,%g4 84 1.1 mrg add s1p,8,s1p 85 1.1 mrg lduw [s2p+4],%g3 86 1.1 mrg fitod %f0,%f2 87 1.1 mrg C --- 88 1.1 mrg srlx %g4,63,cy 89 1.1 mrg bne,pt %icc,L(loop) 90 1.1 mrg stw %g4,[rp-4] 91 1.1 mrg C --- 92 1.1 mrg L(exite): 93 1.1 mrg sub %o4,%o5,%g4 94 1.1 mrg sub %g4,cy,%g4 95 1.1 mrg srlx %g4,63,cy 96 1.1 mrg stw %g4,[rp+0] 97 1.1 mrg sub %g2,%g3,%g4 98 1.1 mrg sub %g4,cy,%g4 99 1.1 mrg stw %g4,[rp+4] 100 1.1 mrg retl 101 1.1 mrg srlx %g4,63,%o0 102 1.1 mrg 103 1.1 mrg L(exito): 104 1.1 mrg sub %g2,%g3,%g4 105 1.1 mrg sub %g4,cy,%g4 106 1.1 mrg srlx %g4,63,cy 107 1.1 mrg stw %g4,[rp-4] 108 1.1 mrg sub %o4,%o5,%g4 109 1.1 mrg sub %g4,cy,%g4 110 1.1 mrg stw %g4,[rp+0] 111 1.1 mrg retl 112 1.1 mrg srlx %g4,63,%o0 113 1.1 mrg 114 1.1 mrg L(end1): 115 1.1 mrg sub %o4,%o5,%g4 116 1.1 mrg stw %g4,[rp+0] 117 1.1 mrg retl 118 1.1 mrg srlx %g4,63,%o0 119 1.1 mrg 120 1.1 mrg L(end2): 121 1.1 mrg sub %o4,%o5,%g4 122 1.1 mrg srlx %g4,63,cy 123 1.1 mrg stw %g4,[rp+0] 124 1.1 mrg sub %g2,%g3,%g4 125 1.1 mrg sub %g4,cy,%g4 126 1.1 mrg stw %g4,[rp+4] 127 1.1 mrg retl 128 1.1 mrg srlx %g4,63,%o0 129 1.1 mrg EPILOGUE(mpn_sub_n) 130