MC68060 Software Package
C-22
M68060 USER’S MANUAL
MOTOROLA
C.3.4 Module 5: Floating-Point Library (M68060FPLSP)
The M68060SP provides a library version of the unimplemented general monadic and
dyadic floating-point instructions shown in Table C-3. These routines are System V ABI
compliant as well as IEEE exception-reporting compliant. They are not, however, UNIX
exception-reporting compliant. This library implementation can be compiled with user appli-
cations desiring the functionality of these instructions without having to incur the overhead
of the floating-point unimplemented instruction” exception. The floating-point library contains
floating-point instructions that are implemented by the MC68060. The floating-point library
requires the partial floating-point kernel or full floating-point kernel to be ported to the system
for proper operation.
In addition, the FABS, FADD, FDIV, FINT, FINTRZ, FMUL, FNEG, FSQRT, and FSUB
functions are provided for the convenience of older compilers that make subroutine calls for
all floating-point instructions. The code does notemulate these instructions in integer, but
rather simply executes them.
All input variables must be pushed onto the stack prior to calling the supplied library rou-
tine. For each function, three entry points are provided, each accepting one of the three
possible input operand data types: single, double, and extended precision. For dyadic
operations both input operands are defined to have the same operand data type. For
instance, for a monadic instruction such as the FSIN instruction, the functions are:
_fsins(single-precision
input
operand),
_fsinx(extended-precision input operand). For dyadic operations such as the FDIV instruc-
tion, the entry points provided are: _fdivs(both single-precision input operands), _fdivd(both
double-precision input operands, _fdivx(both extended-precision input operands).
_fsind(double-precision
input
operand),
To properly call a monadic subroutine, the calling routine must push the input operand onto
the stack first. For instance:
* This example replaces the “fsin.x fp1,fp0” instruction
* Note that _fsinx is actually implemented as an offset from the
* top of the Floating-point Library Module.
fmove.x fp1,-(sp)
; push operand to stack
bsr
_fsinx
; result returned in fp0
add.w
#12,sp
; clean up stack
To properly call a dyadic subroutine, the calling routine must push the second operand
onto the stack before pushing the first operand onto the stack. For instance:
* This example replaces the “fdiv.x fp1,fp0” instruction
* Note that _fdivx is actually implemented as an offset from the
* top of the Floating-point Library Module.
fmove.x fp1,-(sp)
; push 2nd operand to stack
fmove.x fp0,-(sp)
; push 1st operand to stack
bsr
_fdivx
; result returned in fp0
add.w
#24,sp
; clean up stack
All routines return the operation result in the register fp0. It is the responsibility of the calling
routine to remove the input operands from the stack after the routine has been executed.
The result’s rounding precision and mode, as well as exception reporting, is dictated by the
value of the FPCR upon subroutine entry. The floating-point status register (FPSR) is set