1 # IBM POWER __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
2 # the result from a second limb vector.
4 # Copyright (C) 1992, 1994, 1999, 2000 Free Software Foundation, Inc.
6 # This file is part of the GNU MP Library.
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 2.1 of the License, or (at your
11 # option) any later version.
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.
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 # The POWER architecture has no unsigned 32x32->64 bit multiplication
31 # instruction. To obtain that operation, we have to use the 32x32->64 signed
32 # multiplication instruction, and add the appropriate compensation to the high
33 # limb of the result. We add the multiplicand if the multiplier has its most
34 # significant bit set, and we add the multiplier if the multiplicand has its
35 # most significant bit set. We need to preserve the carry flag between each
36 # iteration, so we have to compute the compensation carefully (the natural,
37 # srai+and doesn't work). Since the POWER architecture has a branch unit we
38 # can branch in zero cycles, so that's how we perform the additions.
41 .globl __gmpn_submul_1
42 .globl .__gmpn_submul_1
43 .csect __gmpn_submul_1[DS]
45 .long .__gmpn_submul_1, TOC[tc0], 0
60 sf 8,11,7 # add res_limb
61 a 11,8,11 # invert cy (r11 is junk)
70 ae 11,0,9 # low limb + old_cy_limb + old cy
72 aze 10,10 # propagate cy to new cy_limb
73 sf 8,11,7 # add res_limb
74 a 11,8,11 # invert cy (r11 is junk)
76 cax 10,10,6 # adjust high limb for negative limb from s1
87 a 11,8,11 # invert cy (r11 is junk)
89 cax 9,9,6 # adjust high limb for negative limb from s1
103 ae 10,10,0 # propagate cy to new cy_limb
104 sf 8,11,7 # add res_limb
105 a 11,8,11 # invert cy (r11 is junk)
107 cax 10,10,6 # adjust high limb for negative limb from s1
116 ae 9,9,0 # propagate cy to new cy_limb
117 sf 8,11,7 # add res_limb
118 a 11,8,11 # invert cy (r11 is junk)
120 cax 9,9,6 # adjust high limb for negative limb from s1