1 # PowerPC-64 mpn_addsub_n -- Simultaneous add and sub.
3 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
5 # This file is part of the GNU MP Library.
7 # The GNU MP Library is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation; either version 2.1 of the License, or (at your
10 # option) any later version.
12 # The GNU MP Library is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 # License for more details.
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
29 include(`asm-syntax.m4')
31 define(SAVE_BORROW_RESTORE_CARRY,
34 define(SAVE_CARRY_RESTORE_BORROW,
40 # This is just crafted for testing some ideas, and verifying that we can make
41 # it run fast. It runs at 2.55 cycles/limb on the 630, which is very good.
42 # We should play a little with the schedule. No time has been spent on that.
44 # To finish this, the loop warm up and cool down code needs to be written,
45 # and the result need to be tested. Also, the proper calling sequence should
49 # Use reg r0, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12
52 PROLOGUE(mpn_addsub_n)
61 mtctr r7 # copy size into CTR
62 addic r0,r0,0 # clear cy
63 addi r3,r3,-8 # offset res_ptr, it's updated before it's used
64 addi r4,r4,-8 # offset res_ptr, it's updated before it's used
72 SAVE_CARRY_RESTORE_BORROW(r0)
80 ld r10,16(r5) # s1 L 2
81 ld r11,16(r6) # s2 L 2
82 # pair -------------------------
88 SAVE_BORROW_RESTORE_CARRY(r0)
92 ld r14,24(r5) # s1 L 3
93 ld r15,24(r6) # s2 L 3
96 ldu r16,32(r5) # s1 L 4
97 ldu r17,32(r6) # s2 L 4
107 EPILOGUE(mpn_addsub_n)