1# I960 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and 2# store difference in a third limb vector. 3 4# Copyright 1995, 2000 Free Software Foundation, Inc. 5 6# This file is part of the GNU MP Library. 7 8# The GNU MP Library is free software; you can redistribute it and/or modify 9# it under the terms of the GNU Lesser General Public License as published by 10# the Free Software Foundation; either version 3 of the License, or (at your 11# option) any later version. 12 13# The GNU MP Library is distributed in the hope that it will be useful, but 14# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16# License for more details. 17 18# You should have received a copy of the GNU Lesser General Public License 19# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21.text 22 .align 4 23 .globl ___gmpn_sub_n 24___gmpn_sub_n: 25 mov 1,g6 # set carry-save register 26 cmpo 1,0 # clear cy 27 28Loop: subo 1,g3,g3 # update loop counter 29 ld (g1),g5 # load from s1_ptr 30 addo 4,g1,g1 # s1_ptr++ 31 ld (g2),g4 # load from s2_ptr 32 addo 4,g2,g2 # s2_ptr++ 33 cmpo g6,1 # restore cy from g6, relies on cy being 0 34 subc g4,g5,g4 # main subtract 35 subc 0,0,g6 # save cy in g6 36 st g4,(g0) # store result to res_ptr 37 addo 4,g0,g0 # res_ptr++ 38 cmpobne 0,g3,Loop # when branch is taken, cy will be 0 39 40 mov g6,g0 41 ret 42