1 | 2 | x_ovfl.sa 3.5 7/1/91 3 | 4 | fpsp_ovfl --- FPSP handler for overflo 5 | 6 | Overflow occurs when a floating-point 7 | too large to be represented in a float 8 | or when storing to memory, the content 9 | data register are too large to be repr 10 | destination format. 11 | 12 | Trap disabled results 13 | 14 | If the instruction is move_out, then garbage 15 | destination. If the instruction is not move 16 | destination is not affected. For 68881 comp 17 | following values should be stored at the des 18 | on the current rounding mode: 19 | 20 | RN Infinity with the sign of the intermed 21 | RZ Largest magnitude number, with the sig 22 | intermediate result. 23 | RM For pos overflow, the largest pos numb 24 | -infinity 25 | RP For pos overflow, +infinity. For neg o 26 | neg number 27 | 28 | Trap enabled results 29 | All trap disabled code applies. In addition 30 | operand needs to be made available to the us 31 | with a bias of $6000 subtracted from the exp 32 | 33 | 34 35 | Copyright (C) Motorola, Inc. 1 36 | All Rights Reserved 37 | 38 | For details on the license for this fi 39 | file, README, in this same directory. 40 41 X_OVFL: |idnt 2,1 | Motorola 040 Floating P 42 43 |section 8 44 45 #include "fpsp.h" 46 47 |xref ovf_r_x2 48 |xref ovf_r_x3 49 |xref store 50 |xref real_ovfl 51 |xref real_inex 52 |xref fpsp_done 53 |xref g_opcls 54 |xref b1238_fix 55 56 .global fpsp_ovfl 57 fpsp_ovfl: 58 link %a6,#-LOCAL_SIZE 59 fsave -(%a7) 60 moveml %d0-%d1/%a0-%a1,USER_D 61 fmovemx %fp0-%fp3,USER_FP0(%a6) 62 fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(% 63 64 | 65 | The 040 doesn't set the AINEX bit in t 66 | line temporarily rectifies this error. 67 | 68 bsetb #ainex_bit,FPSR_AEXCEPT(%a6) 69 | 70 bsrl ovf_adj |denormalize, 71 | 72 | if overflow traps not enabled check fo 73 | 74 btstb #ovfl_bit,FPCR_ENABLE(%a6) 75 beqs ck_inex 76 | 77 btstb #E3,E_BYTE(%a6) 78 beqs no_e3_1 79 bfextu CMDREG3B(%a6){#6:#3},% 80 bclrb %d0,FPR_DIRTY_BITS(%a6 81 bsrl b1238_fix 82 movel USER_FPSR(%a6),FPSR_SH 83 orl #sx_mask,E_BYTE(%a6) 84 no_e3_1: 85 moveml USER_DA(%a6),%d0-%d1/% 86 fmovemx USER_FP0(%a6),%fp0-%fp3 87 fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp 88 frestore (%a7)+ 89 unlk %a6 90 bral real_ovfl 91 | 92 | It is possible to have either inex2 or inex1 93 | ovfl. If the inex enable bit is set in the 94 | inex2 or inex1 occurred, we must clean up an 95 | real inex handler. 96 | 97 ck_inex: 98 | move.b FPCR_ENABLE(%a6),%d0 99 | and.b FPSR_EXCEPT(%a6),%d0 100 | andi.b #$3,%d0 101 btstb #inex2_bit,FPCR_ENABLE 102 beqs ovfl_exit 103 | 104 | Inexact enabled and reported, and we must ta 105 | 106 take_inex: 107 btstb #E3,E_BYTE(%a6) 108 beqs no_e3_2 109 bfextu CMDREG3B(%a6){#6:#3},% 110 bclrb %d0,FPR_DIRTY_BITS(%a6 111 bsrl b1238_fix 112 movel USER_FPSR(%a6),FPSR_SH 113 orl #sx_mask,E_BYTE(%a6) 114 no_e3_2: 115 moveb #INEX_VEC,EXC_VEC+1(%a 116 moveml USER_DA(%a6),%d0-%d1/% 117 fmovemx USER_FP0(%a6),%fp0-%fp3 118 fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp 119 frestore (%a7)+ 120 unlk %a6 121 bral real_inex 122 123 ovfl_exit: 124 bclrb #E3,E_BYTE(%a6) |test and clea 125 beqs e1_set 126 | 127 | Clear dirty bit on dest resister in the fram 128 | to b1238_fix. 129 | 130 bfextu CMDREG3B(%a6){#6:#3},% 131 bclrb %d0,FPR_DIRTY_BITS(%a6 132 bsrl b1238_fix 133 134 movel USER_FPSR(%a6),FPSR_SH 135 orl #sx_mask,E_BYTE(%a6) 136 moveml USER_DA(%a6),%d0-%d1/% 137 fmovemx USER_FP0(%a6),%fp0-%fp3 138 fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp 139 frestore (%a7)+ 140 unlk %a6 141 bral fpsp_done 142 e1_set: 143 moveml USER_DA(%a6),%d0-%d1/% 144 fmovemx USER_FP0(%a6),%fp0-%fp3 145 fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp 146 unlk %a6 147 bral fpsp_done 148 149 | 150 | ovf_adj 151 | 152 ovf_adj: 153 | 154 | Have a0 point to the correct operand. 155 | 156 btstb #E3,E_BYTE(%a6) |test E3 bit 157 beqs ovf_e1 158 159 lea WBTEMP(%a6),%a0 160 bras ovf_com 161 ovf_e1: 162 lea ETEMP(%a6),%a0 163 164 ovf_com: 165 bclrb #sign_bit,LOCAL_EX(%a0) 166 sne LOCAL_SGN(%a0) 167 168 bsrl g_opcls |returns opcla 169 cmpiw #3,%d0 |check for opc 170 bnes not_opc011 171 172 | 173 | FPSR_CC is saved and restored because ovf_r_ 174 | CCs are defined to be 'not affected' for the 175 | 176 moveb FPSR_CC(%a6),L_SCR1(%a6) 177 bsrl ovf_r_x3 |returns a0 po 178 moveb L_SCR1(%a6),FPSR_CC(%a6) 179 bral store |stores to mem 180 181 not_opc011: 182 bsrl ovf_r_x2 |returns a0 po 183 bral store |stores to mem 184 185 |end
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.