/* This C language subroutine provides support for the float and extended float types of the langauge. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 10/10/90 float ___fdiv(float N, float D); float ___ldtof(long double x); float ___dtof(double x); float ___utof(unsigned int x); float ___ultof(unsiged long int x); MMH added GCC support: ___divsf3 ___truncdfsf2 ___floatunssisf2 */ #include "lib_glob.h" #include "flt_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___fdiv; .GLOBAL ___ldtof, ___dtof; .GLOBAL ___utof, ___ultof; .GLOBAL ___divsf3,___truncdfsf2,___floatunssisf2; ___truncdfsf2: ___ldtof: ___dtof: put(R3); reads(R4,1); reads(R8,2); CALL (PC, ___lib_dtof) (DB); R0=PASS R4; R1=PASS R8, FETCH_RETURN get(R3,1); RETURN (DB); RESTORE_STACK RESTORE_FRAME ___divsf3: ___fdiv: put(R7); put(R11); R7=PASS R4, R2 = MODE1; BIT CLR MODE1 65536; /* set to 40-bit mode */ CALL (PC, ___float_divide) (DB); R12=PASS R8, FETCH_RETURN F11=2.0; restore_state: F0=RND F7, MODE1 = R2; get(R11,1); get(R7,2); RETURN (DB); RESTORE_STACK RESTORE_FRAME ___floatunssisf2: ___ultof: ___utof: F0=FLOAT R4, R2=dm_1; /*Try a regular float*/ FETCH_RETURN IF LE R4=LSHIFT R4 BY -1; /*If negative downshift by 1*/ IF LE F0=FLOAT R4 BY R2; /*Then float with exp+1*/ RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;