1.file "__udivdi3.s" 2 3// $FreeBSD$ 4 5//- 6// Copyright (c) 2000, Intel Corporation 7// All rights reserved. 8// 9// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, 10// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, 11// Intel Corporation. 12// 13// WARRANTY DISCLAIMER 14// 15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 19// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING 24// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26// 27// Intel Corporation is the author of this code, and requests that all 28// problem reports or change requests be submitted to it directly at 29// http://developer.intel.com/opensource. 30// 31 32.section .text 33.proc __udivdi3# 34.align 32 35.global __udivdi3# 36.align 32 37 38// 64-bit unsigned integer divide 39 40__udivdi3: 41 42{ .mii 43 alloc r31=ar.pfs,2,0,0,0 44 nop.i 0 45 nop.i 0;; 46} 47 48{ .mmi 49 50 // 64-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE 51 52 setf.sig f8=r32 53 setf.sig f9=r33 54 nop.i 0;; 55} { .mfb 56 nop.m 0 57 fma.s1 f6=f8,f1,f0 58 nop.b 0 59} { .mfb 60 nop.m 0 61 fma.s1 f7=f9,f1,f0 62 nop.b 0;; 63} { .mfi 64 nop.m 0 65 // Step (1) 66 // y0 = 1 / b in f8 67 frcpa.s1 f8,p6=f6,f7 68 nop.i 0;; 69} { .mfi 70 nop.m 0 71 // Step (2) 72 // e0 = 1 - b * y0 in f9 73 (p6) fnma.s1 f9=f7,f8,f1 74 nop.i 0 75} { .mfi 76 nop.m 0 77 // Step (3) 78 // q0 = a * y0 in f10 79 (p6) fma.s1 f10=f6,f8,f0 80 nop.i 0;; 81} { .mfi 82 nop.m 0 83 // Step (4) 84 // e1 = e0 * e0 in f11 85 (p6) fma.s1 f11=f9,f9,f0 86 nop.i 0 87} { .mfi 88 nop.m 0 89 // Step (5) 90 // q1 = q0 + e0 * q0 in f10 91 (p6) fma.s1 f10=f9,f10,f10 92 nop.i 0;; 93} { .mfi 94 nop.m 0 95 // Step (6) 96 // y1 = y0 + e0 * y0 in f8 97 (p6) fma.s1 f8=f9,f8,f8 98 nop.i 0;; 99} { .mfi 100 nop.m 0 101 // Step (7) 102 // q2 = q1 + e1 * q1 in f9 103 (p6) fma.s1 f9=f11,f10,f10 104 nop.i 0;; 105} { .mfi 106 nop.m 0 107 // Step (8) 108 // y2 = y1 + e1 * y1 in f8 109 (p6) fma.s1 f8=f11,f8,f8 110 nop.i 0;; 111} { .mfi 112 nop.m 0 113 // Step (9) 114 // r2 = a - b * q2 in f10 115 (p6) fnma.s1 f10=f7,f9,f6 116 nop.i 0;; 117} { .mfi 118 nop.m 0 119 // Step (10) 120 // q3 = q2 + r2 * y2 in f8 121 (p6) fma.s1 f8=f10,f8,f9 122 nop.i 0;; 123} { .mfb 124 nop.m 0 125 // (11) q = trunc(q3) 126 fcvt.fxu.trunc.s1 f8=f8 127 nop.b 0;; 128} { .mmi 129 // quotient will be in r8 (if b != 0) 130 getf.sig r8=f8 131 nop.m 0 132 nop.i 0;; 133} 134 135 // 64-BIT UNSIGNED INTEGER DIVIDE ENDS HERE 136 137{ .mmb 138 nop.m 0 139 nop.m 0 140 br.ret.sptk b0;; 141} 142 143.endp __udivdi3 144