Re: [Mingw-w64-public] [PATCH] crt: Revert to our implementation of scalbn/scalbnf and ldexp on UCRT

2023-10-31 Thread LIU Hao

在 2023-10-31 17:24, Martin Storsjö 写道:

The UCRT implementation of scalbn/scalbnf (and presumably ldexp
too, as it's an identical function) has a minor spec incompliance;
it doesn't respect the rounding mode that has been set.

For most uses of scalbn, rounding isn't at play at all; rounding
only makes a difference when scaling the floats out of range,
for deciding between staying at DBL_MAX or going to infinity,
or likewise between the smallest subnormal or going to zero.

This is observed in compiler-rt's testsuite for builtins.

Signed-off-by: Martin Storsjö 
---
I submitted a PR to change compiler-rt's tests to ignore this failure
at https://github.com/llvm/llvm-project/pull/70776 as well, but if
we consider strictness in these corner cases important enough we
can certainly do this revert as well.
---
  mingw-w64-crt/Makefile.am | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)



This patch looks good to me. Thanks.


--
Best regards,
LIU Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] crt: Revert to our implementation of scalbn/scalbnf and ldexp on UCRT

2023-10-31 Thread Martin Storsjö
The UCRT implementation of scalbn/scalbnf (and presumably ldexp
too, as it's an identical function) has a minor spec incompliance;
it doesn't respect the rounding mode that has been set.

For most uses of scalbn, rounding isn't at play at all; rounding
only makes a difference when scaling the floats out of range,
for deciding between staying at DBL_MAX or going to infinity,
or likewise between the smallest subnormal or going to zero.

This is observed in compiler-rt's testsuite for builtins.

Signed-off-by: Martin Storsjö 
---
I submitted a PR to change compiler-rt's tests to ignore this failure
at https://github.com/llvm/llvm-project/pull/70776 as well, but if
we consider strictness in these corner cases important enough we
can certainly do this revert as well.
---
 mingw-w64-crt/Makefile.am | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index d94461c00..833c392b0 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -216,7 +216,6 @@ src_msvcrt_common_add_x86=\
   math/x86/floor.S \
   math/x86/fmod.c \
   math/x86/ilogb.S math/x86/ilogbf.S \
-  math/x86/ldexp.c \
   math/x86/log.c \
   math/x86/log1p.S math/x86/log1pf.S \
   math/x86/log2.S math/x86/log2f.S \
@@ -226,7 +225,6 @@ src_msvcrt_common_add_x86=\
   math/x86/remainder.S math/x86/remainderf.S \
   math/x86/remquo.S math/x86/remquof.S \
   math/x86/rint.c math/x86/rintf.c \
-  math/x86/scalbn.S math/x86/scalbnf.S \
   math/x86/sin.c \
   math/x86/trunc.S math/x86/truncf.S \
   \
@@ -786,10 +784,13 @@ src_libmingwex_x86=\
   math/x86/exp2l.S  math/x86/exp.def.hmath/x86/expl.c  
 math/x86/expm1.def.h  math/x86/expm1l.c \
   math/x86/fastmath.h   math/x86/floorl.S \
   math/x86/fmodl.c  math/x86/fucom.c  \
-  math/x86/ilogbl.S math/x86/internal_logl.S  math/x86/ldexpl.c
 \
+  math/x86/ilogbl.S math/x86/internal_logl.S  \
+  math/x86/ldexp.c  math/x86/ldexpl.c \
   math/x86/log.def.hmath/x86/log10l.S math/x86/log1pl.S
 math/x86/log2l.S  \
   math/x86/logbl.c  math/x86/logl.c   math/x86/nearbyintl.S
 math/x86/pow.def.hmath/x86/powl.c   \
-  math/x86/remainderl.S math/x86/remquol.Smath/x86/scalbnl.S   
 math/x86/sin.def.h\
+  math/x86/remainderl.S math/x86/remquol.S\
+  math/x86/scalbn.S math/x86/scalbnf.Smath/x86/scalbnl.S   
 \
+  math/x86/sin.def.h\
   math/x86/sinl.c   math/x86/sinl_internal.S  math/x86/tanl.S
 
 
-- 
2.34.1



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public