tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Assorted pile of poorly thought out RISC-V diffs
- 128bit long double, now a thing.
- lots of copy pasting from sparc64. the long double nan definition
might be wrong.
- tail something@, now tail something@plt.
- we're a 64bit arch, so have definitions matching 64bit.
- something is wrong with the configuration. to make a shared library, I
need to link with -Bshareable, and -shared isn't enough.
llvm-objdump errors with:
llvm-objdump: 'sysarch.pico': can't find target: : error: unable to get target for 'riscv64--', see --version and --triple.
So perhaps that is a problem. who knows.
I get a lot of,
libc_pic.a(__select50.pico): in function `__select50': (.text+0x8): relocation truncated to fit: R_RISCV_JAL against symbol `__cerror' defined in .text section in libc_pic.a(cerror.pico)
Still looking into the right way to write it.
Index: lib/libc/arch/riscv/gdtoa/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/riscv/gdtoa/Makefile.inc,v
retrieving revision 1.1
diff -u -r1.1 Makefile.inc
--- lib/libc/arch/riscv/gdtoa/Makefile.inc 19 Sep 2014 17:36:25 -0000 1.1
+++ lib/libc/arch/riscv/gdtoa/Makefile.inc 13 Apr 2019 11:30:47 -0000
@@ -1,3 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1 2014/09/19 17:36:25 matt Exp $
-SRCS+= strtof.c
+SRCS+= strtof.c strtold_pQ.c
+SRCS+= strtopQ.c
Index: lib/libc/arch/riscv/gdtoa/gd_qnan.h
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/riscv/gdtoa/gd_qnan.h,v
retrieving revision 1.1
diff -u -r1.1 gd_qnan.h
--- lib/libc/arch/riscv/gdtoa/gd_qnan.h 19 Sep 2014 17:36:25 -0000 1.1
+++ lib/libc/arch/riscv/gdtoa/gd_qnan.h 13 Apr 2019 11:30:47 -0000
@@ -1,5 +1,9 @@
-/* $NetBSD: gd_qnan.h,v 1.1 2014/09/19 17:36:25 matt Exp $ */
+/* $NetBSD: gd_qnan.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */
-#define f_QNAN 0x7fe00000
-#define d_QNAN0 0x0
-#define d_QNAN1 0x7ffc0000
+#define f_QNAN 0x7fc00000
+#define d_QNAN0 0x7ff80000
+#define d_QNAN1 0x0
+#define ld_QNAN0 0x7fff8000
+#define ld_QNAN1 0x0
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x0
Index: lib/libc/arch/riscv/gen/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/riscv/gen/Makefile.inc,v
retrieving revision 1.1
diff -u -r1.1 Makefile.inc
--- lib/libc/arch/riscv/gen/Makefile.inc 19 Sep 2014 17:36:25 -0000 1.1
+++ lib/libc/arch/riscv/gen/Makefile.inc 13 Apr 2019 11:30:47 -0000
@@ -6,7 +6,7 @@
SRCS+= _lwp.c makecontext.c resumecontext.c swapcontext.S
# Common ieee754 constants and functions
-SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c
+SRCS+= infinityf_ieee754.c infinity_ieee754.c
SRCS+= fpclassifyf_ieee754.c fpclassifyd_ieee754.c
SRCS+= isinff_ieee754.c isinfd_ieee754.c
SRCS+= isnanf_ieee754.c isnand_ieee754.c
@@ -14,7 +14,8 @@
SRCS+= signbitf_ieee754.c signbitd_ieee754.c
SRCS+= fabs_ieee754.c
-SRCS+= nanf.c
+SRCS+= nanf.c infinityl.c
+SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c signbitl.c
.if (${MKSOFTFLOAT} == "no")
SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c
Index: lib/libc/arch/riscv/gen/fpclassifyl.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/fpclassifyl.c
diff -N lib/libc/arch/riscv/gen/fpclassifyl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/fpclassifyl.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,64 @@
+/* $NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+/*
+ * 7.12.3.1 fpclassify - classify real floating type
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__fpclassifyl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ if (u.extu_ext.ext_exp == 0) {
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
+ return FP_ZERO;
+ else
+ return FP_SUBNORMAL;
+ } else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
+ return FP_INFINITE;
+ else
+ return FP_NAN;
+ }
+
+ return FP_NORMAL;
+}
Index: lib/libc/arch/riscv/gen/infinityl.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/infinityl.c
diff -N lib/libc/arch/riscv/gen/infinityl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/infinityl.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,15 @@
+/* $NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:27 lukem Exp $ */
+
+/*
+ * IEEE-compatible infinityl.c for little-endian 128-bit format -- public domain.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:27 lukem Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <math.h>
+
+const union __long_double_u __infinityl =
+ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7f, 0xff } };
Index: lib/libc/arch/riscv/gen/isfinitel.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/isfinitel.c
diff -N lib/libc/arch/riscv/gen/isfinitel.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/isfinitel.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,55 @@
+/* $NetBSD: isfinitel.c,v 1.2 2008/04/28 20:22:57 martin Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: isfinitel.c,v 1.2 2008/04/28 20:22:57 martin Exp $");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+/*
+ * 7.12.3.2 isfinite - determine whether an argument has finite value
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isfinitel(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ if (u.extu_ext.ext_exp == EXT_EXP_INFNAN)
+ return 0;
+
+ return 1;
+}
Index: lib/libc/arch/riscv/gen/isinfl.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/isinfl.c
diff -N lib/libc/arch/riscv/gen/isinfl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/isinfl.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,63 @@
+/* $NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <machine/ieee.h>
+#include <math.h>
+
+/*
+ * 7.12.3.3 isinf - test for infinity
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isinfl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
+ (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0));
+}
Index: lib/libc/arch/riscv/gen/isnanl.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/isnanl.c
diff -N lib/libc/arch/riscv/gen/isnanl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/isnanl.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,63 @@
+/* $NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <machine/ieee.h>
+#include <math.h>
+
+/*
+ * 7.12.3.4 isnan - test for a NaN
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isnanl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
+ (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_fracl != 0));
+}
Index: lib/libc/arch/riscv/gen/signbitl.c
===================================================================
RCS file: lib/libc/arch/riscv/gen/signbitl.c
diff -N lib/libc/arch/riscv/gen/signbitl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libc/arch/riscv/gen/signbitl.c 13 Apr 2019 11:30:47 -0000
@@ -0,0 +1,52 @@
+/* $NetBSD: signbitl.c,v 1.2 2008/04/28 20:22:57 martin Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+/*
+ * 7.12.3.6 signbit - determine whether the sign of an argument is negative
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__signbitl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return (u.extu_ext.ext_sign == 1);
+}
Index: sys/arch/riscv/include/asm.h
===================================================================
RCS file: /cvsroot/src/sys/arch/riscv/include/asm.h,v
retrieving revision 1.2
diff -u -r1.2 asm.h
--- sys/arch/riscv/include/asm.h 27 Mar 2015 06:57:21 -0000 1.2
+++ sys/arch/riscv/include/asm.h 13 Apr 2019 11:31:03 -0000
@@ -58,7 +58,7 @@
#endif
#ifdef __PIC__
-#define PLT(x) x##@
+#define PLT(x) x##@plt
#else
#define PLT(x) x
#endif
Index: sys/arch/riscv/include/ieee.h
===================================================================
RCS file: /cvsroot/src/sys/arch/riscv/include/ieee.h,v
retrieving revision 1.1
diff -u -r1.1 ieee.h
--- sys/arch/riscv/include/ieee.h 19 Sep 2014 17:36:26 -0000 1.1
+++ sys/arch/riscv/include/ieee.h 13 Apr 2019 11:31:03 -0000
@@ -1,3 +1,4 @@
/* $NetBSD: ieee.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
+#include <riscv/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
#include <sys/ieee754.h>
Index: sys/arch/riscv/include/int_fmtio.h
===================================================================
RCS file: /cvsroot/src/sys/arch/riscv/include/int_fmtio.h,v
retrieving revision 1.1
diff -u -r1.1 int_fmtio.h
--- sys/arch/riscv/include/int_fmtio.h 19 Sep 2014 17:36:26 -0000 1.1
+++ sys/arch/riscv/include/int_fmtio.h 13 Apr 2019 11:31:03 -0000
@@ -43,31 +43,57 @@
#define PRId8 "hhd" /* int8_t */
#define PRId16 "hd" /* int16_t */
#define PRId32 "d" /* int32_t */
+#ifdef _LP64
+#define PRId64 "ld" /* int64_t */
+#else
#define PRId64 "lld" /* int64_t */
+#endif
#define PRIdLEAST8 "hhd" /* int_least8_t */
#define PRIdLEAST16 "hd" /* int_least16_t */
#define PRIdLEAST32 "d" /* int_least32_t */
+#ifdef _LP64
+#define PRIdLEAST64 "ld" /* int_least64_t */
+#else
#define PRIdLEAST64 "lld" /* int_least64_t */
+#endif
#define PRIdFAST8 "hhd" /* int_fast8_t */
#define PRIdFAST16 "hd" /* int_fast16_t */
#define PRIdFAST32 "d" /* int_fast32_t */
+#ifdef _LP64
+#define PRIdFAST64 "ld" /* int_fast64_t */
+#define PRIdMAX "ld" /* intmax_t */
+#else
#define PRIdFAST64 "lld" /* int_fast64_t */
#define PRIdMAX "lld" /* intmax_t */
+#endif
#define PRIdPTR "ld" /* intptr_t */
#define PRIi8 "hhi" /* int8_t */
#define PRIi16 "hi" /* int16_t */
#define PRIi32 "i" /* int32_t */
+#ifdef _LP64
+#define PRIi64 "li" /* int64_t */
+#else
#define PRIi64 "lli" /* int64_t */
+#endif
#define PRIiLEAST8 "hhi" /* int_least8_t */
#define PRIiLEAST16 "hi" /* int_least16_t */
#define PRIiLEAST32 "i" /* int_least32_t */
+#ifdef _LP64
+#define PRIiLEAST64 "li" /* int_least64_t */
+#else
#define PRIiLEAST64 "lli" /* int_least64_t */
+#endif
#define PRIiFAST8 "hhi" /* int_fast8_t */
#define PRIiFAST16 "hi" /* int_fast16_t */
#define PRIiFAST32 "i" /* int_fast32_t */
+#ifdef _LP64
+#define PRIiFAST64 "li" /* int_fast64_t */
+#define PRIiMAX "li" /* intmax_t */
+#else
#define PRIiFAST64 "lli" /* int_fast64_t */
#define PRIiMAX "lli" /* intmax_t */
+#endif
#define PRIiPTR "li" /* intptr_t */
/* fprintf macros for unsigned integers */
@@ -79,57 +105,105 @@
#define PRIoLEAST8 "o" /* uint_least8_t */
#define PRIoLEAST16 "hho" /* uint_least16_t */
#define PRIoLEAST32 "ho" /* uint_least32_t */
+#ifdef _LP64
+#define PRIoLEAST64 "lo" /* uint_least64_t */
+#else
#define PRIoLEAST64 "llo" /* uint_least64_t */
+#endif
#define PRIoFAST8 "hho" /* uint_fast8_t */
#define PRIoFAST16 "ho" /* uint_fast16_t */
#define PRIoFAST32 "o" /* uint_fast32_t */
+#ifdef _LP64
+#define PRIoFAST64 "lo" /* uint_fast64_t */
+#define PRIoMAX "lo" /* uintmax_t */
+#else
#define PRIoFAST64 "llo" /* uint_fast64_t */
#define PRIoMAX "llo" /* uintmax_t */
+#endif
#define PRIoPTR "lo" /* uintptr_t */
#define PRIu8 "hhu" /* uint8_t */
#define PRIu16 "hu" /* uint16_t */
#define PRIu32 "u" /* uint32_t */
+#ifdef _LP64
+#define PRIu64 "lu" /* uint64_t */
+#else
#define PRIu64 "llu" /* uint64_t */
+#endif
#define PRIuLEAST8 "hhu" /* uint_least8_t */
#define PRIuLEAST16 "hu" /* uint_least16_t */
#define PRIuLEAST32 "u" /* uint_least32_t */
+#ifdef _LP64
+#define PRIuLEAST64 "lu" /* uint_least64_t */
+#else
#define PRIuLEAST64 "llu" /* uint_least64_t */
+#endif
#define PRIuFAST8 "hhu" /* uint_fast8_t */
#define PRIuFAST16 "hu" /* uint_fast16_t */
#define PRIuFAST32 "u" /* uint_fast32_t */
+#ifdef _LP64
+#define PRIuFAST64 "lu" /* uint_fast64_t */
+#define PRIuMAX "lu" /* uintmax_t */
+#else
#define PRIuFAST64 "llu" /* uint_fast64_t */
#define PRIuMAX "llu" /* uintmax_t */
+#endif
#define PRIuPTR "lu" /* uintptr_t */
#define PRIx8 "hhx" /* uint8_t */
#define PRIx16 "hx" /* uint16_t */
#define PRIx32 "x" /* uint32_t */
+#ifdef _LP64
+#define PRIx64 "lx" /* uint64_t */
+#else
#define PRIx64 "llx" /* uint64_t */
+#endif
#define PRIxLEAST8 "x" /* uint_least8_t */
#define PRIxLEAST16 "x" /* uint_least16_t */
#define PRIxLEAST32 "x" /* uint_least32_t */
+#ifdef _LP64
+#define PRIxLEAST64 "lx" /* uint_least64_t */
+#else
#define PRIxLEAST64 "llx" /* uint_least64_t */
+#endif
#define PRIxFAST8 "x" /* uint_fast8_t */
#define PRIxFAST16 "x" /* uint_fast16_t */
#define PRIxFAST32 "x" /* uint_fast32_t */
+#ifdef _LP64
+#define PRIxFAST64 "lx" /* uint_fast64_t */
+#define PRIxMAX "lx" /* uintmax_t */
+#else
#define PRIxFAST64 "llx" /* uint_fast64_t */
#define PRIxMAX "llx" /* uintmax_t */
+#endif
#define PRIxPTR "lx" /* uintptr_t */
#define PRIX8 "hhX" /* uint8_t */
#define PRIX16 "hX" /* uint16_t */
#define PRIX32 "X" /* uint32_t */
+#ifdef _LP64
+#define PRIX64 "lX" /* uint64_t */
+#else
#define PRIX64 "llX" /* uint64_t */
+#endif
#define PRIXLEAST8 "X" /* uint_least8_t */
#define PRIXLEAST16 "X" /* uint_least16_t */
#define PRIXLEAST32 "X" /* uint_least32_t */
+#ifdef _LP64
+#define PRIXLEAST64 "lX" /* uint_least64_t */
+#else
#define PRIXLEAST64 "llX" /* uint_least64_t */
+#endif
#define PRIXFAST8 "X" /* uint_fast8_t */
#define PRIXFAST16 "X" /* uint_fast16_t */
#define PRIXFAST32 "X" /* uint_fast32_t */
+#ifdef _LP64
+#define PRIXFAST64 "lX" /* uint_fast64_t */
+#define PRIXMAX "lX" /* uintmax_t */
+#else
#define PRIXFAST64 "llX" /* uint_fast64_t */
#define PRIXMAX "llX" /* uintmax_t */
+#endif
#define PRIXPTR "lX" /* uintptr_t */
/* fscanf macros for signed integers */
@@ -137,31 +211,57 @@
#define SCNd8 "hhd" /* int8_t */
#define SCNd16 "hd" /* int16_t */
#define SCNd32 "d" /* int32_t */
+#ifdef _LP64
+#define SCNd64 "ld" /* int64_t */
+#else
#define SCNd64 "lld" /* int64_t */
+#endif
#define SCNdLEAST8 "hhd" /* int_least8_t */
#define SCNdLEAST16 "hd" /* int_least16_t */
#define SCNdLEAST32 "d" /* int_least32_t */
+#ifdef _LP64
+#define SCNdLEAST64 "ld" /* int_least64_t */
+#else
#define SCNdLEAST64 "lld" /* int_least64_t */
+#endif
#define SCNdFAST8 "hhd" /* int_fast8_t */
#define SCNdFAST16 "hd" /* int_fast16_t */
#define SCNdFAST32 "d" /* int_fast32_t */
+#ifdef _LP64
+#define SCNdFAST64 "ld" /* int_fast64_t */
+#define SCNdMAX "ld" /* intmax_t */
+#else
#define SCNdFAST64 "lld" /* int_fast64_t */
#define SCNdMAX "lld" /* intmax_t */
+#endif
#define SCNdPTR "ld" /* intptr_t */
#define SCNi8 "hhi" /* int8_t */
#define SCNi16 "hi" /* int16_t */
#define SCNi32 "i" /* int32_t */
+#ifdef _LP64
+#define SCNi64 "li" /* int64_t */
+#else
#define SCNi64 "lli" /* int64_t */
+#endif
#define SCNiLEAST8 "hhi" /* int_least8_t */
#define SCNiLEAST16 "hi" /* int_least16_t */
#define SCNiLEAST32 "i" /* int_least32_t */
+#ifdef _LP64
+#define SCNiLEAST64 "li" /* int_least64_t */
+#else
#define SCNiLEAST64 "lli" /* int_least64_t */
+#endif
#define SCNiFAST8 "hhi" /* int_fast8_t */
#define SCNiFAST16 "hi" /* int_fast16_t */
#define SCNiFAST32 "i" /* int_fast32_t */
+#ifdef _LP64
+#define SCNiFAST64 "li" /* int_fast64_t */
+#define SCNiMAX "li" /* intmax_t */
+#else
#define SCNiFAST64 "lli" /* int_fast64_t */
#define SCNiMAX "lli" /* intmax_t */
+#endif
#define SCNiPTR "li" /* intptr_t */
/* fscanf macros for unsigned integers */
@@ -169,46 +269,85 @@
#define SCNo8 "hho" /* uint8_t */
#define SCNo16 "ho" /* uint16_t */
#define SCNo32 "o" /* uint32_t */
+#ifdef _LP64
+#define SCNo64 "lo" /* uint64_t */
+#else
#define SCNo64 "llo" /* uint64_t */
+#endif
#define SCNoLEAST8 "hho" /* uint_least8_t */
#define SCNoLEAST16 "ho" /* uint_least16_t */
#define SCNoLEAST32 "o" /* uint_least32_t */
+#ifdef _LP64
+#define SCNoLEAST64 "lo" /* uint_least64_t */
+#else
#define SCNoLEAST64 "llo" /* uint_least64_t */
+#endif
#define SCNoFAST8 "hho" /* uint_fast8_t */
#define SCNoFAST16 "ho" /* uint_fast16_t */
#define SCNoFAST32 "o" /* uint_fast32_t */
+#ifdef _LP64
+#define SCNoFAST64 "lo" /* uint_fast64_t */
+#define SCNoMAX "lo" /* uintmax_t */
+#else
#define SCNoFAST64 "llo" /* uint_fast64_t */
#define SCNoMAX "llo" /* uintmax_t */
+#endif
#define SCNoPTR "lo" /* uintptr_t */
#define SCNu8 "hhu" /* uint8_t */
#define SCNu16 "hu" /* uint16_t */
#define SCNu32 "u" /* uint32_t */
+#ifdef _LP64
+#define SCNu64 "lu" /* uint64_t */
+#else
#define SCNu64 "llu" /* uint64_t */
+#endif
#define SCNuLEAST8 "hhu" /* uint_least8_t */
#define SCNuLEAST16 "hu" /* uint_least16_t */
#define SCNuLEAST32 "u" /* uint_least32_t */
+#ifdef _LP64
+#define SCNuLEAST64 "lu" /* uint_least64_t */
+#else
#define SCNuLEAST64 "llu" /* uint_least64_t */
+#endif
#define SCNuFAST8 "hhu" /* uint_fast8_t */
#define SCNuFAST16 "hu" /* uint_fast16_t */
#define SCNuFAST32 "u" /* uint_fast32_t */
+#ifdef _LP64
+#define SCNuFAST64 "lu" /* uint_fast64_t */
+#define SCNuMAX "lu" /* uintmax_t */
+#else
#define SCNuFAST64 "llu" /* uint_fast64_t */
#define SCNuMAX "llu" /* uintmax_t */
+#endif
#define SCNuPTR "lu" /* uintptr_t */
#define SCNx8 "hhx" /* uint8_t */
#define SCNx16 "hx" /* uint16_t */
#define SCNx32 "x" /* uint32_t */
+#ifdef _LP64
+#define SCNx64 "lx" /* uint64_t */
+#else
#define SCNx64 "llx" /* uint64_t */
+#endif
#define SCNxLEAST8 "hhx" /* uint_least8_t */
#define SCNxLEAST16 "hx" /* uint_least16_t */
#define SCNxLEAST32 "x" /* uint_least32_t */
+#ifdef _LP64
+#define SCNxLEAST64 "lx" /* uint_least64_t */
+#else
#define SCNxLEAST64 "llx" /* uint_least64_t */
+#endif
#define SCNxFAST8 "hhx" /* uint_fast8_t */
#define SCNxFAST16 "hx" /* uint_fast16_t */
#define SCNxFAST32 "x" /* uint_fast32_t */
+#ifdef _LP64
+#define SCNxFAST64 "lx" /* uint_fast64_t */
+#define SCNxMAX "lx" /* uintmax_t */
+#else
#define SCNxFAST64 "llx" /* uint_fast64_t */
#define SCNxMAX "llx" /* uintmax_t */
+#endif
#define SCNxPTR "lx" /* uintptr_t */
#endif /* !__INTPTR_FMTd__ */
Index: sys/arch/riscv/include/math.h
===================================================================
RCS file: /cvsroot/src/sys/arch/riscv/include/math.h,v
retrieving revision 1.1
diff -u -r1.1 math.h
--- sys/arch/riscv/include/math.h 19 Sep 2014 17:36:26 -0000 1.1
+++ sys/arch/riscv/include/math.h 13 Apr 2019 11:31:03 -0000
@@ -1,3 +1,7 @@
/* $NetBSD: math.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
#define __HAVE_NANF
+
+#if defined(_LP64) || defined(_KERNEL)
+#define __HAVE_LONG_DOUBLE 128
+#endif
Home |
Main Index |
Thread Index |
Old Index