^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) | sint.sa 3.1 12/10/90
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) | The entry point sINT computes the rounded integer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) | equivalent of the input argument, sINTRZ computes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) | the integer rounded to zero of the input argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) | Entry points sint and sintrz are called from do_func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) | to emulate the fint and fintrz unimplemented instructions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) | respectively. Entry point sintdo is used by bindec.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) | Input: (Entry points sint and sintrz) Double-extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) | number X in the ETEMP space in the floating-point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) | save stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) | (Entry point sintdo) Double-extended number X in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) | location pointed to by the address register a0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) | (Entry point sintd) Double-extended denormalized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) | number X in the ETEMP space in the floating-point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) | save stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) | Output: The function returns int(X) or intrz(X) in fp0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) | Modifies: fp0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) | Algorithm: (sint and sintrz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) | 1. If exp(X) >= 63, return X.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) | If exp(X) < 0, return +/- 0 or +/- 1, according to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) | the rounding mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) | 2. (X is in range) set rsc = 63 - exp(X). Unnormalize the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) | result to the exponent $403e.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) | 3. Round the result in the mode given in USER_FPCR. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) | sintrz, force round-to-zero mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) | 4. Normalize the rounded result; store in fp0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) | For the denormalized cases, force the correct result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) | for the given sign and rounding mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) | Sign(X)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) | RMODE + -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) | ----- --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) | RN +0 -0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) | RZ +0 -0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) | RM +0 -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) | RP +1 -0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) | Copyright (C) Motorola, Inc. 1990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) | All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) | For details on the license for this file, please see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) | file, README, in this same directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) |SINT idnt 2,1 | Motorola 040 Floating Point Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) |section 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #include "fpsp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) |xref dnrm_lp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) |xref nrm_set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) |xref round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) |xref t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) |xref ld_pone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) |xref ld_mone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) |xref ld_pzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) |xref ld_mzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) |xref snzrinx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) | FINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .global sint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) sint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) bfextu FPCR_MODE(%a6){#2:#2},%d1 |use user's mode for rounding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) | ;implicitly has extend precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) | ;in upper word.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) movel %d1,L_SCR1(%a6) |save mode bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) bras sintexc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) | FINT with extended denorm inputs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .global sintd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) sintd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) btstb #5,FPCR_MODE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) beq snzrinx |if round nearest or round zero, +/- 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) btstb #4,FPCR_MODE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) beqs rnd_mns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) rnd_pls:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) btstb #sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) bnes sintmz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) bsr ld_pone |if round plus inf and pos, answer is +1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) rnd_mns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) btstb #sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) beqs sintpz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) bsr ld_mone |if round mns inf and neg, answer is -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) sintpz:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) bsr ld_pzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) sintmz:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) bsr ld_mzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) | FINTRZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .global sintrz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) sintrz:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) movel #1,L_SCR1(%a6) |use rz mode for rounding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) | ;implicitly has extend precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) | ;in upper word.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) bras sintexc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) | SINTDO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) | Input: a0 points to an IEEE extended format operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) | Output: fp0 has the result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) | Exceptions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) | If the subroutine results in an inexact operation, the inx2 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) | ainx bits in the USER_FPSR are set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) .global sintdo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) sintdo:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) bfextu FPCR_MODE(%a6){#2:#2},%d1 |use user's mode for rounding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) | ;implicitly has ext precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) | ;in upper word.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) movel %d1,L_SCR1(%a6) |save mode bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) | Real work of sint is in sintexc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) sintexc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) bclrb #sign_bit,LOCAL_EX(%a0) |convert to internal extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) | ;format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) sne LOCAL_SGN(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) cmpw #0x403e,LOCAL_EX(%a0) |check if (unbiased) exp > 63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) bgts out_rnge |branch if exp < 63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) cmpw #0x3ffd,LOCAL_EX(%a0) |check if (unbiased) exp < 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) bgt in_rnge |if 63 >= exp > 0, do calc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) | Input is less than zero. Restore sign, and check for directed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) | rounding modes. L_SCR1 contains the rmode in the lower byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) un_rnge:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) btstb #1,L_SCR1+3(%a6) |check for rn and rz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) beqs un_rnrz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) tstb LOCAL_SGN(%a0) |check for sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) bnes un_rmrp_neg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) | Sign is +. If rp, load +1.0, if rm, load +0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) cmpib #3,L_SCR1+3(%a6) |check for rp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) beqs un_ldpone |if rp, load +1.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) bsr ld_pzero |if rm, load +0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) un_ldpone:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) bsr ld_pone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) | Sign is -. If rm, load -1.0, if rp, load -0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) un_rmrp_neg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) cmpib #2,L_SCR1+3(%a6) |check for rm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) beqs un_ldmone |if rm, load -1.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) bsr ld_mzero |if rp, load -0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) un_ldmone:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) bsr ld_mone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) | Rmode is rn or rz; return signed zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) un_rnrz:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) tstb LOCAL_SGN(%a0) |check for sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) bnes un_rnrz_neg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) bsr ld_pzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) un_rnrz_neg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) bsr ld_mzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) bra t_inx2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) | Input is greater than 2^63. All bits are significant. Return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) | the input.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) out_rnge:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) bfclr LOCAL_SGN(%a0){#0:#8} |change back to IEEE ext format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) beqs intps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) bsetb #sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) intps:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) fmovel %fpcr,-(%sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) fmovel #0,%fpcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) fmovex LOCAL_EX(%a0),%fp0 |if exp > 63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) | ;then return X to the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) | ;there are no fraction bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) fmovel (%sp)+,%fpcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) in_rnge:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) | ;shift off fraction bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) clrl %d0 |clear d0 - initial g,r,s for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) | ;dnrm_lp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) movel #0x403e,%d1 |set threshold for dnrm_lp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) | ;assumes a0 points to operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) bsr dnrm_lp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) | ;returns unnormalized number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) | ;pointed by a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) | ;output d0 supplies g,r,s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) | ;used by round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) movel L_SCR1(%a6),%d1 |use selected rounding mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) bsr round |round the unnorm based on users
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) | ;input a0 ptr to ext X
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) | ; d0 g,r,s bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) | ; d1 PREC/MODE info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) | ;output a0 ptr to rounded result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) | ;inexact flag set in USER_FPSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) | ;if initial grs set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) | normalize the rounded result and store value in fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) bsr nrm_set |normalize the unnorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) | ;Input: a0 points to operand to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) | ;be normalized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) | ;Output: a0 points to normalized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) | ;result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) bfclr LOCAL_SGN(%a0){#0:#8}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) beqs nrmrndp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) bsetb #sign_bit,LOCAL_EX(%a0) |return to IEEE extended format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) nrmrndp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) fmovel %fpcr,-(%sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) fmovel #0,%fpcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) fmovex LOCAL_EX(%a0),%fp0 |move result to fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) fmovel (%sp)+,%fpcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) |end