Module Name:    src
Committed By:   matt
Date:           Tue Jul  7 21:40:19 UTC 2015

Modified Files:
        src/lib/libc/arch/aarch64/gen: Makefile.inc
Added Files:
        src/lib/libc/arch/aarch64/gen: fpsetmask.c fpsetround.c fpsetsticky.c

Log Message:
Add the fpset* routines for tests


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/aarch64/gen/fpsetmask.c \
    src/lib/libc/arch/aarch64/gen/fpsetround.c \
    src/lib/libc/arch/aarch64/gen/fpsetsticky.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/aarch64/gen/Makefile.inc
diff -u src/lib/libc/arch/aarch64/gen/Makefile.inc:1.1 src/lib/libc/arch/aarch64/gen/Makefile.inc:1.2
--- src/lib/libc/arch/aarch64/gen/Makefile.inc:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/Makefile.inc	Tue Jul  7 21:40:19 2015
@@ -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 @@ SRCS+=	flt_rounds.c
 # 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

Added files:

Index: src/lib/libc/arch/aarch64/gen/fpsetmask.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpsetmask.c:1.1
--- /dev/null	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/fpsetmask.c	Tue Jul  7 21:40:19 2015
@@ -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);
+}
Index: src/lib/libc/arch/aarch64/gen/fpsetround.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpsetround.c:1.1
--- /dev/null	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/fpsetround.c	Tue Jul  7 21:40:19 2015
@@ -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);
+}
Index: src/lib/libc/arch/aarch64/gen/fpsetsticky.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpsetsticky.c:1.1
--- /dev/null	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/fpsetsticky.c	Tue Jul  7 21:40:19 2015
@@ -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);
+}

Reply via email to