Tue Oct 10 23:08:53 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / sysdeps / alpha / divqu.S
blob76147424401afb1e94ec09cfc006d4fb8c17b398
1       /* This file is generated from divrem.m4; DO NOT EDIT! */
2 /* For each N divided by D, we do:
3       result = (double) N / (double) D
4    Then, for each N mod D, we do:
5       result = N - (D * divMODE (N, D))
7    FIXME:
8    The q and qu versions won't deal with operands > 50 bits.  We also
9    don't check for divide by zero.  */
11 #include "DEFS.h"
12 #if 0
13 /* We do not handle div by zero yet.  */
14 #include <machine/pal.h>
15 #endif
16 #include <sysdep.h>
18 /* Avoid the definition of ret that we set in the alpha sysdep.h.  */
19 #undef ret
26 FUNC__(divqu)
27         /* First set up the dividend.  */
28         
29         stq t10,0(sp)
30         ldt $f10,0(sp)
31         cvtqt $f10,$f10
32                 ldit    $f26, 18446744073709551616.0
33         addt    $f26, $f10, $f26
34         fcmovlt $f10, $f26, $f10
37         /* Then set up the divisor.  */
38         
39         stq t11,0(sp)
40         ldt $f1,0(sp)
41         cvtqt $f1,$f1
42                 ldit    $f26, 18446744073709551616.0
43         addt    $f26, $f1, $f26
44         fcmovlt $f1, $f26, $f1
47         /* Do the division.  */
48         divt $f10,$f1,$f10
49         cvttqc $f10,$f10
51         /* Put the result in t12.  */
52         stt $f10,0(sp)
53         ldq t12,0(sp)
54         
56         
58         lda sp,16(sp)
59         ret zero,(t9),1
60         .end NAME__(divqu)