6 // Copyright (c) 2000, Intel Corporation
7 // All rights reserved.
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,
13 // WARRANTY DISCLAIMER
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.
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.
34 // 64-bit signed integer remainder
44 alloc r31=ar.pfs,3,0,0,0
49 // 64-BIT SIGNED INTEGER REMAINDER BEGINS HERE
51 // general register used:
52 // r32 - 64-bit signed integer dividend, called a below
53 // r33 - 64-bit signed integer divisor, called b below
54 // r8 - 64-bit signed integer result
55 // r2 - scratch register
56 // floating-point registers used: f6, f7, f8, f9, f10, f11, f12
57 // predicate registers used: p6
59 setf.sig f12=r32 // holds a in integer form
64 //movl r2=0x8000000000000000;;
65 movl r2=0xffffffffffffffff;;
67 // get the 2's complement of b
85 (p6) fma.s1 f10=f6,f8,f0
90 // e0 = 1 - b * y0 in f9
91 (p6) fnma.s1 f9=f7,f8,f1
96 // q1 = q0 + e0 * q0 in f10
97 (p6) fma.s1 f10=f9,f10,f10
102 // e1 = e0 * e0 in f11
103 (p6) fma.s1 f11=f9,f9,f0
108 // y1 = y0 + e0 * y0 in f8
109 (p6) fma.s1 f8=f9,f8,f8
114 // q2 = q1 + e1 * q1 in f9
115 (p6) fma.s1 f9=f11,f10,f10
120 // y2 = y1 + e1 * y1 in f8
121 (p6) fma.s1 f8=f11,f8,f8
126 // r2 = a - b * q2 in f10
127 (p6) fnma.s1 f10=f7,f9,f6
132 // q3 = q2 + r2 * y2 in f8
133 (p6) fma.s1 f8=f10,f8,f9
137 // (11) q = trunc(q3)
138 fcvt.fx.trunc.s1 f8=f8
142 // (12) r = a + (-b) * q
151 // 64-BIT SIGNED INTEGER REMAINDER ENDS HERE