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

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


  1 |                                                   1 |
  2 |       sgetem.sa 3.1 12/10/90                      2 |       sgetem.sa 3.1 12/10/90
  3 |                                                   3 |
  4 |       The entry point sGETEXP returns the ex      4 |       The entry point sGETEXP returns the exponent portion
  5 |       of the input argument.  The exponent b      5 |       of the input argument.  The exponent bias is removed
  6 |       and the exponent value is returned as       6 |       and the exponent value is returned as an extended
  7 |       precision number in fp0.  sGETEXPD han      7 |       precision number in fp0.  sGETEXPD handles denormalized
  8 |       numbers.                                    8 |       numbers.
  9 |                                                   9 |
 10 |       The entry point sGETMAN extracts the m     10 |       The entry point sGETMAN extracts the mantissa of the
 11 |       input argument.  The mantissa is conve     11 |       input argument.  The mantissa is converted to an
 12 |       extended precision number and returned     12 |       extended precision number and returned in fp0.  The
 13 |       range of the result is [1.0 - 2.0).        13 |       range of the result is [1.0 - 2.0).
 14 |                                                  14 |
 15 |                                                  15 |
 16 |       Input:  Double-extended number X in th     16 |       Input:  Double-extended number X in the ETEMP space in
 17 |               the floating-point save stack.     17 |               the floating-point save stack.
 18 |                                                  18 |
 19 |       Output: The functions return exp(X) or     19 |       Output: The functions return exp(X) or man(X) in fp0.
 20 |                                                  20 |
 21 |       Modified: fp0.                             21 |       Modified: fp0.
 22 |                                                  22 |
 23 |                                                  23 |
 24 |               Copyright (C) Motorola, Inc. 1     24 |               Copyright (C) Motorola, Inc. 1990
 25 |                       All Rights Reserved        25 |                       All Rights Reserved
 26 |                                                  26 |
 27 |       For details on the license for this fi     27 |       For details on the license for this file, please see the
 28 |       file, README, in this same directory.      28 |       file, README, in this same directory.
 29                                                    29 
 30 |SGETEM idnt    2,1 | Motorola 040 Floating Po     30 |SGETEM idnt    2,1 | Motorola 040 Floating Point Software Package
 31                                                    31 
 32         |section 8                                 32         |section 8
 33                                                    33 
 34 #include "fpsp.h"                                  34 #include "fpsp.h"
 35                                                    35 
 36         |xref   nrm_set                            36         |xref   nrm_set
 37                                                    37 
 38 |                                                  38 |
 39 | This entry point is used by the unimplemente     39 | This entry point is used by the unimplemented instruction exception
 40 | handler.  It points a0 to the input operand.     40 | handler.  It points a0 to the input operand.
 41 |                                                  41 |
 42 |                                                  42 |
 43 |                                                  43 |
 44 |       SGETEXP                                    44 |       SGETEXP
 45 |                                                  45 |
 46                                                    46 
 47         .global sgetexp                            47         .global sgetexp
 48 sgetexp:                                           48 sgetexp:
 49         movew   LOCAL_EX(%a0),%d0       |get t     49         movew   LOCAL_EX(%a0),%d0       |get the exponent
 50         bclrl   #15,%d0         |clear the sig     50         bclrl   #15,%d0         |clear the sign bit
 51         subw    #0x3fff,%d0     |subtract off      51         subw    #0x3fff,%d0     |subtract off the bias
 52         fmovew  %d0,%fp0                |move      52         fmovew  %d0,%fp0                |move the exp to fp0
 53         rts                                        53         rts
 54                                                    54 
 55         .global sgetexpd                           55         .global sgetexpd
 56 sgetexpd:                                          56 sgetexpd:
 57         bclrb   #sign_bit,LOCAL_EX(%a0)            57         bclrb   #sign_bit,LOCAL_EX(%a0)
 58         bsr     nrm_set         |normalize (ex     58         bsr     nrm_set         |normalize (exp will go negative)
 59         movew   LOCAL_EX(%a0),%d0       |load      59         movew   LOCAL_EX(%a0),%d0       |load resulting exponent into d0
 60         subw    #0x3fff,%d0     |subtract off      60         subw    #0x3fff,%d0     |subtract off the bias
 61         fmovew  %d0,%fp0                |move      61         fmovew  %d0,%fp0                |move the exp to fp0
 62         rts                                        62         rts
 63 |                                                  63 |
 64 |                                                  64 |
 65 | This entry point is used by the unimplemente     65 | This entry point is used by the unimplemented instruction exception
 66 | handler.  It points a0 to the input operand.     66 | handler.  It points a0 to the input operand.
 67 |                                                  67 |
 68 |                                                  68 |
 69 |                                                  69 |
 70 |       SGETMAN                                    70 |       SGETMAN
 71 |                                                  71 |
 72 |                                                  72 |
 73 | For normalized numbers, leave the mantissa a     73 | For normalized numbers, leave the mantissa alone, simply load
 74 | with an exponent of +/- $3fff.                   74 | with an exponent of +/- $3fff.
 75 |                                                  75 |
 76         .global sgetman                            76         .global sgetman
 77 sgetman:                                           77 sgetman:
 78         movel   USER_FPCR(%a6),%d0                 78         movel   USER_FPCR(%a6),%d0
 79         andil   #0xffffff00,%d0 |clear roundin     79         andil   #0xffffff00,%d0 |clear rounding precision and mode
 80         fmovel  %d0,%fpcr               |this      80         fmovel  %d0,%fpcr               |this fpcr setting is used by the 882
 81         movew   LOCAL_EX(%a0),%d0       |get t     81         movew   LOCAL_EX(%a0),%d0       |get the exp (really just want sign bit)
 82         orw     #0x7fff,%d0     |clear old exp     82         orw     #0x7fff,%d0     |clear old exp
 83         bclrl   #14,%d0         |make it the n     83         bclrl   #14,%d0         |make it the new exp +-3fff
 84         movew   %d0,LOCAL_EX(%a0)       |move      84         movew   %d0,LOCAL_EX(%a0)       |move the sign & exp back to fsave stack
 85         fmovex  (%a0),%fp0      |put new value     85         fmovex  (%a0),%fp0      |put new value back in fp0
 86         rts                                        86         rts
 87                                                    87 
 88 |                                                  88 |
 89 | For denormalized numbers, shift the mantissa     89 | For denormalized numbers, shift the mantissa until the j-bit = 1,
 90 | then load the exponent with +/1 $3fff.           90 | then load the exponent with +/1 $3fff.
 91 |                                                  91 |
 92         .global sgetmand                           92         .global sgetmand
 93 sgetmand:                                          93 sgetmand:
 94         movel   LOCAL_HI(%a0),%d0       |load      94         movel   LOCAL_HI(%a0),%d0       |load ms mant in d0
 95         movel   LOCAL_LO(%a0),%d1       |load      95         movel   LOCAL_LO(%a0),%d1       |load ls mant in d1
 96         bsr     shft            |shift mantiss     96         bsr     shft            |shift mantissa bits till msbit is set
 97         movel   %d0,LOCAL_HI(%a0)       |put m     97         movel   %d0,LOCAL_HI(%a0)       |put ms mant back on stack
 98         movel   %d1,LOCAL_LO(%a0)       |put l     98         movel   %d1,LOCAL_LO(%a0)       |put ls mant back on stack
 99         bras    sgetman                            99         bras    sgetman
100                                                   100 
101 |                                                 101 |
102 |       SHFT                                      102 |       SHFT
103 |                                                 103 |
104 |       Shifts the mantissa bits until msbit i    104 |       Shifts the mantissa bits until msbit is set.
105 |       input:                                    105 |       input:
106 |               ms mantissa part in d0            106 |               ms mantissa part in d0
107 |               ls mantissa part in d1            107 |               ls mantissa part in d1
108 |       output:                                   108 |       output:
109 |               shifted bits in d0 and d1         109 |               shifted bits in d0 and d1
110 shft:                                             110 shft:
111         tstl    %d0             |if any bits s    111         tstl    %d0             |if any bits set in ms mant
112         bnes    upper           |then branch      112         bnes    upper           |then branch
113 |                               ;else no bits     113 |                               ;else no bits set in ms mant
114         tstl    %d1             |test if any b    114         tstl    %d1             |test if any bits set in ls mant
115         bnes    cont            |if set then c    115         bnes    cont            |if set then continue
116         bras    shft_end        |else return      116         bras    shft_end        |else return
117 cont:                                             117 cont:
118         movel   %d3,-(%a7)      |save d3          118         movel   %d3,-(%a7)      |save d3
119         exg     %d0,%d1         |shift ls mant    119         exg     %d0,%d1         |shift ls mant to ms mant
120         bfffo   %d0{#0:#32},%d3 |find first 1     120         bfffo   %d0{#0:#32},%d3 |find first 1 in ls mant to d0
121         lsll    %d3,%d0         |shift first 1    121         lsll    %d3,%d0         |shift first 1 to integer bit in ms mant
122         movel   (%a7)+,%d3      |restore d3       122         movel   (%a7)+,%d3      |restore d3
123         bras    shft_end                          123         bras    shft_end
124 upper:                                            124 upper:
125                                                   125 
126         moveml  %d3/%d5/%d6,-(%a7)      |save     126         moveml  %d3/%d5/%d6,-(%a7)      |save registers
127         bfffo   %d0{#0:#32},%d3 |find first 1     127         bfffo   %d0{#0:#32},%d3 |find first 1 in ls mant to d0
128         lsll    %d3,%d0         |shift ms mant    128         lsll    %d3,%d0         |shift ms mant until j-bit is set
129         movel   %d1,%d6         |save ls mant     129         movel   %d1,%d6         |save ls mant in d6
130         lsll    %d3,%d1         |shift ls mant    130         lsll    %d3,%d1         |shift ls mant by count
131         movel   #32,%d5                           131         movel   #32,%d5
132         subl    %d3,%d5         |sub 32 from s    132         subl    %d3,%d5         |sub 32 from shift for ls mant
133         lsrl    %d5,%d6         |shift off all    133         lsrl    %d5,%d6         |shift off all bits but those that will
134 |                               ;be shifted in    134 |                               ;be shifted into ms mant
135         orl     %d6,%d0         |shift the ls     135         orl     %d6,%d0         |shift the ls mant bits into the ms mant
136         moveml  (%a7)+,%d3/%d5/%d6      |resto    136         moveml  (%a7)+,%d3/%d5/%d6      |restore registers
137 shft_end:                                         137 shft_end:
138         rts                                       138         rts
139                                                   139 
140         |end                                      140         |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