Enable long double tests on RISC-V

Some of the NetBSD contributed tests are gated behind the
__HAVE_LONG_DOUBLE flag. This flag seems to be defined only for
platforms whose long double is larger than their double. I could not
find this explicitly documented anywhere, but it is implied by the
definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the
following assertion from the UBSAN code:

  #ifdef __HAVE_LONG_DOUBLE
      long double LD;
      ASSERT(sizeof(LD) > sizeof(uint64_t));
  #endif

RISC-V has 128-bit long doubles, so enable the tests on this platform,
and update the comments to better explain the purpose of this flag.

Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25419
This commit is contained in:
Mitchell Horne 2020-06-24 13:11:19 +00:00
parent 7a9a01db9f
commit 2d143336de
3 changed files with 12 additions and 9 deletions

View File

@ -35,11 +35,12 @@ posix_spawn_test_FILESPACKAGE= ${PACKAGE}
CFLAGS+= -DTEST_LONG_DOUBLE
# Not sure why this isn't defined for all architectures, since most
# have long double.
# Define __HAVE_LONG_DOUBLE for architectures whose long double has greater
# precision than their double.
.if ${MACHINE_CPUARCH} == "aarch64" || \
${MACHINE_CPUARCH} == "amd64" || \
${MACHINE_CPUARCH} == "i386"
${MACHINE_CPUARCH} == "i386" || \
${MACHINE_CPUARCH} == "riscv"
CFLAGS+= -D__HAVE_LONG_DOUBLE
.endif

View File

@ -19,11 +19,12 @@ ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test
# All architectures on FreeBSD have fenv.h
CFLAGS+= -D__HAVE_FENV
# Not sure why this isn't defined for all architectures, since most
# have long double.
# Define __HAVE_LONG_DOUBLE for architectures whose long double has greater
# precision than their double.
.if ${MACHINE_CPUARCH} == "aarch64" || \
${MACHINE_CPUARCH} == "amd64" || \
${MACHINE_CPUARCH} == "i386"
${MACHINE_CPUARCH} == "i386" || \
${MACHINE_CPUARCH} == "riscv"
CFLAGS+= -D__HAVE_LONG_DOUBLE
.endif

View File

@ -10,11 +10,12 @@ CFLAGS+= -DHAVE_FENV_H
# For isqemu.h
CFLAGS+= -I${TESTSRC:H}/libc/gen
# Not sure why this isn't defined for all architectures, since most
# have long double.
# Define __HAVE_LONG_DOUBLE for architectures whose long double has greater
# precision than their double.
.if ${MACHINE_CPUARCH} == "aarch64" || \
${MACHINE_CPUARCH} == "amd64" || \
${MACHINE_CPUARCH} == "i386"
${MACHINE_CPUARCH} == "i386" || \
${MACHINE_CPUARCH} == "riscv"
CFLAGS+= -D__HAVE_LONG_DOUBLE
.endif