summaryrefslogtreecommitdiffstats
path: root/lib/msun
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2005-01-15 03:32:28 +0000
committerdas <das@FreeBSD.org>2005-01-15 03:32:28 +0000
commit64168d93e53c607d7cae95e7c25c59c083baed50 (patch)
treed063ee7c9eac8af8afcc63271436a401ce277735 /lib/msun
parentc7466a47fff371436e5e36d5eb6e489e6a39aa3b (diff)
downloadFreeBSD-src-64168d93e53c607d7cae95e7c25c59c083baed50.zip
FreeBSD-src-64168d93e53c607d7cae95e7c25c59c083baed50.tar.gz
amd64 assembly versions of sqrt(), lrint(), and llrint() using SSE2.
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/Makefile2
-rw-r--r--lib/msun/amd64/e_sqrt.S33
-rw-r--r--lib/msun/amd64/s_llrint.S6
-rw-r--r--lib/msun/amd64/s_lrint.S36
4 files changed, 77 insertions, 0 deletions
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index d7d3e52..eec0f8a 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -48,6 +48,8 @@ ARCH_SRCS = s_copysign.S s_copysignf.S
# handling is broken (doesn't exist!) on the Alpha port.
# Stock gcc 2.7.2.1 doesn't understand these options.
#CFLAGS += -mtrap-precision=i -mfp-trap-mode=su
+.elif ${MACHINE_ARCH} == "amd64"
+ARCH_SRCS = e_sqrt.S s_lrint.S s_llrint.S
.elif ${MACHINE_ARCH} == "i386"
ARCH_SUBDIR= i387
ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \
diff --git a/lib/msun/amd64/e_sqrt.S b/lib/msun/amd64/e_sqrt.S
new file mode 100644
index 0000000..500c677
--- /dev/null
+++ b/lib/msun/amd64/e_sqrt.S
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2005 David Schultz <das@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 AND CONTRIBUTORS ``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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$")
+
+ENTRY(__ieee754_sqrt)
+ sqrtsd %xmm0, %xmm0
+ ret
+
diff --git a/lib/msun/amd64/s_llrint.S b/lib/msun/amd64/s_llrint.S
new file mode 100644
index 0000000..ab09846
--- /dev/null
+++ b/lib/msun/amd64/s_llrint.S
@@ -0,0 +1,6 @@
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$")
+
+/* sizeof(long) == sizeof(long long) */
+#define fn llrint
+#include "s_lrint.S"
diff --git a/lib/msun/amd64/s_lrint.S b/lib/msun/amd64/s_lrint.S
new file mode 100644
index 0000000..9059a38
--- /dev/null
+++ b/lib/msun/amd64/s_lrint.S
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2005 David Schultz <das@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 AND CONTRIBUTORS ``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.
+ */
+
+#include <machine/asm.h>
+
+#ifndef fn
+__FBSDID("$FreeBSD$")
+#define fn lrint
+#endif
+
+ENTRY(fn)
+ cvtsd2si %xmm0, %rax
+ ret
OpenPOWER on IntegriCloud