OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libcpu/] [m68k/] [m68040/] [fpsp/] [ssinh.S] - Blame information for rev 507

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
//
2
//      $Id: ssinh.S,v 1.2 2001-09-27 12:01:22 chris Exp $
3
//
4
//      ssinh.sa 3.1 12/10/90
5
//
6
//       The entry point sSinh computes the hyperbolic sine of
7
//       an input argument; sSinhd does the same except for denormalized
8
//       input.
9
//
10
//       Input: Double-extended number X in location pointed to
11
//              by address register a0.
12
//
13
//       Output: The value sinh(X) returned in floating-point register Fp0.
14
//
15
//       Accuracy and Monotonicity: The returned result is within 3 ulps in
16
//               64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
17
//               result is subsequently rounded to double precision. The
18
//               result is provably monotonic in double precision.
19
//
20
//       Speed: The program sSINH takes approximately 280 cycles.
21
//
22
//       Algorithm:
23
//
24
//       SINH
25
//       1. If |X| > 16380 log2, go to 3.
26
//
27
//       2. (|X| <= 16380 log2) Sinh(X) is obtained by the formulae
28
//               y = |X|, sgn = sign(X), and z = expm1(Y),
29
//               sinh(X) = sgn*(1/2)*( z + z/(1+z) ).
30
//          Exit.
31
//
32
//       3. If |X| > 16480 log2, go to 5.
33
//
34
//       4. (16380 log2 < |X| <= 16480 log2)
35
//               sinh(X) = sign(X) * exp(|X|)/2.
36
//          However, invoking exp(|X|) may cause premature overflow.
37
//          Thus, we calculate sinh(X) as follows:
38
//             Y       := |X|
39
//             sgn     := sign(X)
40
//             sgnFact := sgn * 2**(16380)
41
//             Y'      := Y - 16381 log2
42
//             sinh(X) := sgnFact * exp(Y').
43
//          Exit.
44
//
45
//       5. (|X| > 16480 log2) sinh(X) must overflow. Return
46
//          sign(X)*Huge*Huge to generate overflow and an infinity with
47
//          the appropriate sign. Huge is the largest finite number in
48
//          extended format. Exit.
49
//
50
 
51
//              Copyright (C) Motorola, Inc. 1990
52
//                      All Rights Reserved
53
//
54
//      THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
55
//      The copyright notice above does not evidence any
56
//      actual or intended publication of such source code.
57
 
58
//SSINH idnt    2,1 | Motorola 040 Floating Point Software Package
59
 
60
        |section        8
61
 
62
T1:     .long 0x40C62D38,0xD3D64634 // ... 16381 LOG2 LEAD
63
T2:     .long 0x3D6F90AE,0xB1E75CC7 // ... 16381 LOG2 TRAIL
64
 
65
        |xref   t_frcinx
66
        |xref   t_ovfl
67
        |xref   t_extdnrm
68
        |xref   setox
69
        |xref   setoxm1
70
 
71
        .global ssinhd
72
ssinhd:
73
//--SINH(X) = X FOR DENORMALIZED X
74
 
75
        bra     t_extdnrm
76
 
77
        .global ssinh
78
ssinh:
79
        fmovex  (%a0),%fp0      // ...LOAD INPUT
80
 
81
        movel   (%a0),%d0
82
        movew   4(%a0),%d0
83
        movel   %d0,%a1         // save a copy of original (compacted) operand
84
        andl    #0x7FFFFFFF,%d0
85
        cmpl    #0x400CB167,%d0
86
        bgts    SINHBIG
87
 
88
//--THIS IS THE USUAL CASE, |X| < 16380 LOG2
89
//--Y = |X|, Z = EXPM1(Y), SINH(X) = SIGN(X)*(1/2)*( Z + Z/(1+Z) )
90
 
91
        fabsx   %fp0            // ...Y = |X|
92
 
93
        moveml  %a1/%d1,-(%sp)
94
        fmovemx %fp0-%fp0,(%a0)
95
        clrl    %d1
96
        bsr     setoxm1         // ...FP0 IS Z = EXPM1(Y)
97
        fmovel  #0,%fpcr
98
        moveml  (%sp)+,%a1/%d1
99
 
100
        fmovex  %fp0,%fp1
101
        fadds   #0x3F800000,%fp1        // ...1+Z
102
        fmovex  %fp0,-(%sp)
103
        fdivx   %fp1,%fp0               // ...Z/(1+Z)
104
        movel   %a1,%d0
105
        andl    #0x80000000,%d0
106
        orl     #0x3F000000,%d0
107
        faddx   (%sp)+,%fp0
108
        movel   %d0,-(%sp)
109
 
110
        fmovel  %d1,%fpcr
111
        fmuls   (%sp)+,%fp0     //last fp inst - possible exceptions set
112
 
113
        bra     t_frcinx
114
 
115
SINHBIG:
116
        cmpl    #0x400CB2B3,%d0
117
        bgt     t_ovfl
118
        fabsx   %fp0
119
        fsubd   T1(%pc),%fp0    // ...(|X|-16381LOG2_LEAD)
120
        movel   #0,-(%sp)
121
        movel   #0x80000000,-(%sp)
122
        movel   %a1,%d0
123
        andl    #0x80000000,%d0
124
        orl     #0x7FFB0000,%d0
125
        movel   %d0,-(%sp)      // ...EXTENDED FMT
126
        fsubd   T2(%pc),%fp0    // ...|X| - 16381 LOG2, ACCURATE
127
 
128
        movel   %d1,-(%sp)
129
        clrl    %d1
130
        fmovemx %fp0-%fp0,(%a0)
131
        bsr     setox
132
        fmovel  (%sp)+,%fpcr
133
 
134
        fmulx   (%sp)+,%fp0     //possible exception
135
        bra     t_frcinx
136
 
137
        |end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.