1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 2 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 3 3 4 This file is part of GNU CC. 4 This file is part of GNU CC. 5 5 6 */ 6 */ 7 7 8 .text 8 .text 9 .align 4 9 .align 4 10 .globl __udivdi3 10 .globl __udivdi3 11 __udivdi3: 11 __udivdi3: 12 save %sp,-104,%sp 12 save %sp,-104,%sp 13 mov %i3,%o3 13 mov %i3,%o3 14 cmp %i2,0 14 cmp %i2,0 15 bne .LL40 15 bne .LL40 16 mov %i1,%i3 16 mov %i1,%i3 17 cmp %o3,%i0 17 cmp %o3,%i0 18 bleu .LL41 18 bleu .LL41 19 mov %i3,%o1 19 mov %i3,%o1 20 ! Inlined udiv_qrnnd 20 ! Inlined udiv_qrnnd 21 mov 32,%g1 21 mov 32,%g1 22 subcc %i0,%o3,%g0 22 subcc %i0,%o3,%g0 23 1: bcs 5f 23 1: bcs 5f 24 addxcc %o1,%o1,%o1 ! shift n1n0 a 24 addxcc %o1,%o1,%o1 ! shift n1n0 and a q-bit in lsb 25 sub %i0,%o3,%i0 ! this kills m 25 sub %i0,%o3,%i0 ! this kills msb of n 26 addx %i0,%i0,%i0 ! so this cann 26 addx %i0,%i0,%i0 ! so this cannot give carry 27 subcc %g1,1,%g1 27 subcc %g1,1,%g1 28 2: bne 1b 28 2: bne 1b 29 subcc %i0,%o3,%g0 29 subcc %i0,%o3,%g0 30 bcs 3f 30 bcs 3f 31 addxcc %o1,%o1,%o1 ! shift n1n0 a 31 addxcc %o1,%o1,%o1 ! shift n1n0 and a q-bit in lsb 32 b 3f 32 b 3f 33 sub %i0,%o3,%i0 ! this kills m 33 sub %i0,%o3,%i0 ! this kills msb of n 34 4: sub %i0,%o3,%i0 34 4: sub %i0,%o3,%i0 35 5: addxcc %i0,%i0,%i0 35 5: addxcc %i0,%i0,%i0 36 bcc 2b 36 bcc 2b 37 subcc %g1,1,%g1 37 subcc %g1,1,%g1 38 ! Got carry from n. Subtract next step to can 38 ! Got carry from n. Subtract next step to cancel this carry. 39 bne 4b 39 bne 4b 40 addcc %o1,%o1,%o1 ! shift n1n0 a 40 addcc %o1,%o1,%o1 ! shift n1n0 and a 0-bit in lsb 41 sub %i0,%o3,%i0 41 sub %i0,%o3,%i0 42 3: xnor %o1,0,%o1 42 3: xnor %o1,0,%o1 43 ! End of inline udiv_qrnnd 43 ! End of inline udiv_qrnnd 44 b .LL45 44 b .LL45 45 mov 0,%o2 45 mov 0,%o2 46 .LL41: 46 .LL41: 47 cmp %o3,0 47 cmp %o3,0 48 bne .LL77 48 bne .LL77 49 mov %i0,%o2 49 mov %i0,%o2 50 mov 1,%o0 50 mov 1,%o0 51 mov 0,%o1 51 mov 0,%o1 52 wr %g0, 0, %y 52 wr %g0, 0, %y 53 udiv %o0, %o1, %o0 53 udiv %o0, %o1, %o0 54 mov %o0,%o3 54 mov %o0,%o3 55 mov %i0,%o2 55 mov %i0,%o2 56 .LL77: 56 .LL77: 57 mov 0,%o4 57 mov 0,%o4 58 ! Inlined udiv_qrnnd 58 ! Inlined udiv_qrnnd 59 mov 32,%g1 59 mov 32,%g1 60 subcc %o4,%o3,%g0 60 subcc %o4,%o3,%g0 61 1: bcs 5f 61 1: bcs 5f 62 addxcc %o2,%o2,%o2 ! shift n1n0 a 62 addxcc %o2,%o2,%o2 ! shift n1n0 and a q-bit in lsb 63 sub %o4,%o3,%o4 ! this kills m 63 sub %o4,%o3,%o4 ! this kills msb of n 64 addx %o4,%o4,%o4 ! so this cann 64 addx %o4,%o4,%o4 ! so this cannot give carry 65 subcc %g1,1,%g1 65 subcc %g1,1,%g1 66 2: bne 1b 66 2: bne 1b 67 subcc %o4,%o3,%g0 67 subcc %o4,%o3,%g0 68 bcs 3f 68 bcs 3f 69 addxcc %o2,%o2,%o2 ! shift n1n0 a 69 addxcc %o2,%o2,%o2 ! shift n1n0 and a q-bit in lsb 70 b 3f 70 b 3f 71 sub %o4,%o3,%o4 ! this kills m 71 sub %o4,%o3,%o4 ! this kills msb of n 72 4: sub %o4,%o3,%o4 72 4: sub %o4,%o3,%o4 73 5: addxcc %o4,%o4,%o4 73 5: addxcc %o4,%o4,%o4 74 bcc 2b 74 bcc 2b 75 subcc %g1,1,%g1 75 subcc %g1,1,%g1 76 ! Got carry from n. Subtract next step to can 76 ! Got carry from n. Subtract next step to cancel this carry. 77 bne 4b 77 bne 4b 78 addcc %o2,%o2,%o2 ! shift n1n0 a 78 addcc %o2,%o2,%o2 ! shift n1n0 and a 0-bit in lsb 79 sub %o4,%o3,%o4 79 sub %o4,%o3,%o4 80 3: xnor %o2,0,%o2 80 3: xnor %o2,0,%o2 81 ! End of inline udiv_qrnnd 81 ! End of inline udiv_qrnnd 82 mov %o4,%i0 82 mov %o4,%i0 83 mov %i3,%o1 83 mov %i3,%o1 84 ! Inlined udiv_qrnnd 84 ! Inlined udiv_qrnnd 85 mov 32,%g1 85 mov 32,%g1 86 subcc %i0,%o3,%g0 86 subcc %i0,%o3,%g0 87 1: bcs 5f 87 1: bcs 5f 88 addxcc %o1,%o1,%o1 ! shift n1n0 a 88 addxcc %o1,%o1,%o1 ! shift n1n0 and a q-bit in lsb 89 sub %i0,%o3,%i0 ! this kills m 89 sub %i0,%o3,%i0 ! this kills msb of n 90 addx %i0,%i0,%i0 ! so this cann 90 addx %i0,%i0,%i0 ! so this cannot give carry 91 subcc %g1,1,%g1 91 subcc %g1,1,%g1 92 2: bne 1b 92 2: bne 1b 93 subcc %i0,%o3,%g0 93 subcc %i0,%o3,%g0 94 bcs 3f 94 bcs 3f 95 addxcc %o1,%o1,%o1 ! shift n1n0 a 95 addxcc %o1,%o1,%o1 ! shift n1n0 and a q-bit in lsb 96 b 3f 96 b 3f 97 sub %i0,%o3,%i0 ! this kills m 97 sub %i0,%o3,%i0 ! this kills msb of n 98 4: sub %i0,%o3,%i0 98 4: sub %i0,%o3,%i0 99 5: addxcc %i0,%i0,%i0 99 5: addxcc %i0,%i0,%i0 100 bcc 2b 100 bcc 2b 101 subcc %g1,1,%g1 101 subcc %g1,1,%g1 102 ! Got carry from n. Subtract next step to can 102 ! Got carry from n. Subtract next step to cancel this carry. 103 bne 4b 103 bne 4b 104 addcc %o1,%o1,%o1 ! shift n1n0 a 104 addcc %o1,%o1,%o1 ! shift n1n0 and a 0-bit in lsb 105 sub %i0,%o3,%i0 105 sub %i0,%o3,%i0 106 3: xnor %o1,0,%o1 106 3: xnor %o1,0,%o1 107 ! End of inline udiv_qrnnd 107 ! End of inline udiv_qrnnd 108 b .LL78 108 b .LL78 109 mov %o1,%l1 109 mov %o1,%l1 110 .LL40: 110 .LL40: 111 cmp %i2,%i0 111 cmp %i2,%i0 112 bleu .LL46 112 bleu .LL46 113 sethi %hi(65535),%o0 113 sethi %hi(65535),%o0 114 b .LL73 114 b .LL73 115 mov 0,%o1 115 mov 0,%o1 116 .LL46: 116 .LL46: 117 or %o0,%lo(65535),%o0 117 or %o0,%lo(65535),%o0 118 cmp %i2,%o0 118 cmp %i2,%o0 119 bgu .LL53 119 bgu .LL53 120 mov %i2,%o1 120 mov %i2,%o1 121 cmp %i2,256 121 cmp %i2,256 122 addx %g0,-1,%o0 122 addx %g0,-1,%o0 123 b .LL59 123 b .LL59 124 and %o0,8,%o2 124 and %o0,8,%o2 125 .LL53: 125 .LL53: 126 sethi %hi(16777215),%o0 126 sethi %hi(16777215),%o0 127 or %o0,%lo(16777215),%o0 127 or %o0,%lo(16777215),%o0 128 cmp %o1,%o0 128 cmp %o1,%o0 129 bgu .LL59 129 bgu .LL59 130 mov 24,%o2 130 mov 24,%o2 131 mov 16,%o2 131 mov 16,%o2 132 .LL59: 132 .LL59: 133 srl %o1,%o2,%o1 133 srl %o1,%o2,%o1 134 sethi %hi(__clz_tab),%o0 134 sethi %hi(__clz_tab),%o0 135 or %o0,%lo(__clz_tab),%o0 135 or %o0,%lo(__clz_tab),%o0 136 ldub [%o1+%o0],%o0 136 ldub [%o1+%o0],%o0 137 add %o0,%o2,%o0 137 add %o0,%o2,%o0 138 mov 32,%o1 138 mov 32,%o1 139 subcc %o1,%o0,%o2 139 subcc %o1,%o0,%o2 140 bne,a .LL67 140 bne,a .LL67 141 mov 32,%o0 141 mov 32,%o0 142 cmp %i0,%i2 142 cmp %i0,%i2 143 bgu .LL69 143 bgu .LL69 144 cmp %i3,%o3 144 cmp %i3,%o3 145 blu .LL73 145 blu .LL73 146 mov 0,%o1 146 mov 0,%o1 147 .LL69: 147 .LL69: 148 b .LL73 148 b .LL73 149 mov 1,%o1 149 mov 1,%o1 150 .LL67: 150 .LL67: 151 sub %o0,%o2,%o0 151 sub %o0,%o2,%o0 152 sll %i2,%o2,%i2 152 sll %i2,%o2,%i2 153 srl %o3,%o0,%o1 153 srl %o3,%o0,%o1 154 or %i2,%o1,%i2 154 or %i2,%o1,%i2 155 sll %o3,%o2,%o3 155 sll %o3,%o2,%o3 156 srl %i0,%o0,%o1 156 srl %i0,%o0,%o1 157 sll %i0,%o2,%i0 157 sll %i0,%o2,%i0 158 srl %i3,%o0,%o0 158 srl %i3,%o0,%o0 159 or %i0,%o0,%i0 159 or %i0,%o0,%i0 160 sll %i3,%o2,%i3 160 sll %i3,%o2,%i3 161 mov %i0,%o5 161 mov %i0,%o5 162 mov %o1,%o4 162 mov %o1,%o4 163 ! Inlined udiv_qrnnd 163 ! Inlined udiv_qrnnd 164 mov 32,%g1 164 mov 32,%g1 165 subcc %o4,%i2,%g0 165 subcc %o4,%i2,%g0 166 1: bcs 5f 166 1: bcs 5f 167 addxcc %o5,%o5,%o5 ! shift n1n0 a 167 addxcc %o5,%o5,%o5 ! shift n1n0 and a q-bit in lsb 168 sub %o4,%i2,%o4 ! this kills m 168 sub %o4,%i2,%o4 ! this kills msb of n 169 addx %o4,%o4,%o4 ! so this cann 169 addx %o4,%o4,%o4 ! so this cannot give carry 170 subcc %g1,1,%g1 170 subcc %g1,1,%g1 171 2: bne 1b 171 2: bne 1b 172 subcc %o4,%i2,%g0 172 subcc %o4,%i2,%g0 173 bcs 3f 173 bcs 3f 174 addxcc %o5,%o5,%o5 ! shift n1n0 a 174 addxcc %o5,%o5,%o5 ! shift n1n0 and a q-bit in lsb 175 b 3f 175 b 3f 176 sub %o4,%i2,%o4 ! this kills m 176 sub %o4,%i2,%o4 ! this kills msb of n 177 4: sub %o4,%i2,%o4 177 4: sub %o4,%i2,%o4 178 5: addxcc %o4,%o4,%o4 178 5: addxcc %o4,%o4,%o4 179 bcc 2b 179 bcc 2b 180 subcc %g1,1,%g1 180 subcc %g1,1,%g1 181 ! Got carry from n. Subtract next step to can 181 ! Got carry from n. Subtract next step to cancel this carry. 182 bne 4b 182 bne 4b 183 addcc %o5,%o5,%o5 ! shift n1n0 a 183 addcc %o5,%o5,%o5 ! shift n1n0 and a 0-bit in lsb 184 sub %o4,%i2,%o4 184 sub %o4,%i2,%o4 185 3: xnor %o5,0,%o5 185 3: xnor %o5,0,%o5 186 ! End of inline udiv_qrnnd 186 ! End of inline udiv_qrnnd 187 mov %o4,%i0 187 mov %o4,%i0 188 mov %o5,%o1 188 mov %o5,%o1 189 ! Inlined umul_ppmm 189 ! Inlined umul_ppmm 190 wr %g0,%o1,%y ! SPARC has 0- 190 wr %g0,%o1,%y ! SPARC has 0-3 delay insn after a wr 191 sra %o3,31,%g2 ! Do not move 191 sra %o3,31,%g2 ! Do not move this insn 192 and %o1,%g2,%g2 ! Do not move 192 and %o1,%g2,%g2 ! Do not move this insn 193 andcc %g0,0,%g1 ! Do not move 193 andcc %g0,0,%g1 ! Do not move this insn 194 mulscc %g1,%o3,%g1 194 mulscc %g1,%o3,%g1 195 mulscc %g1,%o3,%g1 195 mulscc %g1,%o3,%g1 196 mulscc %g1,%o3,%g1 196 mulscc %g1,%o3,%g1 197 mulscc %g1,%o3,%g1 197 mulscc %g1,%o3,%g1 198 mulscc %g1,%o3,%g1 198 mulscc %g1,%o3,%g1 199 mulscc %g1,%o3,%g1 199 mulscc %g1,%o3,%g1 200 mulscc %g1,%o3,%g1 200 mulscc %g1,%o3,%g1 201 mulscc %g1,%o3,%g1 201 mulscc %g1,%o3,%g1 202 mulscc %g1,%o3,%g1 202 mulscc %g1,%o3,%g1 203 mulscc %g1,%o3,%g1 203 mulscc %g1,%o3,%g1 204 mulscc %g1,%o3,%g1 204 mulscc %g1,%o3,%g1 205 mulscc %g1,%o3,%g1 205 mulscc %g1,%o3,%g1 206 mulscc %g1,%o3,%g1 206 mulscc %g1,%o3,%g1 207 mulscc %g1,%o3,%g1 207 mulscc %g1,%o3,%g1 208 mulscc %g1,%o3,%g1 208 mulscc %g1,%o3,%g1 209 mulscc %g1,%o3,%g1 209 mulscc %g1,%o3,%g1 210 mulscc %g1,%o3,%g1 210 mulscc %g1,%o3,%g1 211 mulscc %g1,%o3,%g1 211 mulscc %g1,%o3,%g1 212 mulscc %g1,%o3,%g1 212 mulscc %g1,%o3,%g1 213 mulscc %g1,%o3,%g1 213 mulscc %g1,%o3,%g1 214 mulscc %g1,%o3,%g1 214 mulscc %g1,%o3,%g1 215 mulscc %g1,%o3,%g1 215 mulscc %g1,%o3,%g1 216 mulscc %g1,%o3,%g1 216 mulscc %g1,%o3,%g1 217 mulscc %g1,%o3,%g1 217 mulscc %g1,%o3,%g1 218 mulscc %g1,%o3,%g1 218 mulscc %g1,%o3,%g1 219 mulscc %g1,%o3,%g1 219 mulscc %g1,%o3,%g1 220 mulscc %g1,%o3,%g1 220 mulscc %g1,%o3,%g1 221 mulscc %g1,%o3,%g1 221 mulscc %g1,%o3,%g1 222 mulscc %g1,%o3,%g1 222 mulscc %g1,%o3,%g1 223 mulscc %g1,%o3,%g1 223 mulscc %g1,%o3,%g1 224 mulscc %g1,%o3,%g1 224 mulscc %g1,%o3,%g1 225 mulscc %g1,%o3,%g1 225 mulscc %g1,%o3,%g1 226 mulscc %g1,0,%g1 226 mulscc %g1,0,%g1 227 add %g1,%g2,%o0 227 add %g1,%g2,%o0 228 rd %y,%o2 228 rd %y,%o2 229 cmp %o0,%i0 229 cmp %o0,%i0 230 bgu,a .LL73 230 bgu,a .LL73 231 add %o1,-1,%o1 231 add %o1,-1,%o1 232 bne,a .LL45 232 bne,a .LL45 233 mov 0,%o2 233 mov 0,%o2 234 cmp %o2,%i3 234 cmp %o2,%i3 235 bleu .LL45 235 bleu .LL45 236 mov 0,%o2 236 mov 0,%o2 237 add %o1,-1,%o1 237 add %o1,-1,%o1 238 .LL73: 238 .LL73: 239 mov 0,%o2 239 mov 0,%o2 240 .LL45: 240 .LL45: 241 mov %o1,%l1 241 mov %o1,%l1 242 .LL78: 242 .LL78: 243 mov %o2,%l0 243 mov %o2,%l0 244 mov %l0,%i0 244 mov %l0,%i0 245 mov %l1,%i1 245 mov %l1,%i1 246 ret 246 ret 247 restore 247 restore
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.