1dnl HP-PA __udiv_qrnnd division support, used from longlong.h. 2dnl This version runs fast on PA 7000 and later. 3 4dnl Copyright 1993, 1994, 2000, 2001, 2003 Free Software Foundation, Inc. 5 6dnl This file is part of the GNU MP Library. 7 8dnl The GNU MP Library is free software; you can redistribute it and/or modify 9dnl it under the terms of the GNU Lesser General Public License as published 10dnl by the Free Software Foundation; either version 3 of the License, or (at 11dnl your option) any later version. 12 13dnl The GNU MP Library is distributed in the hope that it will be useful, but 14dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16dnl License for more details. 17 18dnl You should have received a copy of the GNU Lesser General Public License 19dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21include(`../config.m4') 22 23C INPUT PARAMETERS 24C rem_ptr gr26 25C n1 gr25 26C n0 gr24 27C d gr23 28 29C This file has caused a lot of trouble, since it demands PIC reference to 30C static data, which triggers bugs in gas (at least version 2.7 through 31C 2.11.2). When the bug is triggered, many bogus relocs are generated. The 32C current solution is to stuff data right into the code, and refer it using 33C absolute offsets. Fragile to be sure, but nothing else seems to work. 34 35ASM_START() 36ifdef(`PIC',`', 37` RODATA 38 INT64(0000, 0x43f00000, 0x0) C 2^64 39') 40 41PROLOGUE(mpn_udiv_qrnnd) 42C .callinfo frame=64,no_calls 43 44 ldo 64(%r30),%r30 45 46 stws %r25,-16(0,%r30) C n_hi 47 stws %r24,-12(0,%r30) C n_lo 48 49ifdef(`PIC', 50` bl .+20,%r31 51 dep %r0,31,2,%r31 52 .word 0x0 C padding for alignment 53 .word 0x43f00000, 0x0 C 2^64 54 ldo 4(%r31),%r31', 55` ldil `L'%L(0000),%r31 56 ldo R%L(0000)(%r31),%r31') 57 58 fldds -16(0,%r30),%fr5 59 stws %r23,-12(0,%r30) 60 comib,<= 0,%r25,L(1) 61 fcnvxf,dbl,dbl %fr5,%fr5 62 fldds 0(0,%r31),%fr4 63 fadd,dbl %fr4,%fr5,%fr5 64 65LDEF(1) 66 fcpy,sgl %fr0,%fr6L 67 fldws -12(0,%r30),%fr6R 68 fcnvxf,dbl,dbl %fr6,%fr4 69 70 fdiv,dbl %fr5,%fr4,%fr5 71 72 fcnvfx,dbl,dbl %fr5,%fr4 73 fstws %fr4R,-16(%r30) 74 xmpyu %fr4R,%fr6R,%fr6 75 ldws -16(%r30),%r28 76 fstds %fr6,-16(0,%r30) 77 ldws -12(0,%r30),%r21 78 ldws -16(0,%r30),%r20 79 sub %r24,%r21,%r22 80 subb %r25,%r20,%r20 81 comib,= 0,%r20,L(2) 82 ldo -64(%r30),%r30 83 84 add %r22,%r23,%r22 85 ldo -1(%r28),%r28 86 87LDEF(2) 88 bv 0(%r2) 89 stws %r22,0(0,%r26) 90 91EPILOGUE(mpn_udiv_qrnnd) 92