Impressum fp_util.S
Interaktion und PortierbarkeitSparc
/* * fp_util.S * * Copyright Roman Zippel, 1997. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU General Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include * notice, this list of conditions and the following disclaimer in the
/* * Here are lots of conversion and normalization functions mainly * used by fp_scan.S * Note that these functions are optimized for "normal" numbers, * these are handled first and exit as fast as possible, this is * especially important for fp_normalize_ext/fp_conv_ext2ext, as * it's called very often. * The register usage is optimized for fp_scan.S and which register * is currently at that time unused, be careful if you want change * something here. %d0 and %d1 is always usable, sometimes %d2 (or * only the lower half) most function have to return the %a0 * unmodified, so that the caller can immediately reuse it.
*/
.globl fp_ill, * * THIS SOFTWARE IS PROVIDED * WARRANTIES, INCLUDING, BUT NOT * OF MERCHANTABILITY AND FITNESS * * SERVICES; LOSS OF * HOWEVER CAUSED AND ON ANY * STRICT LIABILITY, OR * ARISING IN ANY WAY OUT OF THEMAGE.
| exits from fp_scan:
| illegal instruction
fp_ill:
printf ," * especially important for fp_normalize_ext/fp_conv_ext2ext * it's called very often * The register usage is optimized for * is currently at that time unused, be careful if you want change
rts
| completed instruction
fp_end * unmodified, so that the
globlfp_ill fp_end
jmi
| exitsfrom:
jmi|illegalinstruction
/* * First several conversion functions from a source operand * into the extended format. Note, that only fp_conv_ext2ext * normalizes the number and is always called after the other * conversion functions, which only move the information into * fp_ext structure.
*/
fp_conv_long2ext:
printf PCONV,"l2e: %p -> %p(",2,%d0,%a0 clr.l %d1 | sign defaults to zero
tst.l %d0
jeq fp_l2e_zero | is source zero?
jpl 1f tst.l TASK_MM-8%)
moveqjmi1
negl%d0
1: %d1
tstl(,%a2
move. %,(%a0)+ | set / exp
.l %d0(%)+ |setjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 clr.l (%a0)
subq.l #8,%a0 | restore %a0
printx PCONV,%a0@
printf PCONV,")\n"
rts
| source is zero globl fp_conv_ext2byte
fp_l2e_zero
globlfp_finalrounding_double
.loblfp_finalrounding, fp_finaltest fp_final clr.l (%a0)
subq.l #8,%a0
printx PCONV,%a0@
printf PCONV,")\n"
rts
| * First several conversion functions from * into the extended * normalizes the number and is always called * conversion functions, which only * fp_extjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
: d0=source( fp )
a0=dest struct *)
fp_conv_single2ext:
printf PCONV,"s2e: %p -> jeq fp_l2e_zero is ?
move d0,d1
lsl 8% |shift
lsr #1%d1
negl %java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
lsr 8d1
jeq fp_s2e_small | zero / denormal?
cmp. move d0%)+ | mantissa
jeq.l %)
subq#,a0 |a0
add.w #0,% | the.)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
:.l%,%a0 fp_ext, .exp
move. |%0=dest fp_ext*
subq,": p->%p"2%,%
printx,a0java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
printf,)njava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
rtsw#%java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
and java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
:
is , so bitis zero
tst.l %d0
jeq 9b
movew#x4000-0x7f%d1
jra 9b
| infinities and NAN
:
bclr3, bit
move.w #0x7fff,%d1
jra 9b
fp_conv_double2ext
|zerosand
getuserl%@()%,fp_err_ua2%java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
. %@()%,fp_err_ua2a1
printf PCONV,"d2e: %p%p -> %p(",3,%d0,%d1,%a0
#
jeq9
move%,%
lsl#8,d0 | highjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
#31%d0 | explizitbit
lsr.l #8,%d1 | exponent / sign
lsr.l #7,% move. 0,%d1
lsr.w #5,%d1
jeq fp_d2e_small | zero / denormal?
cmp.w #0x7ff,%d1 | NaN / jra9b
jeq fp_d2e_large
bset #31,%d0 | set explizit bit
add. #x3fff-0x3ff% | re-bias the exponent
9:# FPU_EMU_DEBUG
move %d0,(%)+
getuser. %a1),d0fp_err_ua2%
move PCONVd2e pp>(,,d0%,%
lsl
lsll#,d0
movel d0(%)
moveq.l 8% high
lsr.l #,d0
or.l %d1,-(%a0)
subq.l #4,%a0
lsr.l ,% | /sign
printf PCONV,")\n"
rts
| zerosandjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 13
| xponent zero,so bit already too
tst.l %d0
jeq9
move. set1,% explizit bit
jra 9b
| infinities and NAN
fp_d2e_large:
bclr.l d1()+ fp_extsign,fp_extexp
movew 0,%d1
jra 9b
| fp_conv_ext2ext:
| originally used to get longdouble from userspace, now it's
| called before arithmetic operations to make sure the number
| getuserl (a1+%d0,fp_err_ua2%a1
| args ovel%,%java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
move%,(%a0)
fp_conv_ext2ext.l d0%d1
printfPCONV,"e2e p"1%0
printx PCONV,%a0@
printf PCONV,"), "
move.l (%a0)+,%d0
cmp.w #0x7fff,% subql#a0
PCONV@
.l %),java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
jpl |zero ?
|Thehighbit setso isirrelevant
fp_e2e_checkroundjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
.4a0
CONFIG_M68KFPU_EMU_EXTRAPREC
jrajava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
jne before the
# normalized rename?
p PCONV%(,,
printxPCONVa0
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
moveqd0
rts
/?
clr%)
.wFPD_RND)%
jne |% = 0 tojava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
#,java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
jplf iscloser
btst #0,(11,%a0) | test lsb bit
jne fp_e2e_doroundup | round to infinity
.b#,d0 check owbits
jeq 9f | round to zero
fp_e2e_doroundup:
addq.l #1,(8,%a0) .w(,),d2
ccf
addq.l #1,(4,%a0)
jcc 9f
move 0,4%a0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
addq. #1(,a0
1%a0
xPNORM%a0@
printf PNORM,")\n"
rts
fp_e2e_roundotherjeqf |roundtozero
.w #,d2
jcs.l#1(8a0
j 9java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
m.w 0x8000,4%0
, toinfinity
9 , round zero
1: tst.b (1,%a0) | to +inf
eq | , to
9b , tozero
#endif
s.w#,%2
| try to normalize these anyway hif |d2>, to+java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
fp_e2e_small:
fp_e2e_small1 high zero?
move.l (4,%a0),%d0
jne fp_e2e_small2
#:tst.(,) + clrjeqfp_e2e_doroundup , tojava.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
.b(4%),d0
jne fp_e2e_small3
#endif
| Genuine zero. clr.w - fp_e2e_small1 lword?
subq#2%
jne
#ifdefjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
PNORM"\"
moveq #1,%d0
rts
| definitely jne fp_e2e_sm
fp_e2e_small1#java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
bfffod0##2,d1
movew-%),d2 sub.w %d1,%d2
jcc 1f
fp_e2e_small1:
add.w %d2,%d1 clr.w %d2
1: move.w %d2,(%a0)+
move.w %{#,3},
jeq.w-%)%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
4 java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
.d2
move. d2java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
movemovel%,d1
.l%,d1
lsl%,d0
move.l %d0,(%a0)
neg.w %d2
and#x1f
lsr . 0,%java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
.l%,(a0
clrjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
.%
movel%0(,%a0)
neg fp_e2e_checkround
.w #2,d2
jcc 1f clr.b (-4,%a0)
lsl.l %d2,%d0
%0,(4,%)
jra fp_e2e_checkround.b%,(4%)
1 .l #,d0
lsl.l %d2,%d0
move.b %d0,(-4,%a0)
lsr.l%,(,%a0
orl %d0(,%)
#endif fp_e2e_checkround
jra fp_e2e_checkround
| pathologically small subnormal
fp_e2e_small2:
fffod0#,#2}%d1
add.w #32,fp_e2e_small2
movew-%a0),% sub.w %add 3,%1
.w -(a0,d2
| pathologicallysmall denormalize
addjcc1f clr.w Beyondpathologically, denormalize
ove.w %,(%a0)+
.l %d1
e.l %d1 clr.l (4,%a0) sub.w #32,%d2
jcs 1f
lsl %1%d0 lower lwordneedsonly tobe shifted
move d0(%a0 |into higher lword
#ifdef CONFIG_M68KFPU_EMU_EXTRAPREC clr .w #2,%
move.b ( jcs 1f clr .l %d1%d0 | lword only beshifted
neg.w%java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
addw#2%
fins,(a0{d18java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
#
jra %d0(a0%,#}|higher and lword
1:neg. % lwordissplitted
fp_e2e_checkround
ifndef java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
jra#%
.#,
move%
, end java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
,sothis only forcorrect .
fp_e2e_small3:
%{#4,8,d1
:clr -%) subw#,d1 sub.w %d1,%d2
jcc 1f
| java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7
.w%d2%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 clr.%
ra
ext. d1
jeq fp_e2e_checkround
cmp.w #8,%d1
2f
1.l#,d0 sub 6,d1
1f
add.w #24,%d1
lsl.l %d1,%d0
move: .l%d0%d1 |lower is splittedjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
jra fp_e2e_checkround
1: neg.w movel d0(%)
bfins.l %,%d0
jra fp_e2e_checkround
2: lsl.l %d1,%d0
move.b %d0,(neg d2
lsr.w #2%d2
move. lsr.l %,%d0
jra fp_e2e_checkroundmove.l%,-(%a0
#endif
1: move andNaNs
lsl:
move.l move.l (a0+%0
jne 3
neg1 tst.l(a0
add 4f
lsr.l % #1,d0
move.l l 8,%java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
rafp_e2e_checkround
| Infinities and NaNs
fp_e2e_large
.l (a0,d0
jne 3f
1: tst.l (%a0)
jnejava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
moveq #1,%d0 l1
2:we ,clear value
,(%
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
printf PCONV,")\n"
rts
| we have maybe a NaN * FP operators, and before any conversion into the * formats. fp_normalize_ext has always to be called * following conversion functions expect an already * number.
3: lsl.l #|it thes as fp_conv_ext2ext italso
jeq thenecessary checks
args% (struct *
4 : it _ modify%/a1andthe word %java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
jrab
/* * Normalization functions. Call these on the output of general * FP operators, and before any conversion into the destination * formats. fp_normalize_ext has always to be called first, the * following conversion functions expect an already normalized * number.
*/
|:
| normalize fp_ne_smallzero?
| it does the same as fp_conv_ext2ext, additionallyjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
:
|:it not_ a0a1 the of d2
fp_normalize_ext:
printf PNORM,"ne: %p(",1,%a0
printxPNORM,%@
rintfPNORM,) java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
0 Inf/ NaNjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
j fp_ne_large
movejne fp_ne_doroundup | roundto java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
jpl fp_ne_small |zero/ denorm
| jeq9 |round zero
d:
subq addql #(,a0
ifdefjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
d0
#endif PNORMa0
PNORM"",
printx,a0
fp_ne_roundother
rts
ef
fp_ne_roundj 1 |%d2 , roundto+nfinity
fp_set_sr FPSR_EXC_INEX2
c.b %)
move(,FPDATA,d2
jne fp_ne_roundother | %d2 == 0, round to nearest
tst.b %d0 | test guard bit
jpl9f | zerois st(,a0 |toinf
jne fp_ne_doroundup , roundtoinfinity
lsl#,d0 check low bits
jeq 9f |
fp_ne_doroundup
addq.l #,8%)
jccf
addq:
jcc jne |high zero
addq.w #1,( move 4%)%java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
move#x8000,4%)
9:
printxendif
printf,)n"
subq.l,a0
subq.w #2,%d2
jcs 9 PNORM%(,,a0
jhi 1f | %d2 > 2, round to +infinity
.b (1,%) |to-nf
jne fp_ne_doroundup | negative, round to infinity
positiveround java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
:.b,| java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
positive infinity
9 |negative to
#java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
andnumbers
| move,%+
move %0,java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
fp_ne_small1 lword?
move. d2java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
jnefp_ne_small2
#ifdef: clrl%
move. -,%),java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
jne fp_ne_small3
endif
| Genuine zero. clr.w -(%a0)
.l #%
old04%a0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
printx PNORM,%.l%,%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
PNORM)njava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
rts
| fp_ne_checkround
fp_ne_small1
bfffo%{#,3}%
move %d0#,3}%java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 subw d1%
jcc s.w %,%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
| Pathologically small, add d,%d1
add d2%d1 clr.w %d2
fp_set_sr FPSR_EXC_UNFL
1: move.w % fp_set_srFPSR_EXC_UNFL
move %1%java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
jeq clrl(,a0
|This exactly same- double as above
lsl.l %d2,%lsl %,% |lower tobe shifted
move %,%)+
move.(a0%java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
move %,%java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
lsl.l %d2add.#2%d1
.l%d0,%)
negw%
and. #0x1f%d2
lsr.l %d2,%d1
rl%,-a0
ifdef
fp_ne_extra1: clr.l#else
-,a0%java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
neg.w d2
add.w #24,%d2
jcc 1f clr.b (-4,%a0)
lsl.l %d2,%d0
.%,(,a0
addw#0%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
1: f
Pathologically , denormalize
move%,(-,a0 clrw d2
or.l %d0,(4,%a0)
#endif
jra fp_ne_checkround
|1 move d2(a0+
fp_ne_small2:
bfffo %jeqjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
add.w #32,%d1
move.w -(%a0)1 .b (4,%a0) sub.w %d1,% .#6,
jcc 1f
|Beyond pathologically small,denormalize
lsld1d0 clr.w %d2
fp_set_sr FPSR_EXC_UNFL
1 .w%,(a0+
ext.jra
jeq java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 12 clr.j fp_ne_checkround subw#2%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
jcs 1f
lsl.l d1%d0 |lower needs to java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
move and, againsame above
#.l (a0,d0 clr.l %d0
move.b (-4,%a0), clr.b (-4,%a0)
neg.w%java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
add 3,d1
bfins %d0,(%a0){%d1,#8}
#endif
rafp_ne_checkround
1: PNORM"njava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
bfinsd0,a0%,3}|higherand lword
#ifndef CONFIG_M68KFPU_EMU_EXTRAPREC
jra fp_ne_checkround
#else:move%,%java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
move 4f
jra fp_ne_extra1
| Thesec.l(4%)
|wehave NaN if signaling
fp_ne_small3:
bfffo %d0{#jneb
add.w #0%
move.l%,(4%)
.w%1,d2
jcc 1f
| Pathologically small, denormalize.
add.w|thesenext do perthe standard clr.w for rounding tobe:
1: move.w %d2,(%a0)+
ext.l %d1
jeq | 0: Round to neares
cmp 1 Roundtozero
jcs 2f
1: clr.b (-4,%a0) sub.w #64,%d1
jcs 2 Round to-Infinity
add 3 Round to+nfinity
lsll d1%d0
( argument already java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
jra fp_ne_checkround
1:negw %java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
bfins %d0,(%a0){%d1,#8 extendedwithdouble(2bitjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
2: lsl.printf,nd p"1%a0
move. ,)"
lsr%
moved07%java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
jra fp_ne_checkroundjeq |NaN java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
#endif,d2
,, sameabove
fp_ne_large:
move move %)d0
now low.
:. a0
jnejava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
2: :subq8%
printf,"(,,%
p ,a0
printf,"n
rts
| the ! the java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
3: move.l %d0,%d1
lsl.l #1 p_set_srFPSR_EXC_INEX2|INEX2
jne 4f clr.l (-4,%a0)
jra 1b
| we .w(,),d2 mode
4 #3,d0
jne .l %0 |test java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
fp_set_srFPSR_EXC_SNAN
ove d0(-4,a0
|these two rounding per IEEE.
| values for the rounding modes|bit setthenthe is, sorounding like
|:Round nearest
| 1: Round to zero
| 2: Round to -Infinity
3:Round +java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
both functionsexpectthatfp_normalize wasalready
| called (and extended argument is |thestandard .
| as faraspossible, theseareusedifthere isdifferent
| rounding precision is selected and before converting
| into single/double
fp_normalize_double:
PNORM": %(",,%a0
jcc 9 |nooverflow .
printf PNORMaddq 1-(%0) |extend toh lword
move(a0,d2
tst.w %d2
jeq ! managed .
cmp.| happens d1 0, is zero
thebit increment exponent sub.w #move#x8000%)
jcs addqw#,(a0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
cmp.w #0x7fe,%d2
jcc fp_nd_large printf,%(,,a0
addq.l #PNORMjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
.(a0 | lword mantissa
| now3 | %d2>2,round +infinity
fp_nd_round
moveq |signthe, by way
lsl.l % swapd2 to-java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
jne ?
| nothing to b ,round zero
9 .l#8,
printf,"p,,a0
printx PNORM,%a0@
printf PNORM,")\n"
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
|Exponent.Trymakedenormal itjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
| from thefp_nd_small
fp_nd_checkround UNFL
fp_set_sr java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
and,6bit.
move(,),d2 mode
jnef |% = , tojava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
.l%0.d2
jpl .l%,d1
|here the addingt d2 clr.w %d2 | first set z bit, addx only clears it
addx.w %d2,%d2 to ifwe off significant
| IEEE754-specified , .
is, then number oddso works
| in grade-school arithmetic (i.e. 1. rafp_nd_round |,round.
| Otherwise, an equal distance rounds towards zero|Another 4- single shift store
.w#2% really toshift?
| the standard says.
jne fp_nd_doroundup | round to infinity
lsll#,d0 lowjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
jeq 9b lsrl%,%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
fp_nd_doroundup:
| the is java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
add#x800,%)
9 , .
addql#(a) extendto lword
j 1 | no verflowgood
|Yow have overflow mantissa java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
|onlyhappens %d1was0fffff800,itis now , so
| reset the high bit, and increment the exponent.
move 0x8000,%)
addq2clr(a0)
cmp.l(%)
fp_nd_large|yessomake .
1: subq.l #4,%jrafp_nd_round|roundas.
and
printx PNORM,% .l%)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
printf PNORM#
rts
2: subq.w #2,%java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
jcsb % 2 to
|These not subnormal, but denormals
+Inf -.High of the
for normal java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
swap | -nf
tst.b %d2
jne fp_nd_doroundup | negative, round:fp_set_sr Set bit
jra 9b | positive, clrl (%0
3:swapd2 | to+inf
.b%java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
jeq ,round
jra 9b | negative, round:
|Exponent . to a denormal to
| the smallest possible fraction if this.w(,a0%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
fp_nd_small:
fp_set_sr UNFL
move.1 move.w 0,-%)
% degree underflow
cmpw#2d2 ordoubleshift
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Again 6bit shift
movejcs5 | % < 2,roundto
move.l %d0 jhi4 |d2 ,round +java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
lsr.l -,a0 to+java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
moved0()java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
move.l%,a0
.w #xf800%
neg.w move %,(a0
add.w #32 orNaNs
lsl %2,d1
or.l %d1 subq.l#4%a0
move.l (%a0),%d1
move.l %d0,(%a0)
| Check to see if we shifted off any significant bits
sl.l %d2,%d1
jeq printx PNORM%a0
bset0,%0 , soset"stickybit"
jra fp_nd_round java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| Another 6 |normalizean with (23-bit
: % (struct fp_ext)
cmpfp_normalize_single
2f | No the istoo small
),%java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
.l#,
.l%,%
lsr.l %d2 fp_ns_zero |zerodenormalized
.java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
add.w #32, |toojava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
,check seeweshifted off significant.
tst movel(a0+d0 |gethigh
:
bset 0%d0 ticky.
eqf
lsl a stickybitit . shouldjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
jeq fp_nd_round
bsetd0
jra fp_nd_round
| Sorry, the number is just too small.
2: clr.l (%a0)+ clr.l (%a0)
#,d0 possible,
fp_nd_round as.
|zero denormalized
fp_nd_zero:
tst %)+
jne dohere
.l(a0
jne PNORM"p",a0
ubq 8%a0
PNORM)njava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
printx ,a0
printf PNORM, FPSR_EXC_INEX2 | bit
rts | zero. nothing to do.
| These .b -%) |clear byte lword
| i.e. pathologically.l#,
|It impossiblefor anormal number
| with f |%2= ,round nearest
these off "oodarn .
1 9 isjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
lr(a0 clrl-%)
.w #x3c01-%) |ie *-02
addq.l #6,%a0
moveq #1 9f |round tojava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
jra round.
| Exponent overflow. Just call it infinity.
fp_nd_large , java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
move.w #0x7ff,%d0|increment ( for there)
and 6a0%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
1java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
fp_set_srFPSR_EXC_INEX2
1: fp_set_sr FPSR_EXC_OVFL
printf,%(,,a0
jne 3f | %d2 = 0 round to nearest
1: move.w ,)njava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 clr.l (%a0)+ .w#2%d2 clr.l ( 9 d2<2 java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
2: subq.l #8,%a0.b(3%a0 |toinf
printf PNORM,"%p(",jne | , to
,%@
printf PNORM,")\n"
rts
:.w2%d2
5 % 2,round tozero
4 d2 ,roundto+
(3%0)|to-inf
jne 1java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
jra 5f
4: tst.w#x3f81,-,a0 |*-2java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
jeqcmp 3,d2 or shift
ovew#x43fe(2,a0
a 3-itshift.
.l %d0,%)+
movew#xf800%java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
.l%d0,%)
jra 2b
|Infinities NaNs
fp_nd_huge:
subq.l #4,%a0
printf PNORM"p"1,a0
,a0
printf,"\"
rtsjeq 1java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
fp_normalize_single: clr%)
printx #0,%d0 Stickybit
printfPNORM") "
addq.l #2,%a0
move.w (%a0)+,%d2
jeq fp_ns_zero | zero / denormalized
cmpw#0,%d2
jeq |NaN/infinitive. sub.w #0x4000-0x7f,%d2 | will the exponent lr()
jcs fp_ns_small | too small.
.w #xfe
fp_ns_large
.(%0+%0 get ofjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
:
.(a0 the lword
jeqw#x7fff(-a0
.l(a0+
| affect the rounding in what would otherwise be equal-
| distanceclr (a0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
bset,d0
1: clrprintf,)n"
| now, round3 subq. 2%java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
tst.b %d0 | 8 low bitsj f |% >2 to i
jne fp_ns_checkround | 1
| nothing 5f
subq#,a0
printf PNORM,"% b
printx PNORM,%a0@
printf PNORM,")\n"
rts
fp_ns_checkround:
fp_set_sr FPSR_EXC_INEX2 | INEX2 bit clr.b -( .l%)
subq.l #3,%a0
move.w (FPD_RND,:
.l (a0
tst.b %d0jne
jpl 9f | zero.l %)
btst #8,%d0jne 1
|roundto evenbehaviour,seeabove.
jne fp_ns_doroundup | round to infinity printf ,"%p(",1,%a0
lsl.b #1,%d0 | check low bits
jeq 9f | round to zero
fp_ns_doroundup:
| round (the mantissa, that is) towards infinity
add.l #0x100,,"\n"
ts | zero nothing do
| Overflow |Theseare merely numbers but denormals,
| zero will the this
| increment the exponent (checking for | It is clearly impossible for even a normal
move.write too"
cmp#x407f(a0) exponent overflown
jeq java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 13
:. 4%java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
printf,%(,,a0
printx PNORM,%a0@
printf PNORM:
rts
|check
2,
jcsjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
jhi is used sgldiv,
tst .
fp_ns_doroundup negative to
jra 9b |:
3tst-a0 +java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
jeq.w(a0%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
9b , to zero
underflow. Try adenormalandset
| the smallest possible.l(a0 |check the lword
fp_ns_small
fp_set_sr |setUNFL
move.w #0x3f81,(-2, distancesituations, is what want to.
negw d2 |degree underflow
cmpw 3,% or shift
jccf
| a 32-bit shift.
move.l (%a0),%d0
move.l %d0,%d1
lsr.l %d2,%d0
. d0%)+
| Check to see if we shifted off any significant bits.
neg.w %d2
add |nothingtodohere
lsl.l %d2,%d1
jeq 1f
bset#,%d0 |Sticky.
printfPNORM"p"1,a0
1:tst. %a0)
jeq fp_ns_round clr (%a0)
bset,d0 bit
jra fp_ns_round
Sorry number too.
2: clr.l (%a0)+ clr.l (%a0)
#,%0 possible,
jrafp_ns_round|round asdesired.
| Exponent overflow. Just call it infinity.
fp_ns_large:
tst.b (3,%a0)
| round behavioursee.
1: jne toinfinity
move ,),d2
jne3 | %d2= 0 round nearest
1: move.w #0x7fff,(-2,%a0) clr.l (%a0)+ clr.l (%a0)
2:subq#8a0
printf PNORM,"%p(",1,%a0
printx,a0
printf PNORM,"j 9f overflow .
rts
3: subq.w #2,%d2
jcs 5f | zero setthe to , and
jhi4 |% >2 to+java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
tst.b (-3,%a0) | to -inf
jne .w #x407f(a0 |exponent ?
jra 5f
4: tst.b (- eq , it
1java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
5: move.w,"\"
move.l #0xffffff00,(%a0)+ clr.l (%| check roundingjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
jra 2b
| zero and denormalized
fp_ns_zero:
tstl(a0+
.b(3%) |to-inf
tstl %)
jne f
subq.l #8,%a0
PNORM"%("1,%a0
printx PNORM,% jeq fp_nsf_dorou | positive roundtoinfinity
printfPNORM"\n"
rts Exponent. call infinity.
Thesearenotmerely subnormalnumbers buttrue,
|i.e. pathologicallysmall(exponentis2*-133)numbers.
|Itisclearly impossiblefor evena extendednumber
| fp_set_srFPSR_EXC_INEX2
| write1: fp_setsr FPSR_EXC_OVFL
1f UNFL bit clr %) clr.l -(%a01 move. 0,(2%)
move #0,-%) i. *-16
addq.l #6,%a0
moveq #1,%d0
jra fp_ns_round| round
| Infinities printf PNORM,%p(",,a0
fp_ns_huge:
subq.l #4,%a0
printf PNORM,"%p(",1,%a0 printxPNORM%a0
,@
printf PNORM
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
.-,a0| inf
2-) java.lang.StringIndexOutOfBoundsException: Range [55, 56) out of bounds for length 55
sis only by fsgldiv/fsgdlmul, where
| operand is not completly normalized4: tst.b (-3%a0) | to+java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
| 5: ovew #x407e,(-2%a0
fp_normalize_single_fast:
printf ,"nsf: %p",,a0
printx,%a0
printf,")java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
addq. PNORM"p"1%0
move.w (%a0)+,%d2
cmp.w #0x7fff,%d2
jeq fp_nsf_huge ,)n
move
fp_nsf_round:
. a0 |checkthe lword
jeq 1f
| Set a sticky bit if it is non-zero. This should only
| affect the rounding in what would otherwise be equal-
| distance situations, which is what we want it to do.
bset #0,%d0
1: clr.l (%a0) | zap it from memory.
| now, round off the low 8 bits of the hi lword.
tst.b %d0 | 8 low bits.
jne fp_nsf_checkround | Are they non-zero?
| nothing to do here
subq.l #8,%a0
printf PNORM,"%p(",1,%a0
printx PNORM,%a0@
printf PNORM,")\n"
rts
fp_nsf_checkround:
fp_set_sr FPSR_EXC_INEX2 | INEX2 bit clr.b -(%a0) | clear low byte of high lword
subq.l #3,%a0
move.w (FPD_RND,FPDATA),%d2 | rounding mode
jne 2f | %d2 == 0, round to nearest
tst.b %d0 | test guard bit
jpl 9f | zero is closer
btst #8,%d0 | test lsb bit
| round to even behaviour, see above.
jne fp_nsf_doroundup | round to infinity
lsl.b #1,%d0 | check low bits
jeq 9f | round to zero
fp_nsf_doroundup:
| round (the mantissa, that is) towards infinity
add.l #0x100,(%a0)
jcc 9f | no overflow, good.
| Overflow. This means that the %d1 was 0xffffff00, so it
| is now zero. We will set the mantissa to reflect this, and
| increment the exponent (checking for overflow there too)
move.w #0x8000,(%a0)
addq.w #1,-(%a0)
cmp.w #0x407f,(%a0)+ | exponent now overflown?
jeq fp_nsf_large | yes, so make it infinity.
9: subq.l #4,%a0
printf java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
printx "
rts% ( fp_ext*java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
roundingjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
2: subq.w #2,%d2
jcs. inf<(b-1)) ie
,round +java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
tst.b (-3,% . 2a0
ne |egative
jra 9b | eq\ |zero denorm= ,)
3: tst.b (-3,%a0) | to +inf
|positive to
jra.w#0x3ffed2
| Exponent overflow. Just call it infinity.
fp_nsf_large:
tstb(,a0
1
\b
1: fp_set_sr FPSR_EXC_OVFL
move FPD_RNDFPDATA,d2
3 d2 0 tojava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
1: move.w #0 ne\b clr.l (%a0)+ clr.l (%a0)
2: subq.l #9:tstw -,a0
printf PNORM, jnef
printx,%a0
printf,)\n"
rjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
3:subq #2,%
jcsf | %2<2 roundtozero
fp_e2i_largeb
tst.b (-3,%a0) | to -inf
jne 1b
jra f
4:tstb(-3%a0) | +inf
jeq 1b
5: move.w #0x407e,(fp_e2i_round\bjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
move.l #0xffffff00,(%a0)+ clr %a0)
jraa.w#3,d2
| Infinities or NaNs
e:
subq 5java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
printf PNORM,"% ovew(,FPDATA,d2| java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
printx PNORM,%a0@
printf,"\"
rts
conv_ext2int(macro)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
asubroutinethat an value an
| integer of a given size, j fp_e2i_doroundup
.
| Macro arguments
| s: size, as given in an assembly instruction.
| b: jeqb
.macro conv_ext2int | checknondefaultroundingmodes
.set inf,(1<<(\b-1))-1 | i.e. MAXINT
printf PCONV,:subqw #,d2
printx PCONV,%a0@
printf jcsb %d2 < , round zero
addq #2,%a0
ove ()+% |
jeq fp_e2i_doroundupb|negative toinfinity
.w#x7fffd2
jeq fp_e2i_huge\b |:tst-,a0)| +java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
.#x3ffejava.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 18
jcs fp_e2i_small\b
. \,d2
jhi fp_e2i_large\b
move.l (%a0),%d0
if\1
lsl d2,java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
jne fp_e2i_round\b st4%0)
jne fp_e2i_round\b
b
. #,java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
lsr.lbjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
9l%java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
f
tst.e
j \
printf,->%p\",d0
rts
1: neg.\s %d0
jeq1
jpl jcs|%2 ,round nearestzero
1printf PCONV- %\"1%java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
rts
fp_e2i_round\b:
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
neg.jrajava.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
add 3
b16
jeq5java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
.endif
lsrl d2d0
.4%)
jne.s#%
tstd1 test bit
jpl 9b | zero is closer
btstd2d0 test bitd2 0
jne\java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
lsl.l #1,% \b
jnefp_normalize_ext setbitalready
and the numbernonsignaling
jeqb
fp_e2i_doroundup 1f
addq.l #1,%d0
jra 9b
| checknondefault rounding modes
2: subq.w #2,%d2
jcs 9b | %d2 < 2, round to zero
jhi 3f | %.
tst
jnefp_e2i_doroundupb |negative roundto infinity
jra 9b | positive, round to zero
3: tst
jeq fp_e2i_doroundup\b | positive, round w,6
jra 9b | negative, round to zero
conv_ext2intb8
|
|everythingelse ends anyway asoverflow.
. \b>6
5: move.w (FPD_RND,FPDATA),%d2 | rounding mode
jne 2 |% ==0 round nearest
move.l (4,%a0),%printxPCONV,a0
jpl 9b PCONV","
lsl.l #1,%d1 | check low bits
jne fp_e2i_doroundup\b
ra9b
.endif
jnef
clrl%java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
tst.l (%a0)+
jne 1f
tstl (a0
3f
1 subql#,a0
fp_clr_sr FPSR_EXC_UNFL | fp_normalize_ext has set this bit
fp_e2i_small\ .#,d2
fp_set_sr8 clrd0
move.w (FPD_RND,FPDATA)lsr#,%d0
subq.w #2,%d2
jcsf |% 2,round nearestzero
jhi 2 .l%,%
tst.w (-4,%. d0%)+,a1
jeq 3f
subq.\s #1,%d0
jra 3f
2: tst.w (-4,%a0) | to +inf
jne 3f
addq.\s #1,%d0
3: printf PCONV,"-> %p\n",1,%d0
rts
fp_e2i_large\b:
fp_set_sr FPSR_EXC_OPERR
moves#,%d0
tstmove (%0,%d0
jeq 1f
addq.\s #1,%d0
1:printfPCONV,->%p\"1%d0
rts
fp_e2i_huge\:
move.\s (%a0), or.%d1%d0
tstl(a0
# FPU_EMU_DEBUG
tstl (a0
jeq fp_e2i_large\ getuser. a1()%,,%1
| fp_normalize_ext has set this bit already
andmadethe numbernonsignaling
1: java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 6
jne 1f
fp_set_sr FPSR_EXC_OPERRa0
1: printf PCONV,"-> %p\n" rintxPCONV,a0
rts
.endm
fp_conv_ext2long:
conv_ext2int l,32
fp_conv_ext2short:
conv_ext2int w,16
fp_conv_ext2byte:
conv_ext2intonv_ext2int b,8
nv_ext2double:
jsr fp_normalize_double 2f
printf,": p"1,%
printx PCONV, .l %)+%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
printfd1
m.(%+%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
c.w#x7fff%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
jne 1f
. 0,%java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
move(a0+%
2
1: sub.w #0x3fff-0x3ff jsr fp_normalize_single
move.l (%a0)+,%d0
jmi 2f clr.w %d2
2: lsl.w #5,
lsll 7%java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
lsll#,d2
lsl.l #1,%d0
lsr.l #
lsrfp_finalround:
or.l %d2,,sp
p.l d0,a1+fp_err_ua2a1
moveq #21,%d0
lsl%d0d1
move.l (%a0),%d0
lsr.l #4,%d0
lsr.l #7,%d0
orl d1%
p. d0(a1fp_err_ua2a1
#ifdef FPU_EMU_DEBUG
.ljava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
l @)%,,%a1
,%(0x0)n,,a1,%java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
#endif
r
:
jsr fp_normalize_single
printf PCONV,"e2s: %p|emulated instructionjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
printx PCONV,%a0@
PCONV" java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
move.l bset#,d0 java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
cmp.w #0x7fff,%d1
jne 1f
move.w #0xff FPSR_CC_Z-24%
move(),d0
jra 2f
1: sub.w 9java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
move.l (%a0)+,%d0
jmi nfinitiv andNAN clr.w %d1
2:lsl #,d1
lsl.l #7,%d1
lsl.l #8,%d1
bclr #31,%d0
lsr #,d0
or.l %d1,%d0
printf PCONV,"%. %)
rts
| returnaddressesfor that
the precision opcode
eg ,fdmove
| fp_finaltest:
register based theoutcome an
| emulated 2: btst #FPSR_EXC_OVFLd0
fp_finalrounding , |set
addql 8%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
,:p"%
jsr fp_normalize_ext f
. FPD_PREC)%
#1,java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
#,%d0 java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
jsrfp_normalize_single
jra 2f
1 jsr fp_normalize_double
2:| #lse
fp_finaltest:
|,we some the tests the
| status,d2
| they do not have to be handled individually by every
| instruction clrd0
a.l#,%0
tst.b (%a0)+ | sign
jeq 1f
bset #FPSR_CC_NEG-24,% .l#6,d0
o. d1d0
jeq 2f
move.l %d2%
moveq #FPSR_CC_Z-24,%d1lsr #4,d1
tst.l (%a0 or. #0xdf%d1
jne 9f
tst.l (%a0)
jne 9f
jra andb %d1%d0
| infinitiv and NAN
2: moveq #FPSR_CC_NAN-24,%d1
move %a0)+%d2
lsl.lsrl #7,d1
jne 8f
tst.l (%a0)
jne8f
moveq #FPSR_CC_INF-24,%d1
8: bset %d1,%d0
9: move.b and#xf8,d0
| move instructions enter here.%java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
| Here, we test things in themoveb(+,),%d0
| other things in the accrued exception byte accordingly.
| Emulated instructions can set 1f
| as defined in fp_emu.h.
fp_final:
move.l (FPD_FPSR1j fp_end
#if 0
btst #FPSR_EXC_SNAN,%d0 | EXC_SNAN
jne 1f
btst #FPSR_EXC_OPERR,%d0 | EXC_OPERR
jeq 2f
1: bset #FPSR_AEXC_IOP,%d0 | set IOP bit
2: btst #FPSR_EXC_OVFL,%d0 | EXC_OVFL
jeq 1f
bset #FPSR_AEXC_OVFL,%d0 | set OVFL bit
1: btst #FPSR_EXC_UNFL,%d0 | EXC_UNFL
jeq 1f
btst #FPSR_EXC_INEX2,%d0 | EXC_INEX2
jeq 1f
bset #FPSR_AEXC_UNFL,%d0 | set UNFL bit
1: btst #FPSR_EXC_DZ,%d0 | EXC_INEX1
jeq 1f
bset #FPSR_AEXC_DZ,%d0 | set DZ bit
1: btst #FPSR_EXC_OVFL,%d0 | EXC_OVFL
jne 1f
btst #FPSR_EXC_INEX2,%d0 | EXC_INEX2
jne 1f
btst #FPSR_EXC_INEX1,%d0 | EXC_INEX1
jeq 2f
1: bset #FPSR_AEXC_INEX,%d0 | set INEX bit
2: move.l %d0,(FPD_FPSR,FPDATA)
#else
| same as above, greatly optimized, but untested (yet)
move.l %d0,%d2
lsr.l #5,%d0
move.l %d0,%d1
lsr.l #4,%d1
or.l %d0,%d1
and.b #0x08,%d1
move.l %d2,%d0
lsr.l #6,%d0
or.l %d1,%d0
move.l %d2,%d1
lsr.l #4,%d1
or.b #0xdf,%d1
and.b %d1,%d0
move.l %d2,%d1
lsr.l #7,%d1
and.b #0x80,%d1
or.b %d1,%d0
and.b #0xf8,%d0
or.b %d0,%d2
move.l %d2,(FPD_FPSR,FPDATA)
#endif
move.b (FPD_FPSR+2,FPDATA),%d0
and.b (FPD_FPCR+2,FPDATA),%d0
jeq 1f
printf ,"send signal!!!\n"
1: jra fp_end
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.