^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # Alpha 21064 __udiv_qrnnd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # Copyright (C) 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # This file is part of GCC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # The GNU MP Library is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) # the Free Software Foundation; either version 2 of the License, or (at your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) # In addition to the permissions in the GNU General Public License, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # Free Software Foundation gives you unlimited permission to link the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) # compiled version of this file with other programs, and to distribute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # those programs without any restriction coming from the use of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # file. (The General Public License restrictions do apply in other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) # respects; for example, they cover modification of the file, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) # distribution when not linked into another program.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # This file is distributed in the hope that it will be useful, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) # License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) # You should have received a copy of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) # along with GCC; see the file COPYING. If not, write to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # MA 02111-1307, USA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .set noreorder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .set noat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .globl __udiv_qrnnd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .ent __udiv_qrnnd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) __udiv_qrnnd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .frame $30,0,$26,0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .prologue 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define cnt $2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define tmp $3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define rem_ptr $16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define n1 $17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define n0 $18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define d $19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define qb $20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define AT $at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ldiq cnt,16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) blt d,$largedivisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) $loop1: cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) cmpule d,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) subq n1,d,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) cmpule d,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) subq n1,d,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) cmpule d,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) subq n1,d,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) cmpule d,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) subq n1,d,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) subq cnt,1,cnt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) bgt cnt,$loop1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) stq n1,0(rem_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) bis $31,n0,$0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ret $31,($26),1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) $largedivisor:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) and n0,1,$4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) srl n0,1,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) sll n1,63,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) or tmp,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) srl n1,1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) and d,1,$6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) srl d,1,$5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) addq $5,$6,$5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) $loop2: cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) cmpule $5,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) subq n1,$5,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) cmpule $5,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) subq n1,$5,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) cmpule $5,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) subq n1,$5,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) cmplt n0,0,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) bis n1,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) addq n0,n0,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) cmpule $5,n1,qb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) subq n1,$5,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) cmovne qb,tmp,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) bis n0,qb,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) subq cnt,1,cnt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) bgt cnt,$loop2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) addq n1,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) addq $4,n1,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) bne $6,$Odd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) stq n1,0(rem_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) bis $31,n0,$0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) ret $31,($26),1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) $Odd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* q' in n0. r' in n1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) addq n1,n0,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) cmpult n1,n0,tmp # tmp := carry from addq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) subq n1,d,AT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) addq n0,tmp,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) cmovne tmp,AT,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) cmpult n1,d,tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) addq n0,1,AT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) cmoveq tmp,AT,n0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) subq n1,d,AT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) cmoveq tmp,AT,n1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) stq n1,0(rem_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) bis $31,n0,$0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) ret $31,($26),1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) .end __udiv_qrnnd