beautypg.com

Motorola DSP96002 User Manual

Page 682

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-163

and d7,d2 ; remove implied one bit

tst d2 ; check m0.high = zero

jne _nan0 ; jump if nan

tst d0 ; check m0.low = zero

jne _nan0 ; jump if nan

move #emsk,d7.l ; get exponent mask

move d1.h,d5.l ; get exp1

and d7,d5 ; delete tags

cmp d7,d5 ; check for max exp

jne _inf1 ; jump if a1 is not inf or NaN

;

; Check if Addend 1 is Infinity

;

_mant2 move #imsk,d7.l ; get infinity mask

and d7,d3 ; remove implied one bit

tst d3 ; check m1.high = zero

jne _nan1 ; jump if nan

tst d1 ; check m1.low = zero

jne _nan1 ; jump if nan

jclr #0,d6.l,_binf ; jump if a0 and a1 are inf

ori #$10,ccr ; set infinity bit

jmp _done ; a1 is infinity

;

; Check for Case: (+Inf) + (-Inf) = QNaN

;

_inf1 ftfr.x d0,d1 ; move result to d1

ori #$10,ccr ; set infinity bit

jmp _done ; a0 is infinity

_binf ftst d0 ; check sign of a0

jmi _minf ; jump if a0 is -inf

ftst d1 ; check sign of a1

jmi _inan ; (+inf) + (-inf) = QNaN

ori #$10,ccr ; set infinity bit

jmp _done ; a0 and a1 are +inf

_minf ftst d1 ; check sign of a1

jpl _inan ; (-inf) + (+inf) = QNaN

ori #$10,ccr ; set infinity bit

jmp _done ; a0 and a1 are -inf

;

; Check for NaN

;

_nan0 jclr #30,d0.m,_inan ; jump if a0 is a SNaN

move #emsk,d7.l ; get exponent mask

move d1.h,d5.l ; get exp1

and d7,d5 ; delete tags

cmp d7,d5 ; check for max exp

jne _qnan ; jump if a1 is not a NaN

move #imsk,d7.l ; get infinity mask

and d7,d3 ; remove implied one bit

tst d3 ; check mant1.high = zero

jne _nan1 ; jump if a1 is a NaN

tst d1 ; check mant1.low = zero

jeq _qnan ; jump if a1 is infinity

_nan1 jset #30,d1.m,_qnan ; jump if a1 is a QNaN