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

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


  1 |                                                   1 |
  2 |       smovecr.sa 3.1 12/10/90                     2 |       smovecr.sa 3.1 12/10/90
  3 |                                                   3 |
  4 |       The entry point sMOVECR returns the co      4 |       The entry point sMOVECR returns the constant at the
  5 |       offset given in the instruction field.      5 |       offset given in the instruction field.
  6 |                                                   6 |
  7 |       Input: An offset in the instruction wo      7 |       Input: An offset in the instruction word.
  8 |                                                   8 |
  9 |       Output: The constant rounded to the us      9 |       Output: The constant rounded to the user's rounding
 10 |               mode unchecked for overflow.       10 |               mode unchecked for overflow.
 11 |                                                  11 |
 12 |       Modified: fp0.                             12 |       Modified: fp0.
 13 |                                                  13 |
 14 |                                                  14 |
 15 |               Copyright (C) Motorola, Inc. 1     15 |               Copyright (C) Motorola, Inc. 1990
 16 |                       All Rights Reserved        16 |                       All Rights Reserved
 17 |                                                  17 |
 18 |       For details on the license for this fi     18 |       For details on the license for this file, please see the
 19 |       file, README, in this same directory.      19 |       file, README, in this same directory.
 20                                                    20 
 21 |SMOVECR        idnt    2,1 | Motorola 040 Flo     21 |SMOVECR        idnt    2,1 | Motorola 040 Floating Point Software Package
 22                                                    22 
 23         |section 8                                 23         |section 8
 24                                                    24 
 25 #include "fpsp.h"                                  25 #include "fpsp.h"
 26                                                    26 
 27         |xref   nrm_set                            27         |xref   nrm_set
 28         |xref   round                              28         |xref   round
 29         |xref   PIRN                               29         |xref   PIRN
 30         |xref   PIRZRM                             30         |xref   PIRZRM
 31         |xref   PIRP                               31         |xref   PIRP
 32         |xref   SMALRN                             32         |xref   SMALRN
 33         |xref   SMALRZRM                           33         |xref   SMALRZRM
 34         |xref   SMALRP                             34         |xref   SMALRP
 35         |xref   BIGRN                              35         |xref   BIGRN
 36         |xref   BIGRZRM                            36         |xref   BIGRZRM
 37         |xref   BIGRP                              37         |xref   BIGRP
 38                                                    38 
 39 FZERO:  .long   00000000                           39 FZERO:  .long   00000000
 40 |                                                  40 |
 41 |       FMOVECR                                    41 |       FMOVECR
 42 |                                                  42 |
 43         .global smovcr                             43         .global smovcr
 44 smovcr:                                            44 smovcr:
 45         bfextu  CMDREG1B(%a6){#9:#7},%d0 |get      45         bfextu  CMDREG1B(%a6){#9:#7},%d0 |get offset
 46         bfextu  USER_FPCR(%a6){#26:#2},%d1 |ge     46         bfextu  USER_FPCR(%a6){#26:#2},%d1 |get rmode
 47 |                                                  47 |
 48 | check range of offset                            48 | check range of offset
 49 |                                                  49 |
 50         tstb    %d0             |if zero, offs     50         tstb    %d0             |if zero, offset is to pi
 51         beqs    PI_TBL          |it is pi          51         beqs    PI_TBL          |it is pi
 52         cmpib   #0x0a,%d0               |check     52         cmpib   #0x0a,%d0               |check range $01 - $0a
 53         bles    Z_VAL           |if in this ra     53         bles    Z_VAL           |if in this range, return zero
 54         cmpib   #0x0e,%d0               |check     54         cmpib   #0x0e,%d0               |check range $0b - $0e
 55         bles    SM_TBL          |valid constan     55         bles    SM_TBL          |valid constants in this range
 56         cmpib   #0x2f,%d0               |check     56         cmpib   #0x2f,%d0               |check range $10 - $2f
 57         bles    Z_VAL           |if in this ra     57         bles    Z_VAL           |if in this range, return zero
 58         cmpib   #0x3f,%d0               |check     58         cmpib   #0x3f,%d0               |check range $30 - $3f
 59         ble     BG_TBL          |valid constan     59         ble     BG_TBL          |valid constants in this range
 60 Z_VAL:                                             60 Z_VAL:
 61         fmoves  FZERO,%fp0                         61         fmoves  FZERO,%fp0
 62         rts                                        62         rts
 63 PI_TBL:                                            63 PI_TBL:
 64         tstb    %d1             |offset is zer     64         tstb    %d1             |offset is zero, check for rmode
 65         beqs    PI_RN           |if zero, rn m     65         beqs    PI_RN           |if zero, rn mode
 66         cmpib   #0x3,%d1                |check     66         cmpib   #0x3,%d1                |check for rp
 67         beqs    PI_RP           |if 3, rp mode     67         beqs    PI_RP           |if 3, rp mode
 68 PI_RZRM:                                           68 PI_RZRM:
 69         leal    PIRZRM,%a0      |rmode is rz o     69         leal    PIRZRM,%a0      |rmode is rz or rm, load PIRZRM in a0
 70         bra     set_finx                           70         bra     set_finx
 71 PI_RN:                                             71 PI_RN:
 72         leal    PIRN,%a0                |rmode     72         leal    PIRN,%a0                |rmode is rn, load PIRN in a0
 73         bra     set_finx                           73         bra     set_finx
 74 PI_RP:                                             74 PI_RP:
 75         leal    PIRP,%a0                |rmode     75         leal    PIRP,%a0                |rmode is rp, load PIRP in a0
 76         bra     set_finx                           76         bra     set_finx
 77 SM_TBL:                                            77 SM_TBL:
 78         subil   #0xb,%d0                |make      78         subil   #0xb,%d0                |make offset in 0 - 4 range
 79         tstb    %d1             |check for rmo     79         tstb    %d1             |check for rmode
 80         beqs    SM_RN           |if zero, rn m     80         beqs    SM_RN           |if zero, rn mode
 81         cmpib   #0x3,%d1                |check     81         cmpib   #0x3,%d1                |check for rp
 82         beqs    SM_RP           |if 3, rp mode     82         beqs    SM_RP           |if 3, rp mode
 83 SM_RZRM:                                           83 SM_RZRM:
 84         leal    SMALRZRM,%a0    |rmode is rz o     84         leal    SMALRZRM,%a0    |rmode is rz or rm, load SMRZRM in a0
 85         cmpib   #0x2,%d0                |check     85         cmpib   #0x2,%d0                |check if result is inex
 86         ble     set_finx        |if 0 - 2, it      86         ble     set_finx        |if 0 - 2, it is inexact
 87         bra     no_finx         |if 3, it is e     87         bra     no_finx         |if 3, it is exact
 88 SM_RN:                                             88 SM_RN:
 89         leal    SMALRN,%a0      |rmode is rn,      89         leal    SMALRN,%a0      |rmode is rn, load SMRN in a0
 90         cmpib   #0x2,%d0                |check     90         cmpib   #0x2,%d0                |check if result is inex
 91         ble     set_finx        |if 0 - 2, it      91         ble     set_finx        |if 0 - 2, it is inexact
 92         bra     no_finx         |if 3, it is e     92         bra     no_finx         |if 3, it is exact
 93 SM_RP:                                             93 SM_RP:
 94         leal    SMALRP,%a0      |rmode is rp,      94         leal    SMALRP,%a0      |rmode is rp, load SMRP in a0
 95         cmpib   #0x2,%d0                |check     95         cmpib   #0x2,%d0                |check if result is inex
 96         ble     set_finx        |if 0 - 2, it      96         ble     set_finx        |if 0 - 2, it is inexact
 97         bra     no_finx         |if 3, it is e     97         bra     no_finx         |if 3, it is exact
 98 BG_TBL:                                            98 BG_TBL:
 99         subil   #0x30,%d0               |make      99         subil   #0x30,%d0               |make offset in 0 - f range
100         tstb    %d1             |check for rmo    100         tstb    %d1             |check for rmode
101         beqs    BG_RN           |if zero, rn m    101         beqs    BG_RN           |if zero, rn mode
102         cmpib   #0x3,%d1                |check    102         cmpib   #0x3,%d1                |check for rp
103         beqs    BG_RP           |if 3, rp mode    103         beqs    BG_RP           |if 3, rp mode
104 BG_RZRM:                                          104 BG_RZRM:
105         leal    BIGRZRM,%a0     |rmode is rz o    105         leal    BIGRZRM,%a0     |rmode is rz or rm, load BGRZRM in a0
106         cmpib   #0x1,%d0                |check    106         cmpib   #0x1,%d0                |check if result is inex
107         ble     set_finx        |if 0 - 1, it     107         ble     set_finx        |if 0 - 1, it is inexact
108         cmpib   #0x7,%d0                |secon    108         cmpib   #0x7,%d0                |second check
109         ble     no_finx         |if 0 - 7, it     109         ble     no_finx         |if 0 - 7, it is exact
110         bra     set_finx        |if 8 - f, it     110         bra     set_finx        |if 8 - f, it is inexact
111 BG_RN:                                            111 BG_RN:
112         leal    BIGRN,%a0       |rmode is rn,     112         leal    BIGRN,%a0       |rmode is rn, load BGRN in a0
113         cmpib   #0x1,%d0                |check    113         cmpib   #0x1,%d0                |check if result is inex
114         ble     set_finx        |if 0 - 1, it     114         ble     set_finx        |if 0 - 1, it is inexact
115         cmpib   #0x7,%d0                |secon    115         cmpib   #0x7,%d0                |second check
116         ble     no_finx         |if 0 - 7, it     116         ble     no_finx         |if 0 - 7, it is exact
117         bra     set_finx        |if 8 - f, it     117         bra     set_finx        |if 8 - f, it is inexact
118 BG_RP:                                            118 BG_RP:
119         leal    BIGRP,%a0       |rmode is rp,     119         leal    BIGRP,%a0       |rmode is rp, load SMRP in a0
120         cmpib   #0x1,%d0                |check    120         cmpib   #0x1,%d0                |check if result is inex
121         ble     set_finx        |if 0 - 1, it     121         ble     set_finx        |if 0 - 1, it is inexact
122         cmpib   #0x7,%d0                |secon    122         cmpib   #0x7,%d0                |second check
123         ble     no_finx         |if 0 - 7, it     123         ble     no_finx         |if 0 - 7, it is exact
124 |       bra     set_finx        ;if 8 - f, it     124 |       bra     set_finx        ;if 8 - f, it is inexact
125 set_finx:                                         125 set_finx:
126         orl     #inx2a_mask,USER_FPSR(%a6) |se    126         orl     #inx2a_mask,USER_FPSR(%a6) |set inex2/ainex
127 no_finx:                                          127 no_finx:
128         mulul   #12,%d0                 |use o    128         mulul   #12,%d0                 |use offset to point into tables
129         movel   %d1,L_SCR1(%a6)         |load     129         movel   %d1,L_SCR1(%a6)         |load mode for round call
130         bfextu  USER_FPCR(%a6){#24:#2},%d1        130         bfextu  USER_FPCR(%a6){#24:#2},%d1      |get precision
131         tstl    %d1                     |check    131         tstl    %d1                     |check if extended precision
132 |                                                 132 |
133 | Precision is extended                           133 | Precision is extended
134 |                                                 134 |
135         bnes    not_ext                 |if ex    135         bnes    not_ext                 |if extended, do not call round
136         fmovemx (%a0,%d0),%fp0-%fp0               136         fmovemx (%a0,%d0),%fp0-%fp0             |return result in fp0
137         rts                                       137         rts
138 |                                                 138 |
139 | Precision is single or double                   139 | Precision is single or double
140 |                                                 140 |
141 not_ext:                                          141 not_ext:
142         swap    %d1                     |rnd p    142         swap    %d1                     |rnd prec in upper word of d1
143         addl    L_SCR1(%a6),%d1         |merge    143         addl    L_SCR1(%a6),%d1         |merge rmode in low word of d1
144         movel   (%a0,%d0),FP_SCR1(%a6)  |load     144         movel   (%a0,%d0),FP_SCR1(%a6)  |load first word to temp storage
145         movel   4(%a0,%d0),FP_SCR1+4(%a6)         145         movel   4(%a0,%d0),FP_SCR1+4(%a6)       |load second word
146         movel   8(%a0,%d0),FP_SCR1+8(%a6)         146         movel   8(%a0,%d0),FP_SCR1+8(%a6)       |load third word
147         clrl    %d0                     |clear    147         clrl    %d0                     |clear g,r,s
148         lea     FP_SCR1(%a6),%a0                  148         lea     FP_SCR1(%a6),%a0
149         btstb   #sign_bit,LOCAL_EX(%a0)           149         btstb   #sign_bit,LOCAL_EX(%a0)
150         sne     LOCAL_SGN(%a0)          |conve    150         sne     LOCAL_SGN(%a0)          |convert to internal ext. format
151                                                   151 
152         bsr     round                   |go ro    152         bsr     round                   |go round the mantissa
153                                                   153 
154         bfclr   LOCAL_SGN(%a0){#0:#8}   |conve    154         bfclr   LOCAL_SGN(%a0){#0:#8}   |convert back to IEEE ext format
155         beqs    fin_fcr                           155         beqs    fin_fcr
156         bsetb   #sign_bit,LOCAL_EX(%a0)           156         bsetb   #sign_bit,LOCAL_EX(%a0)
157 fin_fcr:                                          157 fin_fcr:
158         fmovemx (%a0),%fp0-%fp0                   158         fmovemx (%a0),%fp0-%fp0
159         rts                                       159         rts
160                                                   160 
161         |end                                      161         |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