84
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
Figure 2.4 explains how to decipher information in the floating-point emulation
code word. The operator and size components of the code word should be
self-explanatory. Source and destination registers refer to the actual processor
data registers and the emulation floating-point registers that correspond to
locations on the stack frame (as explained above). If the destination operand is a
register, the operator, size, and source operand determine whether it references
a data register or a floating-point register.
The TI software emulation is patterned after the 68881/2 floating-point
coprocessor (see section
3.1.2 Prerequisite Reading
for a list of references if
more information is desired). The same rules and restrictions that apply to
68881/2 instruction operands apply to corresponding emulation instruction
operands. If one of the operands is specified by its absolute address, the 32-bit
address is pushed onto the stack immediately before the function call. If an
operand is specified to be an immediate
short
, immediate
long
, or frame offset,
the 16-bit or 32-bit immediate value or the 16-bit
a6
-relative frame displacement
is inserted into the instruction sequence immediately following the code word.
From the information in the code word, the called function adjusts its return
address to skip over the code word and the operand (if present).
1514131211109876543210
Operator Size Source Operand Dest. Operand
fcmp 0 byte 0 fp0 0 r0 (fp or d) 0
fadd 1 word 1 || ||
fdiv 2 long 2 fp7 7 r7 (fp or d) 7
fmul 3 single 3 d0 8 frame offset 8
fsub 4 double 4 || effective address 9
fintrz 5 extend 5 d7 15 return register 10
fmove 6 immed. long 16
fneg 7 immed. short 17
ftst 8 frame offset 18
fbcc 9 effective address 19
immed. zero 20
Figure 2.4: Floating-Point Emulation Code Word
The following example demonstrates the interface to the TI BCD floating-point
routines. Shown below is a sample C listing, followed by the code that is
generated after compilation.