summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-09-13 16:01:26 +0000
committertmm <tmm@FreeBSD.org>2002-09-13 16:01:26 +0000
commitc568640675e484a682bb821038c19634699d5e83 (patch)
tree771f7dff55a06cad63c2ff53fef60b7c76696904 /lib/libc
parent3103a45bbfcd593503595c5717f40de30d985210 (diff)
downloadFreeBSD-src-c568640675e484a682bb821038c19634699d5e83.zip
FreeBSD-src-c568640675e484a682bb821038c19634699d5e83.tar.gz
Add an implementation of fabs() (which is quite trivial).
When it is called directly, gcc is smart enough to generate inline code for it, which is why it wasn't noticed before that it was missing. fabs() would probably better fit into libm, but it has traditionally been in libc on FreeBSD, so there is probably software around that makes assumptions about this by now.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sparc64/gen/Makefile.inc2
-rw-r--r--lib/libc/sparc64/gen/fabs.S37
2 files changed, 38 insertions, 1 deletions
diff --git a/lib/libc/sparc64/gen/Makefile.inc b/lib/libc/sparc64/gen/Makefile.inc
index 8bedc5f..6cf991a 100644
--- a/lib/libc/sparc64/gen/Makefile.inc
+++ b/lib/libc/sparc64/gen/Makefile.inc
@@ -1,4 +1,4 @@
# $FreeBSD$
-SRCS+= _setjmp.S fixunsdfsi.S flt_rounds.c fpsetmask.c frexp.c \
+SRCS+= _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpsetmask.c frexp.c \
infinity.c isinf.c ldexp.c modf.S setjmp.S sigsetjmp.S
diff --git a/lib/libc/sparc64/gen/fabs.S b/lib/libc/sparc64/gen/fabs.S
new file mode 100644
index 0000000..f42e2c7
--- /dev/null
+++ b/lib/libc/sparc64/gen/fabs.S
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2002 by Thomas Moestl <tmm@FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * double fabs(double);
+ */
+ENTRY(fabs)
+ retl
+ fabsd %f0, %f0
+END(fabs)
OpenPOWER on IntegriCloud