1 # Alpha 21064 __udiv_qrnnd 2 # Copyright (C) 1992-2022 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#if defined(__ELF__) && defined(__linux__) 26.section .note.GNU-stack,"" 27.previous 28#endif 29 30 .set noreorder 31 .set noat 32 33 .text 34 35 .globl __udiv_qrnnd 36 .ent __udiv_qrnnd 37#ifdef __VMS__ 38__udiv_qrnnd..en: 39 .frame $29,0,$26,0 40 .prologue 41#else 42__udiv_qrnnd: 43 .frame $30,0,$26,0 44 .prologue 0 45#endif 46 47#define cnt $2 48#define tmp $3 49#define rem_ptr $16 50#define n1 $17 51#define n0 $18 52#define d $19 53#define qb $20 54#define AT $at 55 56 ldiq cnt,16 57 blt d,$largedivisor 58 59$loop1: cmplt n0,0,tmp 60 addq n1,n1,n1 61 bis n1,tmp,n1 62 addq n0,n0,n0 63 cmpule d,n1,qb 64 subq n1,d,tmp 65 cmovne qb,tmp,n1 66 bis n0,qb,n0 67 cmplt n0,0,tmp 68 addq n1,n1,n1 69 bis n1,tmp,n1 70 addq n0,n0,n0 71 cmpule d,n1,qb 72 subq n1,d,tmp 73 cmovne qb,tmp,n1 74 bis n0,qb,n0 75 cmplt n0,0,tmp 76 addq n1,n1,n1 77 bis n1,tmp,n1 78 addq n0,n0,n0 79 cmpule d,n1,qb 80 subq n1,d,tmp 81 cmovne qb,tmp,n1 82 bis n0,qb,n0 83 cmplt n0,0,tmp 84 addq n1,n1,n1 85 bis n1,tmp,n1 86 addq n0,n0,n0 87 cmpule d,n1,qb 88 subq n1,d,tmp 89 cmovne qb,tmp,n1 90 bis n0,qb,n0 91 subq cnt,1,cnt 92 bgt cnt,$loop1 93 stq n1,0(rem_ptr) 94 bis $31,n0,$0 95 ret $31,($26),1 96 97$largedivisor: 98 and n0,1,$4 99 100 srl n0,1,n0 101 sll n1,63,tmp 102 or tmp,n0,n0 103 srl n1,1,n1 104 105 and d,1,$6 106 srl d,1,$5 107 addq $5,$6,$5 108 109$loop2: cmplt n0,0,tmp 110 addq n1,n1,n1 111 bis n1,tmp,n1 112 addq n0,n0,n0 113 cmpule $5,n1,qb 114 subq n1,$5,tmp 115 cmovne qb,tmp,n1 116 bis n0,qb,n0 117 cmplt n0,0,tmp 118 addq n1,n1,n1 119 bis n1,tmp,n1 120 addq n0,n0,n0 121 cmpule $5,n1,qb 122 subq n1,$5,tmp 123 cmovne qb,tmp,n1 124 bis n0,qb,n0 125 cmplt n0,0,tmp 126 addq n1,n1,n1 127 bis n1,tmp,n1 128 addq n0,n0,n0 129 cmpule $5,n1,qb 130 subq n1,$5,tmp 131 cmovne qb,tmp,n1 132 bis n0,qb,n0 133 cmplt n0,0,tmp 134 addq n1,n1,n1 135 bis n1,tmp,n1 136 addq n0,n0,n0 137 cmpule $5,n1,qb 138 subq n1,$5,tmp 139 cmovne qb,tmp,n1 140 bis n0,qb,n0 141 subq cnt,1,cnt 142 bgt cnt,$loop2 143 144 addq n1,n1,n1 145 addq $4,n1,n1 146 bne $6,$Odd 147 stq n1,0(rem_ptr) 148 bis $31,n0,$0 149 ret $31,($26),1 150 151$Odd: 152 /* q' in n0. r' in n1 */ 153 addq n1,n0,n1 154 155 cmpult n1,n0,tmp # tmp := carry from addq 156 subq n1,d,AT 157 addq n0,tmp,n0 158 cmovne tmp,AT,n1 159 160 cmpult n1,d,tmp 161 addq n0,1,AT 162 cmoveq tmp,AT,n0 163 subq n1,d,AT 164 cmoveq tmp,AT,n1 165 166 stq n1,0(rem_ptr) 167 bis $31,n0,$0 168 ret $31,($26),1 169 170#ifdef __VMS__ 171 .link 172 .align 3 173__udiv_qrnnd: 174 .pdesc __udiv_qrnnd..en,null 175#endif 176 .end __udiv_qrnnd 177