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

TOMOYO Linux Cross Reference
Linux/arch/m68k/fpsp040/scosh.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/scosh.S (Architecture sparc64) and /arch/m68k/fpsp040/scosh.S (Architecture m68k)


  1 |                                                   1 |
  2 |       scosh.sa 3.1 12/10/90                       2 |       scosh.sa 3.1 12/10/90
  3 |                                                   3 |
  4 |       The entry point sCosh computes the hyp      4 |       The entry point sCosh computes the hyperbolic cosine of
  5 |       an input argument; sCoshd does the sam      5 |       an input argument; sCoshd 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 cosh(X) returned in      11 |       Output: The value cosh(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 sCOSH takes approxi     18 |       Speed: The program sCOSH takes approximately 250 cycles.
 19 |                                                  19 |
 20 |       Algorithm:                                 20 |       Algorithm:
 21 |                                                  21 |
 22 |       COSH                                       22 |       COSH
 23 |       1. If |X| > 16380 log2, go to 3.           23 |       1. If |X| > 16380 log2, go to 3.
 24 |                                                  24 |
 25 |       2. (|X| <= 16380 log2) Cosh(X) is obta     25 |       2. (|X| <= 16380 log2) Cosh(X) is obtained by the formulae
 26 |               y = |X|, z = exp(Y), and           26 |               y = |X|, z = exp(Y), and
 27 |               cosh(X) = (1/2)*( z + 1/z ).       27 |               cosh(X) = (1/2)*( z + 1/z ).
 28 |               Exit.                              28 |               Exit.
 29 |                                                  29 |
 30 |       3. (|X| > 16380 log2). If |X| > 16480      30 |       3. (|X| > 16380 log2). If |X| > 16480 log2, go to 5.
 31 |                                                  31 |
 32 |       4. (16380 log2 < |X| <= 16480 log2)        32 |       4. (16380 log2 < |X| <= 16480 log2)
 33 |               cosh(X) = sign(X) * exp(|X|)/2     33 |               cosh(X) = sign(X) * exp(|X|)/2.
 34 |               However, invoking exp(|X|) may     34 |               However, invoking exp(|X|) may cause premature overflow.
 35 |               Thus, we calculate sinh(X) as      35 |               Thus, we calculate sinh(X) as follows:
 36 |               Y       := |X|                     36 |               Y       := |X|
 37 |               Fact    :=      2**(16380)         37 |               Fact    :=      2**(16380)
 38 |               Y'      := Y - 16381 log2          38 |               Y'      := Y - 16381 log2
 39 |               cosh(X) := Fact * exp(Y').         39 |               cosh(X) := Fact * exp(Y').
 40 |               Exit.                              40 |               Exit.
 41 |                                                  41 |
 42 |       5. (|X| > 16480 log2) sinh(X) must ove     42 |       5. (|X| > 16480 log2) sinh(X) must overflow. Return
 43 |               Huge*Huge to generate overflow     43 |               Huge*Huge to generate overflow and an infinity with
 44 |               the appropriate sign. Huge is      44 |               the appropriate sign. Huge is the largest finite number in
 45 |               extended format. Exit.             45 |               extended format. Exit.
 46 |                                                  46 |
 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 |SCOSH  idnt    2,1 | Motorola 040 Floating Po     55 |SCOSH  idnt    2,1 | Motorola 040 Floating Point Software Package
 56                                                    56 
 57         |section        8                          57         |section        8
 58                                                    58 
 59         |xref   t_ovfl                             59         |xref   t_ovfl
 60         |xref   t_frcinx                           60         |xref   t_frcinx
 61         |xref   setox                              61         |xref   setox
 62                                                    62 
 63 T1:     .long 0x40C62D38,0xD3D64634 | ... 1638     63 T1:     .long 0x40C62D38,0xD3D64634 | ... 16381 LOG2 LEAD
 64 T2:     .long 0x3D6F90AE,0xB1E75CC7 | ... 1638     64 T2:     .long 0x3D6F90AE,0xB1E75CC7 | ... 16381 LOG2 TRAIL
 65                                                    65 
 66 TWO16380: .long 0x7FFB0000,0x80000000,0x000000     66 TWO16380: .long 0x7FFB0000,0x80000000,0x00000000,0x00000000
 67                                                    67 
 68         .global scoshd                             68         .global scoshd
 69 scoshd:                                            69 scoshd:
 70 |--COSH(X) = 1 FOR DENORMALIZED X                  70 |--COSH(X) = 1 FOR DENORMALIZED X
 71                                                    71 
 72         fmoves          #0x3F800000,%fp0           72         fmoves          #0x3F800000,%fp0
 73                                                    73 
 74         fmovel          %d1,%FPCR                  74         fmovel          %d1,%FPCR
 75         fadds           #0x00800000,%fp0           75         fadds           #0x00800000,%fp0
 76         bra             t_frcinx                   76         bra             t_frcinx
 77                                                    77 
 78         .global scosh                              78         .global scosh
 79 scosh:                                             79 scosh:
 80         fmovex          (%a0),%fp0      | ...L     80         fmovex          (%a0),%fp0      | ...LOAD INPUT
 81                                                    81 
 82         movel           (%a0),%d0                  82         movel           (%a0),%d0
 83         movew           4(%a0),%d0                 83         movew           4(%a0),%d0
 84         andil           #0x7FFFFFFF,%d0            84         andil           #0x7FFFFFFF,%d0
 85         cmpil           #0x400CB167,%d0            85         cmpil           #0x400CB167,%d0
 86         bgts            COSHBIG                    86         bgts            COSHBIG
 87                                                    87 
 88 |--THIS IS THE USUAL CASE, |X| < 16380 LOG2        88 |--THIS IS THE USUAL CASE, |X| < 16380 LOG2
 89 |--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )         89 |--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )
 90                                                    90 
 91         fabsx           %fp0            | ...|     91         fabsx           %fp0            | ...|X|
 92                                                    92 
 93         movel           %d1,-(%sp)                 93         movel           %d1,-(%sp)
 94         clrl            %d1                        94         clrl            %d1
 95         fmovemx %fp0-%fp0,(%a0) |pass paramete     95         fmovemx %fp0-%fp0,(%a0) |pass parameter to setox
 96         bsr             setox           | ...F     96         bsr             setox           | ...FP0 IS EXP(|X|)
 97         fmuls           #0x3F000000,%fp0           97         fmuls           #0x3F000000,%fp0        | ...(1/2)EXP(|X|)
 98         movel           (%sp)+,%d1                 98         movel           (%sp)+,%d1
 99                                                    99 
