1/*
2 * ====================================================
3 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software is freely granted, provided that this notice
7 * is preserved.
8 * ====================================================
9 */
10
11#include <picolibc.h>
12
13#if !defined(_SOFT_FLOAT)
14
15/*
16Fast version of frexp using Intel float instructions.
17
18   double _f_frexp (double x, int *exp);
19
20Function splits x into y * 2 ** z.  It then
21returns the value of y and updates *exp with z.
22There is no error checking or setting of errno.
23*/
24
25	#include "i386mach.h"
26
27	.global SYM (_f_frexp)
28       SOTYPE_FUNCTION(_f_frexp)
29
30SYM (_f_frexp):
31	pushl ebp
32	movl esp,ebp
33	fldl 8(ebp)
34	movl 16(ebp),eax
35
36	fxtract
37	fld1
38	fchs
39	fxch
40	fscale
41	fstp st1
42	fxch
43	fld1
44	faddp
45	fistpl 0(eax)
46
47	leave
48	ret
49
50#endif
51