github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/sparc32/v8/supersparc/udiv.asm (about) 1 dnl SuperSPARC mpn_udiv_qrnnd division support, used from longlong.h. 2 dnl This is for SuperSPARC only, to compensate for its semi-functional 3 dnl udiv instruction. 4 5 dnl Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc. 6 7 dnl This file is part of the GNU MP Library. 8 dnl 9 dnl The GNU MP Library is free software; you can redistribute it and/or modify 10 dnl it under the terms of either: 11 dnl 12 dnl * the GNU Lesser General Public License as published by the Free 13 dnl Software Foundation; either version 3 of the License, or (at your 14 dnl option) any later version. 15 dnl 16 dnl or 17 dnl 18 dnl * the GNU General Public License as published by the Free Software 19 dnl Foundation; either version 2 of the License, or (at your option) any 20 dnl later version. 21 dnl 22 dnl or both in parallel, as here. 23 dnl 24 dnl The GNU MP Library is distributed in the hope that it will be useful, but 25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27 dnl for more details. 28 dnl 29 dnl You should have received copies of the GNU General Public License and the 30 dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31 dnl see https://www.gnu.org/licenses/. 32 33 34 include(`../config.m4') 35 36 C INPUT PARAMETERS 37 C rem_ptr i0 38 C n1 i1 39 C n0 i2 40 C d i3 41 42 ASM_START() 43 44 ifdef(`PIC', 45 ` TEXT 46 L(getpc): 47 retl 48 nop') 49 50 TEXT 51 ALIGN(8) 52 L(C0): .double 0r4294967296 53 L(C1): .double 0r2147483648 54 55 PROLOGUE(mpn_udiv_qrnnd) 56 save %sp,-104,%sp 57 st %i1,[%fp-8] 58 ld [%fp-8],%f10 59 60 ifdef(`PIC', 61 `L(pc): call L(getpc) C put address of this insn in %o7 62 ldd [%o7+L(C0)-L(pc)],%f8', 63 ` sethi %hi(L(C0)),%o7 64 ldd [%o7+%lo(L(C0))],%f8') 65 66 fitod %f10,%f4 67 cmp %i1,0 68 bge L(248) 69 mov %i0,%i5 70 faddd %f4,%f8,%f4 71 L(248): 72 st %i2,[%fp-8] 73 ld [%fp-8],%f10 74 fmuld %f4,%f8,%f6 75 cmp %i2,0 76 bge L(249) 77 fitod %f10,%f2 78 faddd %f2,%f8,%f2 79 L(249): 80 st %i3,[%fp-8] 81 faddd %f6,%f2,%f2 82 ld [%fp-8],%f10 83 cmp %i3,0 84 bge L(250) 85 fitod %f10,%f4 86 faddd %f4,%f8,%f4 87 L(250): 88 fdivd %f2,%f4,%f2 89 90 ifdef(`PIC', 91 ` ldd [%o7+L(C1)-L(pc)],%f4', 92 ` sethi %hi(L(C1)),%o7 93 ldd [%o7+%lo(L(C1))],%f4') 94 95 fcmped %f2,%f4 96 nop 97 fbge,a L(251) 98 fsubd %f2,%f4,%f2 99 fdtoi %f2,%f2 100 st %f2,[%fp-8] 101 b L(252) 102 ld [%fp-8],%i4 103 L(251): 104 fdtoi %f2,%f2 105 st %f2,[%fp-8] 106 ld [%fp-8],%i4 107 sethi %hi(-2147483648),%g2 108 xor %i4,%g2,%i4 109 L(252): 110 umul %i3,%i4,%g3 111 rd %y,%i0 112 subcc %i2,%g3,%o7 113 subxcc %i1,%i0,%g0 114 be L(253) 115 cmp %o7,%i3 116 117 add %i4,-1,%i0 118 add %o7,%i3,%o7 119 st %o7,[%i5] 120 ret 121 restore 122 L(253): 123 blu L(246) 124 mov %i4,%i0 125 add %i4,1,%i0 126 sub %o7,%i3,%o7 127 L(246): 128 st %o7,[%i5] 129 ret 130 restore 131 EPILOGUE(mpn_udiv_qrnnd)