Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/aarch64/gen Add the fpset* routines for tests



details:   https://anonhg.NetBSD.org/src/rev/031244482cd0
branches:  trunk
changeset: 339241:031244482cd0
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jul 07 21:40:19 2015 +0000

description:
Add the fpset* routines for tests

diffstat:

 lib/libc/arch/aarch64/gen/Makefile.inc  |   4 +-
 lib/libc/arch/aarch64/gen/fpsetmask.c   |  54 +++++++++++++++++++++++++++++++++
 lib/libc/arch/aarch64/gen/fpsetround.c  |  54 +++++++++++++++++++++++++++++++++
 lib/libc/arch/aarch64/gen/fpsetsticky.c |  54 +++++++++++++++++++++++++++++++++
 4 files changed, 165 insertions(+), 1 deletions(-)

diffs (192 lines):

diff -r 3473aadbdad2 -r 031244482cd0 lib/libc/arch/aarch64/gen/Makefile.inc
--- a/lib/libc/arch/aarch64/gen/Makefile.inc    Tue Jul 07 15:41:46 2015 +0000
+++ b/lib/libc/arch/aarch64/gen/Makefile.inc    Tue Jul 07 21:40:19 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:36 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2015/07/07 21:40:19 matt Exp $
 
 SRCS+= byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+= flt_rounds.c
@@ -6,6 +6,8 @@
 # Common ieee754 constants and functions
 SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_ieee754.c
 SRCS+= fpclassifyf_ieee754.c fpclassifyd_ieee754.c fpclassifyl_ieee754.c
+SRCS+= fpgetmask.c fpgetround.c fpgetsticky.c
+SRCS+= fpsetmask.c fpsetround.c fpsetsticky.c
 SRCS+= isfinitef_ieee754.c isfinited_ieee754.c isfinitel_ieee754.c
 SRCS+= isinff_ieee754.c isinfd_ieee754.c isinfl_ieee754.c
 SRCS+= isnanf_ieee754.c isnand_ieee754.c isnanl_ieee754.c
diff -r 3473aadbdad2 -r 031244482cd0 lib/libc/arch/aarch64/gen/fpsetmask.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/aarch64/gen/fpsetmask.c     Tue Jul 07 21:40:19 2015 +0000
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
+
+__RCSID("$NetBSD: fpsetmask.c,v 1.1 2015/07/07 21:40:19 matt Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bitops.h>
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#include <aarch64/armreg.h>
+
+__weak_alias(fpsetmask,_fpsetmask);
+
+fp_except_t
+fpsetmask(fp_except_t mask)
+{
+       const uint32_t old_fpcr = reg_fpcr_read();
+       const uint32_t new_fpcr = (old_fpcr & ~FPCR_ESUM)
+           | __SHIFTIN(mask, FPCR_ESUM);
+       reg_fpcr_write(new_fpcr);
+       return __SHIFTOUT(old_fpcr, FPCR_ESUM);
+}
diff -r 3473aadbdad2 -r 031244482cd0 lib/libc/arch/aarch64/gen/fpsetround.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/aarch64/gen/fpsetround.c    Tue Jul 07 21:40:19 2015 +0000
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
+
+__RCSID("$NetBSD: fpsetround.c,v 1.1 2015/07/07 21:40:19 matt Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bitops.h>
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#include <aarch64/armreg.h>
+
+__weak_alias(fpsetround,_fpsetround);
+
+fp_rnd_t
+fpsetround(fp_rnd_t rnd)
+{
+       const uint32_t old_fpcr = reg_fpcr_read();
+       const uint32_t new_fpcr = (~old_fpcr & ~FPCR_RMODE)
+           | __SHIFTIN(rnd, FPCR_RMODE);
+       reg_fpcr_write(new_fpcr);
+       return __SHIFTOUT(old_fpcr, FPCR_RMODE);
+}
diff -r 3473aadbdad2 -r 031244482cd0 lib/libc/arch/aarch64/gen/fpsetsticky.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/aarch64/gen/fpsetsticky.c   Tue Jul 07 21:40:19 2015 +0000
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
+
+__RCSID("$NetBSD: fpsetsticky.c,v 1.1 2015/07/07 21:40:19 matt Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bitops.h>
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#include <aarch64/armreg.h>
+
+__weak_alias(fpsetsticky,_fpsetsticky)
+
+fp_except_t
+fpsetsticky(fp_except_t sticky)
+{
+       const uint32_t old_fpsr = reg_fpsr_read();
+       const uint32_t new_fpsr = (old_fpsr & ~FPSR_CSUM)
+          | __SHIFTIN(sticky, FPSR_CSUM);
+       reg_fpsr_write(new_fpsr);
+       return __SHIFTOUT(old_fpsr, FPSR_CSUM);
+}



Home | Main Index | Thread Index | Old Index