1 # Alpha 21064 __udiv_qrnnd 2 # Copyright (C) 1992-2019 Free Software Foundation, Inc. 3 4 # This file is part of GCC. 5 6 # The GNU MP Library is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 3 of the License, or (at your 9 # option) any later version. 10 11 # This file is distributed in the hope that it will be useful, but 12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 14 # License for more details. 15 16 # Under Section 7 of GPL version 3, you are granted additional 17 # permissions described in the GCC Runtime Library Exception, version 18 # 3.1, as published by the Free Software Foundation. 19 20 # You should have received a copy of the GNU General Public License and 21 # a copy of the GCC Runtime Library Exception along with this program; 22 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 # <http://www.gnu.org/licenses/>. 24 25#ifdef __ELF__ 26.section .note.GNU-stack,"" 27#endif 28 29 .set noreorder 30 .set noat 31 32 .text 33 34 .globl __udiv_qrnnd 35 .ent __udiv_qrnnd 36#ifdef __VMS__ 37__udiv_qrnnd..en: 38 .frame $29,0,$26,0 39 .prologue 40#else 41__udiv_qrnnd: 42 .frame $30,0,$26,0 43 .prologue 0 44#endif 45 46#define cnt $2 47#define tmp $3 48#define rem_ptr $16 49#define n1 $17 50#define n0 $18 51#define d $19 52#define qb $20 53#define AT $at 54 55 ldiq cnt,16 56 blt d,$largedivisor 57 58$loop1: cmplt n0,0,tmp 59 addq n1,n1,n1 60 bis n1,tmp,n1 61 addq n0,n0,n0 62 cmpule d,n1,qb 63 subq n1,d,tmp 64 cmovne qb,tmp,n1 65 bis n0,qb,n0 66 cmplt n0,0,tmp 67 addq n1,n1,n1 68 bis n1,tmp,n1 69 addq n0,n0,n0 70 cmpule d,n1,qb 71 subq n1,d,tmp 72 cmovne qb,tmp,n1 73 bis n0,qb,n0 74 cmplt n0,0,tmp 75 addq n1,n1,n1 76 bis n1,tmp,n1 77 addq n0,n0,n0 78 cmpule d,n1,qb 79 subq n1,d,tmp 80 cmovne qb,tmp,n1 81 bis n0,qb,n0 82 cmplt n0,0,tmp 83 addq n1,n1,n1 84 bis n1,tmp,n1 85 addq n0,n0,n0 86 cmpule d,n1,qb 87 subq n1,d,tmp 88 cmovne qb,tmp,n1 89 bis n0,qb,n0 90 subq cnt,1,cnt 91 bgt cnt,$loop1 92 stq n1,0(rem_ptr) 93 bis $31,n0,$0 94 ret $31,($26),1 95 96$largedivisor: 97 and n0,1,$4 98 99 srl n0,1,n0 100 sll n1,63,tmp 101 or tmp,n0,n0 102 srl n1,1,n1 103 104 and d,1,$6 105 srl d,1,$5 106 addq $5,$6,$5 107 108$loop2: cmplt n0,0,tmp 109 addq n1,n1,n1 110 bis n1,tmp,n1 111 addq n0,n0,n0 112 cmpule $5,n1,qb 113 subq n1,$5,tmp 114 cmovne qb,tmp,n1 115 bis n0,qb,n0 116 cmplt n0,0,tmp 117 addq n1,n1,n1 118 bis n1,tmp,n1 119 addq n0,n0,n0 120 cmpule $5,n1,qb 121 subq n1,$5,tmp 122 cmovne qb,tmp,n1 123 bis n0,qb,n0 124 cmplt n0,0,tmp 125 addq n1,n1,n1 126 bis n1,tmp,n1 127 addq n0,n0,n0 128 cmpule $5,n1,qb 129 subq n1,$5,tmp 130 cmovne qb,tmp,n1 131 bis n0,qb,n0 132 cmplt n0,0,tmp 133 addq n1,n1,n1 134 bis n1,tmp,n1 135 addq n0,n0,n0 136 cmpule $5,n1,qb 137 subq n1,$5,tmp 138 cmovne qb,tmp,n1 139 bis n0,qb,n0 140 subq cnt,1,cnt 141 bgt cnt,$loop2 142 143 addq n1,n1,n1 144 addq $4,n1,n1 145 bne $6,$Odd 146 stq n1,0(rem_ptr) 147 bis $31,n0,$0 148 ret $31,($26),1 149 150$Odd: 151 /* q' in n0. r' in n1 */ 152 addq n1,n0,n1 153 154 cmpult n1,n0,tmp # tmp := carry from addq 155 subq n1,d,AT 156 addq n0,tmp,n0 157 cmovne tmp,AT,n1 158 159 cmpult n1,d,tmp 160 addq n0,1,AT 161 cmoveq tmp,AT,n0 162 subq n1,d,AT 163 cmoveq tmp,AT,n1 164 165 stq n1,0(rem_ptr) 166 bis $31,n0,$0 167 ret $31,($26),1 168 169#ifdef __VMS__ 170 .link 171 .align 3 172__udiv_qrnnd: 173 .pdesc __udiv_qrnnd..en,null 174#endif 175 .end __udiv_qrnnd 176