summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/gen/ldexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386/gen/ldexp.c')
-rw-r--r--lib/libc/i386/gen/ldexp.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/libc/i386/gen/ldexp.c b/lib/libc/i386/gen/ldexp.c
index 7046c4e..8b63f52 100644
--- a/lib/libc/i386/gen/ldexp.c
+++ b/lib/libc/i386/gen/ldexp.c
@@ -32,11 +32,13 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $Id$
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+#if defined(LIBC_RCS) && !defined(lint)
+static const char rcsid[] = "$Id$";
+#endif /* LIBC_RCS and not lint */
/*
* ldexp(value, exp): return value * (2 ** exp).
@@ -55,8 +57,18 @@ ldexp (double value, int exp)
{
double temp, texp, temp2;
texp = exp;
+#ifdef __GNUC__
+#if __GNUC__ >= 2
+ asm ("fscale "
+ : "=u" (temp2), "=t" (temp)
+ : "0" (texp), "1" (value));
+#else
asm ("fscale ; fxch %%st(1) ; fstp%L1 %1 "
: "=f" (temp), "=0" (temp2)
: "0" (texp), "f" (value));
+#endif
+#else
+error unknown asm
+#endif
return (temp);
}
OpenPOWER on IntegriCloud