mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Build lib/msun tests with compiler builtins disabled
This forces the compiler to emit calls to libm functions, instead of possibly substituting pre-calculated results at compile time, which should help to actually test those functions. Reviewed by: emaste, arichardson, ngie Differential Revision: https://reviews.freebsd.org/D28577 (cherry picked from commitcf97d2a1da) riscv: Add a soft-float implementation of fabs() We could just use a C implementation using __builtin_fabs(), but using this assembly version guarantees that there is no additional prolog/epilog code. Additionally, clang generates worse code for masking off the top bit than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377. This fixes the RISCV64 softfloat world build aftercf97d2a1da. That commit added -fno-builtin to the msun tests which resulted in the first references to fabs (previously the compiler inlined all calls). Reviewed By: dim Reported by: mjg Differential Revision: https://reviews.freebsd.org/D28994 (cherry picked from commit524b018d20) riscv: Fix whitespace issues in fabs added in524b018d20(cherry picked from commit066dab17e7)
This commit is contained in:
parent
c4dbe899aa
commit
27e68baf24
2 changed files with 13 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 2015-2017 Ruslan Bukin <br@bsdpad.com>
|
||||
* Copyright (c) 2021 Alex Richardson <arichardson@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by SRI International and the
|
||||
|
|
@ -10,6 +11,9 @@
|
|||
* Computer Laboratory as part of the CTSRD Project, with support from the
|
||||
* UK Higher Education Innovation Fund (HEIF).
|
||||
*
|
||||
* This work was supported by Innovate UK project 105694, "Digital Security
|
||||
* by Design (DSbD) Technology Platform Prototype".
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
|
|
@ -35,9 +39,12 @@
|
|||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef __riscv_float_abi_double
|
||||
ENTRY(fabs)
|
||||
#ifdef __riscv_float_abi_double
|
||||
fabs.d fa0, fa0
|
||||
#else
|
||||
slli a0, a0, 1
|
||||
srli a0, a0, 1
|
||||
#endif
|
||||
ret
|
||||
END(fabs)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ CFLAGS+= -I${TESTSRC:H}/libc/gen
|
|||
CFLAGS+= -D__HAVE_LONG_DOUBLE
|
||||
.endif
|
||||
|
||||
# Avoid builtins, to force the compiler to emit calls to the libm
|
||||
# functions, and not calculate any results in advance.
|
||||
CFLAGS+= -fno-builtin
|
||||
|
||||
NETBSD_ATF_TESTS_C= acos_test
|
||||
NETBSD_ATF_TESTS_C+= asin_test
|
||||
NETBSD_ATF_TESTS_C+= atan_test
|
||||
|
|
|
|||
Loading…
Reference in a new issue