/* Kcvtld.s 1.2 86/01/03 */
ENTRY(Kcvtld, R5|R4|R3|R2)
clrl r4 # r4 - negative flag.
movl 12(fp),r0 # fetch operand.
movl r0,r5 # need another copy.
jeql retzero # return zero.
jvs retmin # return minimum integer.
incl r4 # remember it was negative.
movl r0,r5 # remember the negated value.
jneq positive # look for more set bits.
#we have the exponent in r2.
movl r5,r0 # r0,r1 will hold the resulting f.p. number.
#Shift the fraction part to its proper place:
jlss shiftr # if less then zero we have to shift right.
shll r3,r0,r0 # else we shift left.
andl2 $CLEARHID,r0 # clear the hidden bit.
shal $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
orl2 $EXPSIGN,r2 # set the exponent sign bit(to bias it).
orl2 r2,r0 # combine exponent & fraction.
bbc $0,r4,sign_ok # do we have to set the sign bit?
orl2 $SIGNBIT,r0 # yes...