2010-03-03 15:27:30 +01:00
|
|
|
/* fpu_compare() - compare doubles Author: Erik van der Kouwe */
|
|
|
|
/* fpu_sw_get() - get FPU status 17 Dec 2009 */
|
|
|
|
/* fpu_xam() - examine double */
|
2010-08-17 18:44:07 +02:00
|
|
|
#include <machine/asm.h>
|
2010-03-03 15:27:30 +01:00
|
|
|
|
|
|
|
/* u16_t fpu_compare(double x, double y) */
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(fpu_compare)
|
2010-03-03 15:27:30 +01:00
|
|
|
/* move the values onto the floating point stack */
|
|
|
|
fldl 12(%esp)
|
|
|
|
fldl 4(%esp)
|
|
|
|
|
|
|
|
/* compare values and return status word */
|
|
|
|
fcompp
|
2010-08-17 18:44:07 +02:00
|
|
|
jmp _C_LABEL(fpu_sw_get)
|
2010-03-03 15:27:30 +01:00
|
|
|
|
|
|
|
/* u16_t fpu_sw_get(void) */
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(fpu_sw_get)
|
2010-03-03 15:27:30 +01:00
|
|
|
/* clear unused high-order word and get status word */
|
|
|
|
xor %eax, %eax
|
|
|
|
.byte 0xdf, 0xe0 /* fnstsw ax */
|
|
|
|
ret
|
|
|
|
|
|
|
|
/* u16_t fpu_xam(double value) */
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(fpu_xam)
|
2010-03-03 15:27:30 +01:00
|
|
|
/* move the value onto the floating point stack */
|
|
|
|
fldl 4(%esp)
|
|
|
|
|
|
|
|
/* examine value and get status word */
|
|
|
|
fxam
|
2010-08-17 18:44:07 +02:00
|
|
|
call _C_LABEL(fpu_sw_get)
|
2010-03-03 15:27:30 +01:00
|
|
|
|
|
|
|
/* pop the value */
|
|
|
|
fstp %st
|
|
|
|
ret
|