100         fmoves          #0x3E800000,%fp1          100         fmoves          #0x3E800000,%fp1        | ...(1/4)
101         fdivx           %fp0,%fp1                 101         fdivx           %fp0,%fp1               | ...1/(2 EXP(|X|))
102                                                   102 
103         fmovel          %d1,%FPCR                 103         fmovel          %d1,%FPCR
104         faddx           %fp1,%fp0                 104         faddx           %fp1,%fp0
105                                                   105 
106         bra             t_frcinx                  106         bra             t_frcinx
107                                                   107 
108 COSHBIG:                                          108 COSHBIG:
109         cmpil           #0x400CB2B3,%d0           109         cmpil           #0x400CB2B3,%d0
110         bgts            COSHHUGE                  110         bgts            COSHHUGE
111                                                   111 
112         fabsx           %fp0                      112         fabsx           %fp0
113         fsubd           T1(%pc),%fp0              113         fsubd           T1(%pc),%fp0            | ...(|X|-16381LOG2_LEAD)
114         fsubd           T2(%pc),%fp0              114         fsubd           T2(%pc),%fp0            | ...|X| - 16381 LOG2, ACCURATE
115                                                   115 
116         movel           %d1,-(%sp)                116         movel           %d1,-(%sp)
117         clrl            %d1                       117         clrl            %d1
118         fmovemx %fp0-%fp0,(%a0)                   118         fmovemx %fp0-%fp0,(%a0)
119         bsr             setox                     119         bsr             setox
120         fmovel          (%sp)+,%fpcr              120         fmovel          (%sp)+,%fpcr
121                                                   121 
122         fmulx           TWO16380(%pc),%fp0        122         fmulx           TWO16380(%pc),%fp0
123         bra             t_frcinx                  123         bra             t_frcinx
124                                                   124 
125 COSHHUGE:                                         125 COSHHUGE:
126         fmovel          #0,%fpsr                  126         fmovel          #0,%fpsr                |clr N bit if set by source
127         bclrb           #7,(%a0)                  127         bclrb           #7,(%a0)                |always return positive value
128         fmovemx (%a0),%fp0-%fp0                   128         fmovemx (%a0),%fp0-%fp0
129         bra             t_ovfl                    129         bra             t_ovfl
130                                                   130 
131         |end                                      131         |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