~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/fpsp040/stanh.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/m68k/fpsp040/stanh.S (Version linux-6.12-rc7) and /arch/m68k/fpsp040/stanh.S (Version linux-5.4.285)


  1 |                                                   1 |
  2 |       stanh.sa 3.1 12/10/90                       2 |       stanh.sa 3.1 12/10/90
  3 |                                                   3 |
  4 |       The entry point sTanh computes the hyp      4 |       The entry point sTanh computes the hyperbolic tangent of
  5 |       an input argument; sTanhd does the sam      5 |       an input argument; sTanhd does the same except for denormalized
  6 |       input.                                      6 |       input.
  7 |                                                   7 |
  8 |       Input: Double-extended number X in loc      8 |       Input: Double-extended number X in location pointed to
  9 |               by address register a0.             9 |               by address register a0.
 10 |                                                  10 |
 11 |       Output: The value tanh(X) returned in      11 |       Output: The value tanh(X) returned in floating-point register Fp0.
 12 |                                                  12 |
 13 |       Accuracy and Monotonicity: The returne     13 |       Accuracy and Monotonicity: The returned result is within 3 ulps in
 14 |               64 significant bit, i.e. withi     14 |               64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
 15 |               result is subsequently rounded     15 |               result is subsequently rounded to double precision. The
 16 |               result is provably monotonic i     16 |               result is provably monotonic in double precision.
 17 |                                                  17 |
 18 |       Speed: The program stanh takes approxi     18 |       Speed: The program stanh takes approximately 270 cycles.
 19 |                                                  19 |
 20 |       Algorithm:                                 20 |       Algorithm:
 21 |                                                  21 |
 22 |       TANH                                       22 |       TANH
 23 |       1. If |X| >= (5/2) log2 or |X| <= 2**(     23 |       1. If |X| >= (5/2) log2 or |X| <= 2**(-40), go to 3.
 24 |                                                  24 |
 25 |       2. (2**(-40) < |X| < (5/2) log2) Calcu     25 |       2. (2**(-40) < |X| < (5/2) log2) Calculate tanh(X) by
 26 |               sgn := sign(X), y := 2|X|, z :     26 |               sgn := sign(X), y := 2|X|, z := expm1(Y), and
 27 |               tanh(X) = sgn*( z/(2+z) ).         27 |               tanh(X) = sgn*( z/(2+z) ).
 28 |               Exit.                              28 |               Exit.
 29 |                                                  29 |
 30 |       3. (|X| <= 2**(-40) or |X| >= (5/2) lo     30 |       3. (|X| <= 2**(-40) or |X| >= (5/2) log2). If |X| < 1,
 31 |               go to 7.                           31 |               go to 7.
 32 |                                                  32 |
 33 |       4. (|X| >= (5/2) log2) If |X| >= 50 lo     33 |       4. (|X| >= (5/2) log2) If |X| >= 50 log2, go to 6.
 34 |                                                  34 |
 35 |       5. ((5/2) log2 <= |X| < 50 log2) Calcu     35 |       5. ((5/2) log2 <= |X| < 50 log2) Calculate tanh(X) by
 36 |               sgn := sign(X), y := 2|X|, z :     36 |               sgn := sign(X), y := 2|X|, z := exp(Y),
 37 |               tanh(X) = sgn - [ sgn*2/(1+z)      37 |               tanh(X) = sgn - [ sgn*2/(1+z) ].
 38 |               Exit.                              38 |               Exit.
 39 |                                                  39 |
 40 |       6. (|X| >= 50 log2) Tanh(X) = +-1 (rou     40 |       6. (|X| >= 50 log2) Tanh(X) = +-1 (round to nearest). Thus, we
 41 |               calculate Tanh(X) by               41 |               calculate Tanh(X) by
 42 |               sgn := sign(X), Tiny := 2**(-1     42 |               sgn := sign(X), Tiny := 2**(-126),
 43 |               tanh(X) := sgn - sgn*Tiny.         43 |               tanh(X) := sgn - sgn*Tiny.
 44 |               Exit.                              44 |               Exit.
 45 |                                                  45 |
 46 |       7. (|X| < 2**(-40)). Tanh(X) = X.          46 |       7. (|X| < 2**(-40)). Tanh(X) = X.       Exit.
 47 |                                                  47 |
 48                                                    48 
 49 |               Copyright (C) Motorola, Inc. 1     49 |               Copyright (C) Motorola, Inc. 1990
 50 |                       All Rights Reserved        50 |                       All Rights Reserved
 51 |                                                  51 |
 52 |       For details on the license for this fi     52 |       For details on the license for this file, please see the
 53 |       file, README, in this same directory.      53 |       file, README, in this same directory.
 54                                                    54 
 55 |STANH  idnt    2,1 | Motorola 040 Floating Po     55 |STANH  idnt    2,1 | Motorola 040 Floating Point Software Package
 56                                                    56 
 57         |section        8                          57         |section        8
 58                                                    58 
 59 #include "fpsp.h"                                  59 #include "fpsp.h"
 60                                                    60 
 61         .set    X,FP_SCR5                          61         .set    X,FP_SCR5
 62         .set    XDCARE,X+2                         62         .set    XDCARE,X+2
 63         .set    XFRAC,X+4                          63         .set    XFRAC,X+4
 64                                                    64 
 65         .set    SGN,L_SCR3                         65         .set    SGN,L_SCR3
 66                                                    66 
 67         .set    V,FP_SCR6                          67         .set    V,FP_SCR6
 68                                                    68 
 69 BOUNDS1:        .long 0x3FD78000,0x3FFFDDCE |      69 BOUNDS1:        .long 0x3FD78000,0x3FFFDDCE | ... 2^(-40), (5/2)LOG2
 70                                                    70 
 71         |xref   t_frcinx                           71         |xref   t_frcinx
 72         |xref   t_extdnrm                          72         |xref   t_extdnrm
 73         |xref   setox                              73         |xref   setox
 74         |xref   setoxm1                            74         |xref   setoxm1
 75                                                    75 
 76         .global stanhd                             76         .global stanhd
 77 stanhd:                                            77 stanhd:
 78 |--TANH(X) = X FOR DENORMALIZED X                  78 |--TANH(X) = X FOR DENORMALIZED X
 79                                                    79 
 80         bra             t_extdnrm                  80         bra             t_extdnrm
 81                                                    81 
 82         .global stanh                              82         .global stanh
 83 stanh:                                             83 stanh:
 84         fmovex          (%a0),%fp0      | ...L     84         fmovex          (%a0),%fp0      | ...LOAD INPUT
 85                                                    85 
 86         fmovex          %fp0,X(%a6)                86         fmovex          %fp0,X(%a6)
 87         movel           (%a0),%d0                  87         movel           (%a0),%d0
 88         movew           4(%a0),%d0                 88         movew           4(%a0),%d0
 89         movel           %d0,X(%a6)                 89         movel           %d0,X(%a6)
 90         andl            #0x7FFFFFFF,%d0            90         andl            #0x7FFFFFFF,%d0
 91         cmp2l           BOUNDS1(%pc),%d0           91         cmp2l           BOUNDS1(%pc),%d0        | ...2**(-40) < |X| < (5/2)LOG2 ?
 92         bcss            TANHBORS                   92         bcss            TANHBORS
 93                                                    93 
 94 |--THIS IS THE USUAL CASE                          94 |--THIS IS THE USUAL CASE
 95 |--Y = 2|X|, Z = EXPM1(Y), TANH(X) = SIGN(X) *     95 |--Y = 2|X|, Z = EXPM1(Y), TANH(X) = SIGN(X) * Z / (Z+2).
 96                                                    96 
 97         movel           X(%a6),%d0                 97         movel           X(%a6),%d0
 98         movel           %d0,SGN(%a6)               98         movel           %d0,SGN(%a6)
 99         andl            #0x7FFF0000,%d0            99         andl            #0x7FFF0000,%d0
100         addl            #0x00010000,%d0 | ...E    100         addl            #0x00010000,%d0 | ...EXPONENT OF 2|X|
101         movel           %d0,X(%a6)                101         movel           %d0,X(%a6)
102         andl            #0x80000000,SGN(%a6)      102         andl            #0x80000000,SGN(%a6)
103         fmovex          X(%a6),%fp0               103         fmovex          X(%a6),%fp0             | ...FP0 IS Y = 2|X|
104                                                   104 
105         movel           %d1,-(%a7)                105         movel           %d1,-(%a7)
106         clrl            %d1                       106         clrl            %d1
107         fmovemx %fp0-%fp0,(%a0)                   107         fmovemx %fp0-%fp0,(%a0)
108         bsr             setoxm1         | ...F    108         bsr             setoxm1         | ...FP0 IS Z = EXPM1(Y)
109         movel           (%a7)+,%d1                109         movel           (%a7)+,%d1
110                                                   110 
111         fmovex          %fp0,%fp1                 111         fmovex          %fp0,%fp1
112         fadds           #0x40000000,%fp1          112         fadds           #0x40000000,%fp1        | ...Z+2
113         movel           SGN(%a6),%d0              113         movel           SGN(%a6),%d0
114         fmovex          %fp1,V(%a6)               114         fmovex          %fp1,V(%a6)
115         eorl            %d0,V(%a6)                115         eorl            %d0,V(%a6)
116                                                   116 
117         fmovel          %d1,%FPCR                 117         fmovel          %d1,%FPCR               |restore users exceptions
118         fdivx           V(%a6),%fp0               118         fdivx           V(%a6),%fp0
119         bra             t_frcinx                  119         bra             t_frcinx
120                                                   120 
121 TANHBORS:                                         121 TANHBORS:
122         cmpl            #0x3FFF8000,%d0           122         cmpl            #0x3FFF8000,%d0
123         blt             TANHSM                    123         blt             TANHSM
124                                                   124 
125         cmpl            #0x40048AA1,%d0           125         cmpl            #0x40048AA1,%d0
126         bgt             TANHHUGE                  126         bgt             TANHHUGE
127                                                   127 
128 |-- (5/2) LOG2 < |X| < 50 LOG2,                   128 |-- (5/2) LOG2 < |X| < 50 LOG2,
129 |--TANH(X) = 1 - (2/[EXP(2X)+1]). LET Y = 2|X|    129 |--TANH(X) = 1 - (2/[EXP(2X)+1]). LET Y = 2|X|, SGN = SIGN(X),
130 |--TANH(X) = SGN -      SGN*2/[EXP(Y)+1].         130 |--TANH(X) = SGN -      SGN*2/[EXP(Y)+1].
131                                                   131 
132         movel           X(%a6),%d0                132         movel           X(%a6),%d0
133         movel           %d0,SGN(%a6)              133         movel           %d0,SGN(%a6)
134         andl            #0x7FFF0000,%d0           134         andl            #0x7FFF0000,%d0
135         addl            #0x00010000,%d0 | ...E    135         addl            #0x00010000,%d0 | ...EXPO OF 2|X|
136         movel           %d0,X(%a6)                136         movel           %d0,X(%a6)              | ...Y = 2|X|
137         andl            #0x80000000,SGN(%a6)      137         andl            #0x80000000,SGN(%a6)
138         movel           SGN(%a6),%d0              138         movel           SGN(%a6),%d0
139         fmovex          X(%a6),%fp0               139         fmovex          X(%a6),%fp0             | ...Y = 2|X|
140                                                   140 
141         movel           %d1,-(%a7)                141         movel           %d1,-(%a7)
142         clrl            %d1                       142         clrl            %d1
143         fmovemx %fp0-%fp0,(%a0)                   143         fmovemx %fp0-%fp0,(%a0)
144         bsr             setox           | ...F    144         bsr             setox           | ...FP0 IS EXP(Y)
145         movel           (%a7)+,%d1                145         movel           (%a7)+,%d1
146         movel           SGN(%a6),%d0              146         movel           SGN(%a6),%d0
147         fadds           #0x3F800000,%fp0          147         fadds           #0x3F800000,%fp0        | ...EXP(Y)+1
148                                                   148 
149         eorl            #0xC0000000,%d0 | ...-    149         eorl            #0xC0000000,%d0 | ...-SIGN(X)*2
150         fmoves          %d0,%fp1                  150         fmoves          %d0,%fp1                | ...-SIGN(X)*2 IN SGL FMT
151         fdivx           %fp0,%fp1                 151         fdivx           %fp0,%fp1               | ...-SIGN(X)2 / [EXP(Y)+1 ]
152                                                   152 
153         movel           SGN(%a6),%d0              153         movel           SGN(%a6),%d0
154         orl             #0x3F800000,%d0 | ...S    154         orl             #0x3F800000,%d0 | ...SGN
155         fmoves          %d0,%fp0                  155         fmoves          %d0,%fp0                | ...SGN IN SGL FMT
156                                                   156 
157         fmovel          %d1,%FPCR                 157         fmovel          %d1,%FPCR               |restore users exceptions
158         faddx           %fp1,%fp0                 158         faddx           %fp1,%fp0
159                                                   159 
160         bra             t_frcinx                  160         bra             t_frcinx
161                                                   161 
162 TANHSM:                                           162 TANHSM:
163         movew           #0x0000,XDCARE(%a6)       163         movew           #0x0000,XDCARE(%a6)
164                                                   164 
165         fmovel          %d1,%FPCR                 165         fmovel          %d1,%FPCR               |restore users exceptions
166         fmovex          X(%a6),%fp0               166         fmovex          X(%a6),%fp0             |last inst - possible exception set
167                                                   167 
168         bra             t_frcinx                  168         bra             t_frcinx
169                                                   169 
170 TANHHUGE:                                         170 TANHHUGE:
171 |---RETURN SGN(X) - SGN(X)EPS                     171 |---RETURN SGN(X) - SGN(X)EPS
172         movel           X(%a6),%d0                172         movel           X(%a6),%d0
173         andl            #0x80000000,%d0           173         andl            #0x80000000,%d0
174         orl             #0x3F800000,%d0           174         orl             #0x3F800000,%d0
175         fmoves          %d0,%fp0                  175         fmoves          %d0,%fp0
176         andl            #0x80000000,%d0           176         andl            #0x80000000,%d0
177         eorl            #0x80800000,%d0 | ...-    177         eorl            #0x80800000,%d0 | ...-SIGN(X)*EPS
178                                                   178 
179         fmovel          %d1,%FPCR                 179         fmovel          %d1,%FPCR               |restore users exceptions
180         fadds           %d0,%fp0                  180         fadds           %d0,%fp0
181                                                   181 
182         bra             t_frcinx                  182         bra             t_frcinx
183                                                   183 
184         |end                                      184         |end
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php