_base_il.s revision 5a172a1e0f9068ec8db35fa123baecf7bd540eb5
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.
*/
/*
* These files are in assembly because some compilers will mistakenly reorder
* multiplications or divisions wrapped in _putsw() and _getsw(). They are
* proper subroutines for now, but should be considered candidates for
* inlining eventually.
*
* The original C sources are included for readability in the pre-function
* comment blocks.
*/
#include <SYS.h>
/*
* Multiplies two normal or subnormal doubles, returns result and exceptions.
*
double
__mul_set(double x, double y, int *pe) {
extern void _putsw(), _getsw();
int sw;
double z;
_putsw(0);
z = x * y;
_getsw(&sw);
if ((sw & 0x3f) == 0) {
*pe = 0;
} else {
*pe = 1;
}
return (z);
}
*/
/* Clear the floating point exception register. */
fnclex /* Equivalent of _putsw(0); */
/* Check to see if the multiply caused any exceptions. */
/*
* Divides two normal or subnormal doubles x/y, returns result and exceptions.
*
double
__div_set(double x, double y, int *pe) {
extern void _putsw(), _getsw();
int sw;
double z;
_putsw(0);
z = x / y;
_getsw(&sw);
if ((sw & 0x3f) == 0) {
*pe = 0;
} else {
*pe = 1;
}
return (z);
}
*/
/* Clear the floating point exception register. */
fnclex /* Equivalent of _putsw(0); */
/* Check to see if the divide caused any exceptions. */
/* double __dabs(double *d) - Get the abs. value of *d. Straightforward. */
fabs /* Just let the FPU do its thing. */