3
// $FreeBSD: src/sys/libkern/ia64/__umoddi3.S,v 1.3 2003/02/11 20:15:11 schweikh Exp $
5
// Copyright (c) 2000, Intel Corporation
6
// All rights reserved.
8
// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
9
// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
12
// WARRANTY DISCLAIMER
14
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
18
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
23
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
// Intel Corporation is the author of this code, and requests that all
27
// problem reports or change requests be submitted to it directly at
28
// http://developer.intel.com/opensource.
33
// 64-bit unsigned integer remainder
43
alloc r31=ar.pfs,3,0,0,0
48
// 64-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE
50
// general register used:
51
// r32 - 64-bit unsigned integer dividend, called a below
52
// r33 - 64-bit unsigned integer divisor, called b below
53
// r8 - 64-bit unsigned integer result
54
// floating-point registers used: f6, f7, f8, f9, f10, f11, f12
55
// predicate registers used: p6
57
setf.sig f12=r32 // holds a in integer form
61
// get 2s complement of b
79
(p6) fma.s1 f10=f6,f8,f0
84
// e0 = 1 - b * y0 in f9
85
(p6) fnma.s1 f9=f7,f8,f1
90
// q1 = q0 + e0 * q0 in f10
91
(p6) fma.s1 f10=f9,f10,f10
96
// e1 = e0 * e0 in f11
97
(p6) fma.s1 f11=f9,f9,f0
102
// y1 = y0 + e0 * y0 in f8
103
(p6) fma.s1 f8=f9,f8,f8
108
// q2 = q1 + e1 * q1 in f9
109
(p6) fma.s1 f9=f11,f10,f10
114
// y2 = y1 + e1 * y1 in f8
115
(p6) fma.s1 f8=f11,f8,f8
120
// r2 = a - b * q2 in f10
121
(p6) fnma.s1 f10=f7,f9,f6
127
// q3 = q2 + r2 * y2 in f8
128
(p6) fma.s1 f8=f10,f8,f9
132
// (11) q = trunc(q3)
133
fcvt.fxu.trunc.s1 f8=f8
137
// (12) r = a + (-b) * q
146
// 64-BIT UNSIGNED INTEGER REMAINDER ENDS HERE