136829Sbostic/* 2*61181Sbostic * Copyright (c) 1986, 1993 3*61181Sbostic * The Regents of the University of California. All rights reserved. 436829Sbostic * 536829Sbostic * This code is derived from software contributed to Berkeley by 636829Sbostic * Computer Consoles Inc. 736829Sbostic * 842637Sbostic * %sccs.include.redist.c% 936829Sbostic */ 1029509Ssam 1136829Sbostic#if defined(SYSLIBC_SCCS) && !defined(lint) 12*61181Sbostic .asciz "@(#)cvtdl.s 8.1 (Berkeley) 06/04/93" 1336829Sbostic#endif /* SYSLIBC_SCCS and not lint */ 1436829Sbostic 1529509Ssam#include <tahoemath/fp.h> 1629509Ssam#include "DEFS.h" 1729509Ssam 1829509SsamXENTRY(cvtdu, R2|R3|R4|R5) 1929509Ssam jbr 1f 2029509Ssam 2129509SsamXENTRY(cvtdl, R2|R3|R4|R5) 2229509Ssam # 2329509Ssam #Some initializations: 2429509Ssam # 2529509Ssam1: 2629509Ssam movl 4(fp),r0 # fetch operand. 2729509Ssam movl 8(fp),r1 2829509Ssam clrl r3 # r3 - negative flag. 2929509Ssam # 3029509Ssam #get exponent 3129509Ssam # 3229509Ssam andl3 $EXPMASK,r0,r2 # r2 will hold the exponent. 3329509Ssam jeql is_reserved # check for reserved operand. 3429509Ssam cmpl $ONE_EXP,r2 # if exponent is less then 1,return zero. 3529509Ssam jgtr retzero 3629509Ssam andl2 $0!EXPSIGN,r2 # turn off biased exponent sign 3729509Ssam shrl $EXPSHIFT,r2,r2 3829509Ssam # 3929509Ssam #get fraction 4029509Ssam # 4129509Ssam bbc $31,r0,positive # if negative remember it. 4229509Ssam incl r3 4329509Ssampositive: 4429509Ssam # clear the non fraction parts. 4529509Ssam andl2 $(0!(EXPMASK | SIGNBIT)),r0 4629509Ssam # add the hidden bit. 4729509Ssam orl2 $(0!CLEARHID),r0 4829509Ssam subl2 $24,r2 # compute the shift. 4929509Ssam jgtr shift_left 5029509Ssam mnegl r2,r2 5129509Ssam shrl r2,r0,r0 # shift right. 5229509Ssam jmp shifted 5329509Ssamshift_left: 5429509Ssam cmpl r2,$7 5529509Ssam jgtr overflow 5629509Ssamgo_on: shlq r2,r0,r0 # shift right. 5729509Ssamshifted: 5829509Ssam bbc $0,r3,done # check for negative 5929509Ssam mnegl r0,r0 6029509Ssamdone: 6129509Ssam ret 6229509Ssam 6329509Ssamretzero: 6429509Ssam clrl r0 6529509Ssam ret 6629509Ssamoverflow: 6729509Ssam callf $4,fpover 6829509Ssam jmp go_on 6929509Ssam 7029509Ssamis_reserved: 7129509Ssam bbc $31,r0,retzero 7229509Ssam 7329509Ssam callf $4,fpresop 7429509Ssam ret 75