On Wed, 8 Apr 2020, Liu Hao wrote:
在 2020/4/8 2:01, Martin Storsjö 写道:
This avoids optimizing the sincos function to a recursive call to
itself, if built with -ffast-math (unless built with -fno-builtin-sin).
While building with -ffast-math can break certain math routines and
thus can be considered a self-inflicted issue, it's safest to avoid
constructs that potentially can be optimized into an infinite self
recursion.
Signed-off-by: Martin Storsjö <mar...@martin.st>
---
mingw-w64-crt/Makefile.am | 5 ++--
mingw-w64-crt/math/arm-common/sincos.c | 29 ----------------------
mingw-w64-crt/math/arm/sincos.S | 32 ++++++++++++++++++++++++
mingw-w64-crt/math/arm/sincosf.S | 29 ++++++++++++++++++++++
mingw-w64-crt/math/arm64/sincos.S | 34 ++++++++++++++++++++++++++
mingw-w64-crt/math/arm64/sincosf.S | 31 +++++++++++++++++++++++
6 files changed, 129 insertions(+), 31 deletions(-)
delete mode 100644 mingw-w64-crt/math/arm-common/sincos.c
create mode 100644 mingw-w64-crt/math/arm/sincos.S
create mode 100644 mingw-w64-crt/math/arm/sincosf.S
create mode 100644 mingw-w64-crt/math/arm64/sincos.S
create mode 100644 mingw-w64-crt/math/arm64/sincosf.S
These patches look good to me.
However I think it's probably bad practice to build the CRT with
`-ffast-math` as it can lead to non-compliant code.
Indeed - if building with that option, the essential rounding operation
within e.g. the rint function (implemented in C) is optimized out - so the
user who reported these issues has been advised to not use that option
that widely.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public