Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) |	get_op.sa 3.6 5/19/92
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) |	get_op.sa 3.5 4/26/91
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) |  Description: This routine is called by the unsupported format/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) | type exception handler ('unsupp' - vector 55) and the unimplemented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) | instruction exception handler ('unimp' - vector 11).  'get_op'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) | determines the opclass (0, 2, or 3) and branches to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) | opclass handler routine.  See 68881/2 User's Manual table 4-11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) | for a description of the opclasses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) | For UNSUPPORTED data/format (exception vector 55) and for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) | UNIMPLEMENTED instructions (exception vector 11) the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) | applies:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) | - For unnormalized numbers (opclass 0, 2, or 3) the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) | number(s) is normalized and the operand type tag is updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) | - For a packed number (opclass 2) the number is unpacked and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) | operand type tag is updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) | - For denormalized numbers (opclass 0 or 2) the number(s) is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) | changed but passed to the next module.  The next module for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) | unimp is do_func, the next module for unsupp is res_func.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) | For UNSUPPORTED data/format (exception vector 55) only the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) | following applies:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) | - If there is a move out with a packed number (opclass 3) the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) | number is packed and written to user memory.  For the other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) | opclasses the number(s) are written back to the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) | and the instruction is then restored back into the '040.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) | '040 is then able to complete the instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) | For example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) | fadd.x fpm,fpn where the fpm contains an unnormalized number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) | The '040 takes an unsupported data trap and gets to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) | routine.  The number is normalized, put back on the stack and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) | then an frestore is done to restore the instruction back into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) | the '040.  The '040 then re-executes the fadd.x fpm,fpn with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) | a normalized number in the source and the instruction is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) | successful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) | Next consider if in the process of normalizing the un-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) | normalized number it becomes a denormalized number.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) | routine which converts the unnorm to a norm (called mk_norm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) | detects this and tags the number as a denorm.  The routine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) | res_func sees the denorm tag and converts the denorm to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) | norm.  The instruction is then restored back into the '040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) | which re_executes the instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) |		Copyright (C) Motorola, Inc. 1990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) |			All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) |       For details on the license for this file, please see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) |       file, README, in this same directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) GET_OP:    |idnt    2,1 | Motorola 040 Floating Point Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	|section	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #include "fpsp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.global	PIRN,PIRZRM,PIRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	.global	SMALRN,SMALRZRM,SMALRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	.global	BIGRN,BIGRZRM,BIGRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) PIRN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	.long 0x40000000,0xc90fdaa2,0x2168c235    |pi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) PIRZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	.long 0x40000000,0xc90fdaa2,0x2168c234    |pi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) PIRP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	.long 0x40000000,0xc90fdaa2,0x2168c235    |pi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) |round to nearest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) SMALRN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	.long 0x3ffd0000,0x9a209a84,0xfbcff798    |log10(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.long 0x40000000,0xadf85458,0xa2bb4a9a    |e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bc    |log2(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	.long 0x3ffd0000,0xde5bd8a9,0x37287195    |log10(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	.long 0x00000000,0x00000000,0x00000000    |0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) | round to zero;round to negative infinity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) SMALRZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.long 0x3ffd0000,0x9a209a84,0xfbcff798    |log10(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	.long 0x40000000,0xadf85458,0xa2bb4a9a    |e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bb    |log2(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	.long 0x3ffd0000,0xde5bd8a9,0x37287195    |log10(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	.long 0x00000000,0x00000000,0x00000000    |0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) | round to positive infinity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) SMALRP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.long 0x3ffd0000,0x9a209a84,0xfbcff799    |log10(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	.long 0x40000000,0xadf85458,0xa2bb4a9b    |e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bc    |log2(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.long 0x3ffd0000,0xde5bd8a9,0x37287195    |log10(e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.long 0x00000000,0x00000000,0x00000000    |0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) |round to nearest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) BIGRN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	.long 0x3ffe0000,0xb17217f7,0xd1cf79ac    |ln(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	.long 0x40000000,0x935d8ddd,0xaaa8ac17    |ln(10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	.long 0x3fff0000,0x80000000,0x00000000    |10 ^ 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.global	PTENRN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) PTENRN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.long 0x40020000,0xA0000000,0x00000000    |10 ^ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	.long 0x40050000,0xC8000000,0x00000000    |10 ^ 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	.long 0x400C0000,0x9C400000,0x00000000    |10 ^ 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	.long 0x40190000,0xBEBC2000,0x00000000    |10 ^ 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	.long 0x40340000,0x8E1BC9BF,0x04000000    |10 ^ 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	.long 0x40690000,0x9DC5ADA8,0x2B70B59E    |10 ^ 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	.long 0x40D30000,0xC2781F49,0xFFCFA6D5    |10 ^ 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.long 0x41A80000,0x93BA47C9,0x80E98CE0    |10 ^ 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8E    |10 ^ 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.long 0x46A30000,0xE319A0AE,0xA60E91C7    |10 ^ 512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.long 0x4D480000,0xC9767586,0x81750C17    |10 ^ 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE5    |10 ^ 2048
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.long 0x75250000,0xC4605202,0x8A20979B    |10 ^ 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) |round to minus infinity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) BIGRZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.long 0x3ffe0000,0xb17217f7,0xd1cf79ab    |ln(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	.long 0x40000000,0x935d8ddd,0xaaa8ac16    |ln(10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	.long 0x3fff0000,0x80000000,0x00000000    |10 ^ 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.global	PTENRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) PTENRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	.long 0x40020000,0xA0000000,0x00000000    |10 ^ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	.long 0x40050000,0xC8000000,0x00000000    |10 ^ 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	.long 0x400C0000,0x9C400000,0x00000000    |10 ^ 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.long 0x40190000,0xBEBC2000,0x00000000    |10 ^ 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	.long 0x40340000,0x8E1BC9BF,0x04000000    |10 ^ 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	.long 0x40690000,0x9DC5ADA8,0x2B70B59D    |10 ^ 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	.long 0x40D30000,0xC2781F49,0xFFCFA6D5    |10 ^ 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	.long 0x41A80000,0x93BA47C9,0x80E98CDF    |10 ^ 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8D    |10 ^ 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	.long 0x46A30000,0xE319A0AE,0xA60E91C6    |10 ^ 512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.long 0x4D480000,0xC9767586,0x81750C17    |10 ^ 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE5    |10 ^ 2048
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.long 0x75250000,0xC4605202,0x8A20979A    |10 ^ 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) |round to positive infinity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) BIGRP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.long 0x3ffe0000,0xb17217f7,0xd1cf79ac    |ln(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	.long 0x40000000,0x935d8ddd,0xaaa8ac17    |ln(10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	.long 0x3fff0000,0x80000000,0x00000000    |10 ^ 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	.global	PTENRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) PTENRP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	.long 0x40020000,0xA0000000,0x00000000    |10 ^ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	.long 0x40050000,0xC8000000,0x00000000    |10 ^ 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	.long 0x400C0000,0x9C400000,0x00000000    |10 ^ 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.long 0x40190000,0xBEBC2000,0x00000000    |10 ^ 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.long 0x40340000,0x8E1BC9BF,0x04000000    |10 ^ 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.long 0x40690000,0x9DC5ADA8,0x2B70B59E    |10 ^ 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.long 0x40D30000,0xC2781F49,0xFFCFA6D6    |10 ^ 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	.long 0x41A80000,0x93BA47C9,0x80E98CE0    |10 ^ 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8E    |10 ^ 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.long 0x46A30000,0xE319A0AE,0xA60E91C7    |10 ^ 512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.long 0x4D480000,0xC9767586,0x81750C18    |10 ^ 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE6    |10 ^ 2048
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	.long 0x75250000,0xC4605202,0x8A20979B    |10 ^ 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	|xref	nrm_zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	|xref	decbin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	|xref	round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	.global    get_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	.global    uns_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	.global    uni_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) get_op:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	clrb	DY_MO_FLG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	tstb	UFLG_TMP(%a6)	|test flag for unsupp/unimp state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	beq	uni_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) uns_getop:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	btstb	#direction_bit,CMDREG1B(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	bne	opclass3	|branch if a fmove out (any kind)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	btstb	#6,CMDREG1B(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	beqs	uns_notpacked
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	bfextu	CMDREG1B(%a6){#3:#3},%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	cmpb	#3,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	beq	pack_source	|check for a packed src op, branch if so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) uns_notpacked:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	bsr	chk_dy_mo	|set the dyadic/monadic flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	tstb	DY_MO_FLG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	beqs	src_op_ck	|if monadic, go check src op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) |				;else, check dst op (fall through)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	btstb	#7,DTAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	beqs	src_op_ck	|if dst op is norm, check src op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	bras	dst_ex_dnrm	|else, handle destination unnorm/dnrm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) uni_getop:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	bfextu	CMDREG1B(%a6){#0:#6},%d0 |get opclass and src fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	cmpil	#0x17,%d0		|if op class and size fields are $17,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) |				;it is FMOVECR; if not, continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) | If the instruction is fmovecr, exit get_op.  It is handled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) | in do_func and smovecr.sa.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	bne	not_fmovecr	|handle fmovecr as an unimplemented inst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) not_fmovecr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	btstb	#E1,E_BYTE(%a6)	|if set, there is a packed operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	bne	pack_source	|check for packed src op, branch if so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) | The following lines of are coded to optimize on normalized operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	moveb	STAG(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	orb	DTAG(%a6),%d0	|check if either of STAG/DTAG msb set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	bmis	dest_op_ck	|if so, some op needs to be fixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) dest_op_ck:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	btstb	#7,DTAG(%a6)	|check for unsupported data types in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	beqs	src_op_ck	|the destination, if not, check src op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	bsr	chk_dy_mo	|set dyadic/monadic flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	tstb	DY_MO_FLG(%a6)	|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	beqs	src_op_ck	|if monadic, check src op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) | At this point, destination has an extended denorm or unnorm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) dst_ex_dnrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	movew	FPTEMP_EX(%a6),%d0 |get destination exponent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	andiw	#0x7fff,%d0	|mask sign, check if exp = 0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	beqs	src_op_ck	|if denorm then check source op.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) |				;denorms are taken care of in res_func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) |				;(unsupp) or do_func (unimp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) |				;else unnorm fall through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	leal	FPTEMP(%a6),%a0	|point a0 to dop - used in mk_norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	bsr	mk_norm		|go normalize - mk_norm returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) |				;L_SCR1{7:5} = operand tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) |				;	(000 = norm, 100 = denorm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) |				;L_SCR1{4} = fpte15 or ete15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) |				;	0 = exp >  $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) |				;	1 = exp <= $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) |				;and puts the normalized num back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) |				;on the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	moveb L_SCR1(%a6),DTAG(%a6) |write the new tag & fpte15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) |				;to the fsave stack and fall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) |				;through to check source operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) src_op_ck:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	btstb	#7,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	beq	end_getop	|check for unsupported data types on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) |				;source operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	btstb	#5,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	bnes	src_sd_dnrm	|if bit 5 set, handle sgl/dbl denorms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) | At this point only unnorms or extended denorms are possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) src_ex_dnrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	movew	ETEMP_EX(%a6),%d0 |get source exponent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	andiw	#0x7fff,%d0	|mask sign, check if exp = 0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	beq	end_getop	|if denorm then exit, denorms are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) |				;handled in do_func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	leal	ETEMP(%a6),%a0	|point a0 to sop - used in mk_norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	bsr	mk_norm		|go normalize - mk_norm returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) |				;L_SCR1{7:5} = operand tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) |				;	(000 = norm, 100 = denorm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) |				;L_SCR1{4} = fpte15 or ete15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) |				;	0 = exp >  $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) |				;	1 = exp <= $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) |				;and puts the normalized num back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) |				;on the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	moveb	L_SCR1(%a6),STAG(%a6) |write the new tag & ete15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	rts			|end_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) | At this point, only single or double denorms are possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) | If the inst is not fmove, normalize the source.  If it is,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) | do nothing to the input.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) src_sd_dnrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	btstb	#4,CMDREG1B(%a6)	|differentiate between sgl/dbl denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	bnes	is_double
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) is_single:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	movew	#0x3f81,%d1	|write bias for sgl denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	bras	common		|goto the common code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) is_double:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	movew	#0x3c01,%d1	|write the bias for a dbl denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) common:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	btstb	#sign_bit,ETEMP_EX(%a6) |grab sign bit of mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	beqs	pos
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	bset	#15,%d1		|set sign bit because it is negative
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) pos:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	movew	%d1,ETEMP_EX(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) |				;put exponent on stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	movew	CMDREG1B(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	andw	#0xe3ff,%d1	|clear out source specifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	orw	#0x0800,%d1	|set source specifier to extended prec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	movew	%d1,CMDREG1B(%a6)	|write back to the command word in stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) |				;this is needed to fix unsupp data stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	leal	ETEMP(%a6),%a0	|point a0 to sop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	bsr	mk_norm		|convert sgl/dbl denorm to norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	moveb	L_SCR1(%a6),STAG(%a6) |put tag into source tag reg - d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	rts			|end_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) | At this point, the source is definitely packed, whether
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) | instruction is dyadic or monadic is still unknown
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) pack_source:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	movel	FPTEMP_LO(%a6),ETEMP(%a6)	|write ms part of packed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) |				;number to etemp slot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	bsr	chk_dy_mo	|set dyadic/monadic flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	bsr	unpack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	tstb	DY_MO_FLG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	beqs	end_getop	|if monadic, exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) |				;else, fix FPTEMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) pack_dya:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	bfextu	CMDREG1B(%a6){#6:#3},%d0 |extract dest fp reg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	movel	#7,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	subl	%d0,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	clrl	%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	bsetl	%d1,%d0		|set up d0 as a dynamic register mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	fmovemx %d0,FPTEMP(%a6)	|write to FPTEMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	btstb	#7,DTAG(%a6)	|check dest tag for unnorm or denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	bne	dst_ex_dnrm	|else, handle the unnorm or ext denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) | Dest is not denormalized.  Check for norm, and set fpte15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) | accordingly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	moveb	DTAG(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	andib	#0xf0,%d0		|strip to only dtag:fpte15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	tstb	%d0		|check for normalized value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	bnes	end_getop	|if inf/nan/zero leave get_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	movew	FPTEMP_EX(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	andiw	#0x7fff,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	cmpiw	#0x3fff,%d0	|check if fpte15 needs setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	bges	end_getop	|if >= $3fff, leave fpte15=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	orb	#0x10,DTAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	bras	end_getop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) | At this point, it is either an fmoveout packed, unnorm or denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) opclass3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	clrb	DY_MO_FLG(%a6)	|set dyadic/monadic flag to monadic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	bfextu	CMDREG1B(%a6){#4:#2},%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	cmpib	#3,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	bne	src_ex_dnrm	|if not equal, must be unnorm or denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) |				;else it is a packed move out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) |				;exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) end_getop:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) | Sets the DY_MO_FLG correctly. This is used only on if it is an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) | unsupported data type exception.  Set if dyadic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) chk_dy_mo:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	movew	CMDREG1B(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	btstl	#5,%d0		|testing extension command word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	beqs	set_mon		|if bit 5 = 0 then monadic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	btstl	#4,%d0		|know that bit 5 = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	beqs	set_dya		|if bit 4 = 0 then dyadic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	andiw	#0x007f,%d0	|get rid of all but extension bits {6:0}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	cmpiw	#0x0038,%d0	|if extension = $38 then fcmp (dyadic)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	bnes	set_mon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) set_dya:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	st	DY_MO_FLG(%a6)	|set the inst flag type to dyadic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) set_mon:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	clrb	DY_MO_FLG(%a6)	|set the inst flag type to monadic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) |	MK_NORM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) | Normalizes unnormalized numbers, sets tag to norm or denorm, sets unfl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) | exception if denorm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) | CASE opclass 0x0 unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) |	mk_norm till msb set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) |	set tag = norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) | CASE opclass 0x0 unimp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) |	mk_norm till msb set or exp = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) |	if integer bit = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) |	   tag = denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) |	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) |	   tag = norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) | CASE opclass 011 unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) |	mk_norm till msb set or exp = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) |	if integer bit = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) |	   tag = denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) |	   set unfl_nmcexe = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) |	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) |	   tag = norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) | if exp <= $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) |   set ete15 or fpte15 = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) | else set ete15 or fpte15 = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) | input:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) |	a0 = points to operand to be normalized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) | output:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) |	L_SCR1{7:5} = operand tag (000 = norm, 100 = denorm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) |	L_SCR1{4}   = fpte15 or ete15 (0 = exp > $3fff, 1 = exp <=$3fff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) |	the normalized operand is placed back on the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) mk_norm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	clrl	L_SCR1(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	bclrb	#sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	sne	LOCAL_SGN(%a0)	|transform into internal extended format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	cmpib	#0x2c,1+EXC_VEC(%a6) |check if unimp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	bnes	uns_data	|branch if unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	bsr	uni_inst	|call if unimp (opclass 0x0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	bras	reload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) uns_data:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	btstb	#direction_bit,CMDREG1B(%a6) |check transfer direction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	bnes	bit_set		|branch if set (opclass 011)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	bsr	uns_opx		|call if opclass 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	bras	reload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) bit_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	bsr	uns_op3		|opclass 011
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) reload:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	cmpw	#0x3fff,LOCAL_EX(%a0) |if exp > $3fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	bgts	end_mk		|   fpte15/ete15 already set to 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	bsetb	#4,L_SCR1(%a6)	|else set fpte15/ete15 to 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) |				;calling routine actually sets the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) |				;value on the stack (along with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) |				;tag), since this routine doesn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) |				;know if it should set ete15 or fpte15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) |				;ie, it doesn't know if this is the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) |				;src op or dest op.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) end_mk:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	bfclr	LOCAL_SGN(%a0){#0:#8}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	beqs	end_mk_pos
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	bsetb	#sign_bit,LOCAL_EX(%a0) |convert back to IEEE format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) end_mk_pos:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) |     CASE opclass 011 unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) uns_op3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	bsr	nrm_zero	|normalize till msb = 1 or exp = zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	btstb	#7,LOCAL_HI(%a0)	|if msb = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	bnes	no_unfl		|then branch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) set_unfl:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	orw	#dnrm_tag,L_SCR1(%a6) |set denorm tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	bsetb	#unfl_bit,FPSR_EXCEPT(%a6) |set unfl exception bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) no_unfl:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) |     CASE opclass 0x0 unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) uns_opx:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	bsr	nrm_zero	|normalize the number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	beqs	uns_den		|if clear then now have a denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) uns_nrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	orb	#norm_tag,L_SCR1(%a6) |set tag to norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) uns_den:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	orb	#dnrm_tag,L_SCR1(%a6) |set tag to denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) |     CASE opclass 0x0 unimp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) uni_inst:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	bsr	nrm_zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	beqs	uni_den		|if clear then now have a denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) uni_nrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	orb	#norm_tag,L_SCR1(%a6) |set tag to norm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) uni_den:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	orb	#dnrm_tag,L_SCR1(%a6) |set tag to denorm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) |	Decimal to binary conversion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) | Special cases of inf and NaNs are completed outside of decbin.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) | If the input is an snan, the snan bit is not set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) | input:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) |	ETEMP(a6)	- points to packed decimal string in memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) | output:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) |	fp0	- contains packed string converted to extended precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) |	ETEMP	- same as fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) unpack:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	movew	CMDREG1B(%a6),%d0	|examine command word, looking for fmove's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 	andw	#0x3b,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	beq	move_unpack	|special handling for fmove: must set FPSR_CC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	movew	ETEMP(%a6),%d0	|get word with inf information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	bfextu	%d0{#20:#12},%d1	|get exponent into d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	cmpiw	#0x0fff,%d1	|test for inf or NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	bnes	try_zero	|if not equal, it is not special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	bfextu	%d0{#17:#3},%d1	|get SE and y bits into d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	cmpiw	#7,%d1		|SE and y bits must be on for special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 	bnes	try_zero	|if not on, it is not special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) |input is of the special cases of inf and NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	tstl	ETEMP_HI(%a6)	|check ms mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	bnes	fix_nan		|if non-zero, it is a NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	tstl	ETEMP_LO(%a6)	|check ls mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	bnes	fix_nan		|if non-zero, it is a NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	bra	finish		|special already on stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) fix_nan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	btstb	#signan_bit,ETEMP_HI(%a6) |test for snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	bne	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	orl	#snaniop_mask,USER_FPSR(%a6) |always set snan if it is so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	bra	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) try_zero:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 	movew	ETEMP_EX+2(%a6),%d0 |get word 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	andiw	#0x000f,%d0	|clear all but last ni(y)bble
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	tstw	%d0		|check for zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	bne	not_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	tstl	ETEMP_HI(%a6)	|check words 3 and 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	bne	not_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	tstl	ETEMP_LO(%a6)	|check words 1 and 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	bne	not_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	tstl	ETEMP(%a6)	|test sign of the zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	bges	pos_zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 	movel	#0x80000000,ETEMP(%a6) |write neg zero to etemp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	clrl	ETEMP_HI(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	clrl	ETEMP_LO(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 	bra	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) pos_zero:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	clrl	ETEMP(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	clrl	ETEMP_HI(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	clrl	ETEMP_LO(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	bra	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) not_spec:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	fmovemx %fp0-%fp1,-(%a7)	|save fp0 - decbin returns in it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	bsr	decbin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	fmovex %fp0,ETEMP(%a6)	|put the unpacked sop in the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	fmovemx (%a7)+,%fp0-%fp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	fmovel	#0,%FPSR		|clr fpsr from decbin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	bra	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) | Special handling for packed move in:  Same results as all other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) | packed cases, but we must set the FPSR condition codes properly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) move_unpack:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	movew	ETEMP(%a6),%d0	|get word with inf information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	bfextu	%d0{#20:#12},%d1	|get exponent into d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	cmpiw	#0x0fff,%d1	|test for inf or NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	bnes	mtry_zero	|if not equal, it is not special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	bfextu	%d0{#17:#3},%d1	|get SE and y bits into d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 	cmpiw	#7,%d1		|SE and y bits must be on for special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	bnes	mtry_zero	|if not on, it is not special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) |input is of the special cases of inf and NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	tstl	ETEMP_HI(%a6)	|check ms mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	bnes	mfix_nan		|if non-zero, it is a NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	tstl	ETEMP_LO(%a6)	|check ls mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	bnes	mfix_nan		|if non-zero, it is a NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) |input is inf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	orl	#inf_mask,USER_FPSR(%a6) |set I bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	tstl	ETEMP(%a6)	|check sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	bge	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	orl	#neg_mask,USER_FPSR(%a6) |set N bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	bra	finish		|special already on stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) mfix_nan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	orl	#nan_mask,USER_FPSR(%a6) |set NaN bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	moveb	#nan_tag,STAG(%a6)	|set stag to NaN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	btstb	#signan_bit,ETEMP_HI(%a6) |test for snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	bnes	mn_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	orl	#snaniop_mask,USER_FPSR(%a6) |set snan bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	btstb	#snan_bit,FPCR_ENABLE(%a6) |test for snan enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	bnes	mn_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	bsetb	#signan_bit,ETEMP_HI(%a6) |force snans to qnans
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) mn_snan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 	tstl	ETEMP(%a6)	|check for sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	bge	finish		|if clr, go on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	orl	#neg_mask,USER_FPSR(%a6) |set N bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	bra	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) mtry_zero:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	movew	ETEMP_EX+2(%a6),%d0 |get word 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	andiw	#0x000f,%d0	|clear all but last ni(y)bble
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	tstw	%d0		|check for zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	bnes	mnot_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	tstl	ETEMP_HI(%a6)	|check words 3 and 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	bnes	mnot_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	tstl	ETEMP_LO(%a6)	|check words 1 and 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	bnes	mnot_spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	tstl	ETEMP(%a6)	|test sign of the zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	bges	mpos_zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	orl	#neg_mask+z_mask,USER_FPSR(%a6) |set N and Z
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	movel	#0x80000000,ETEMP(%a6) |write neg zero to etemp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	clrl	ETEMP_HI(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	clrl	ETEMP_LO(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	bras	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) mpos_zero:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	orl	#z_mask,USER_FPSR(%a6) |set Z
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	clrl	ETEMP(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	clrl	ETEMP_HI(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	clrl	ETEMP_LO(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	bras	finish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) mnot_spec:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	fmovemx %fp0-%fp1,-(%a7)	|save fp0 ,fp1 - decbin returns in fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	bsr	decbin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	fmovex %fp0,ETEMP(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) |				;put the unpacked sop in the fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 	fmovemx (%a7)+,%fp0-%fp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) finish:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	movew	CMDREG1B(%a6),%d0	|get the command word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	andw	#0xfbff,%d0	|change the source specifier field to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) |				;extended (was packed).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 	movew	%d0,CMDREG1B(%a6)	|write command word back to fsave stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) |				;we need to do this so the 040 will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) |				;re-execute the inst. without taking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) |				;another packed trap.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) fix_stag:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) |Converted result is now in etemp on fsave stack, now set the source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) |tag (stag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) |	if (ete =$7fff) then INF or NAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) |		if (etemp = $x.0----0) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) |			stag = INF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) |		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) |			stag = NAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) |	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) |		if (ete = $0000) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) |			stag = ZERO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) |		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) |			stag = NORM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) | Note also that the etemp_15 bit (just right of the stag) must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) | be set accordingly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	movew		ETEMP_EX(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	andiw		#0x7fff,%d1   |strip sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	cmpw		#0x7fff,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 	bnes		z_or_nrm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	movel		ETEMP_HI(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 	bnes		is_nan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 	movel		ETEMP_LO(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 	bnes		is_nan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) is_inf:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 	moveb		#0x40,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 	movel		#0x40,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) is_nan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 	moveb		#0x60,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 	movel		#0x60,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) z_or_nrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 	tstw		%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	bnes		is_nrm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) is_zro:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) | For a zero, set etemp_15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 	moveb		#0x30,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	movel		#0x20,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) is_nrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) | For a norm, check if the exp <= $3fff; if so, set etemp_15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	cmpiw		#0x3fff,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	bles		set_bit15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 	moveb		#0,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	bras		end_is_nrm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) set_bit15:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	moveb		#0x10,STAG(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) end_is_nrm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	movel		#0,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) end_fix:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) end_get:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	|end