TMS34010 
C 
Run-Time 
Environment 
5.4 
Floating 
Point 
Conventions 
5-6 
A floating 
point 
value is  represented  in  32 bits for single precision and  in 
64 
bits 
for 
double precision. All operations 
are 
done 
in double precision, 
so 
single 
precision 
(32-bit) 
values and integers are converted before any operations are 
perform~d. 
The 
following 
functionality is provided: 
•  Addition, subtraction, 
mul~iplication, 
division, negation, increment, dec-
rement 
•  Cl;>mparisons 
• 
Conversions 
Unsigned integer 
to 
double, double 
to 
unsigned integer 
Unsigned integer 
to 
float, float 
to 
unsigned integer 
Signed integer 
to 
double, double 
to 
signed integer 
Signed integer 
to 
float, float 
to 
signed integer 
Float 
to 
double, double 
to 
float 
• 
Error handling 
The TMS3401 0  floating 
point 
package 
is 
a custom-coded package that does 
not 
follow 
usual  C calling conventions. The calling conventions 
for 
routines 
work 
like a classic operand stack.  First, the codegen pushes the floating 
point 
argument(s) 
onto 
the argument stack, then generates a call 
to 
a floating 
point 
function.  The floating 
point 
function pops the arguments 
off 
the stack, per-
forms the operation 
and  pushes the result back 
onto 
the stack. The compiler 
has 
no 
knowledge 
of 
the interned format 
of 
the floating 
point 
numbers, and the 
only restriction 
is 
on  the size 
of 
the number. This allows you 
to 
customize a 
floating 
point 
package 
for 
your environment. 
Some 
floating 
point 
functions 
exp~ct 
integer arguments or return  integer val-
ues. 
For floating 
point 
functions, all  integers are  passed  and returned  in  reg-
ister A8. 
The 
following 
functional definitions apply 
to 
the floating 
point 
package and 
are 
used 
by 
the compiler.  More detailed  information about each  one 
of 
the 
functions can be found in  Appendix 
O. 
-FP-AOD. 
-FP-MINUS. 
-FP_DIV 
•. 
_FP_MUlT 
Each 
takes 
two 
doubles and returns a double result. 
-FP-NEGATE 
Returns the negated value 
of 
the operand passed. 
-FP-COMPARE 
Takes 
two 
floats and a comparison operator (in A8) and 
Note: 
returns 
an 
integer result 
of 
0 or 1 based on the compar-
ison; 
also sets the status .. 
The  compiler  assumes  that  the  status  register  is  also  appropriately  set 
upon return from the 
-FP-COMPARE 
function. 
-FP-DECR 
Takes  one double and returns 
two: 
the 
top 
of 
the stack 
is 
the 
original argument decremented 
by 
one; the second 
item on  the stack 
is 
the original argument (unchanged).