[Mingw-w64-public] [PATCH] crt: arm: Fix rounding for FE_TONEAREST in llrint*

2019-04-18 Thread Martin Storsjö
Signed-off-by: Martin Storsjö 
---
 mingw-w64-crt/math/llrint.c  | 20 ++--
 mingw-w64-crt/math/llrintf.c | 20 ++--
 mingw-w64-crt/math/llrintl.c | 20 ++--
 3 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-crt/math/llrint.c b/mingw-w64-crt/math/llrint.c
index 8b138c07f..a7dbe792a 100644
--- a/mingw-w64-crt/math/llrint.c
+++ b/mingw-w64-crt/math/llrint.c
@@ -19,8 +19,24 @@ long long llrint (double x)
 retval = (long long)ceil(x);
   else if (mode == FE_TOWARDZERO)
 retval = x >= 0 ? (long long)floor(x) : (long long)ceil(x);
-  else
-retval = x >= 0 ? (long long)floor(x + 0.5) : (long long)ceil(x - 0.5);
+  else {
+double integral;
+double frac = modf(x, );
+long long iintegral = (long long)integral;
+if (frac == 0.5) {
+  if (iintegral & 1)
+retval = iintegral + 1;
+  else
+retval = iintegral;
+} else if (frac == -0.5) {
+  if (iintegral & 1)
+retval = iintegral-+ 1;
+  else
+retval = iintegral;
+} else {
+  retval = x >= 0 ? (long long)floor(x + 0.5) : (long long)ceil(x - 0.5);
+}
+  }
 #endif
   return retval;
 }
diff --git a/mingw-w64-crt/math/llrintf.c b/mingw-w64-crt/math/llrintf.c
index 1b2a422ea..949bd6605 100644
--- a/mingw-w64-crt/math/llrintf.c
+++ b/mingw-w64-crt/math/llrintf.c
@@ -19,8 +19,24 @@ long long llrintf (float x)
 retval = (long long)ceilf(x);
   else if (mode == FE_TOWARDZERO)
 retval = x >= 0 ? (long long)floorf(x) : (long long)ceilf(x);
-  else
-retval = x >= 0 ? (long long)floorf(x + 0.5) : (long long)ceilf(x - 0.5);
+  else {
+double integral;
+double frac = modf(x, );
+long long iintegral = (long long)integral;
+if (frac == 0.5) {
+  if (iintegral & 1)
+retval = iintegral + 1;
+  else
+retval = iintegral;
+} else if (frac == -0.5) {
+  if (iintegral & 1)
+retval = iintegral-+ 1;
+  else
+retval = iintegral;
+} else {
+  retval = x >= 0 ? (long long)floorf(x + 0.5) : (long long)ceilf(x - 0.5);
+}
+  }
 #endif
   return retval;
 }
diff --git a/mingw-w64-crt/math/llrintl.c b/mingw-w64-crt/math/llrintl.c
index ac06ab295..f11e0d071 100644
--- a/mingw-w64-crt/math/llrintl.c
+++ b/mingw-w64-crt/math/llrintl.c
@@ -19,8 +19,24 @@ long long llrintl (long double x)
 retval = (long long)ceil(x);
   else if (mode == FE_TOWARDZERO)
 retval = x >= 0 ? (long long)floor(x) : (long long)ceil(x);
-  else
-retval = x >= 0 ? (long long)floor(x + 0.5) : (long long)ceil(x - 0.5);
+  else {
+double integral;
+double frac = modf(x, );
+long long iintegral = (long long)integral;
+if (frac == 0.5) {
+  if (iintegral & 1)
+retval = iintegral + 1;
+  else
+retval = iintegral;
+} else if (frac == -0.5) {
+  if (iintegral & 1)
+retval = iintegral-+ 1;
+  else
+retval = iintegral;
+} else {
+  retval = x >= 0 ? (long long)floor(x + 0.5) : (long long)ceil(x - 0.5);
+}
+  }
 #endif
   return retval;
 }
-- 
2.17.1



___
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: arm: Add an alias for powl to pow, on arm/aarch64

2019-04-18 Thread Martin Storsjö
Signed-off-by: Martin Storsjö 
---
 mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in | 1 +
 mingw-w64-crt/lib-common/msvcrt.def.in | 1 +
 mingw-w64-crt/lib-common/ucrtbase.def.in   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in 
b/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in
index dcde8871e..617d7a041 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in
@@ -334,6 +334,7 @@ normf
 norml
 pow F_X86_ANY(DATA)
 F_NON_I386(powf F_X86_ANY(DATA))
+F_ARM_ANY(powl == pow)
 remainder
 remainderf
 remainderl
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in 
b/mingw-w64-crt/lib-common/msvcrt.def.in
index a1ce0f9fe..3e87bb888 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1442,6 +1442,7 @@ F_NON_I386(modff DATA)
 perror
 pow F_X86_ANY(DATA)
 F_NON_I386(powf F_X86_ANY(DATA))
+F_ARM_ANY(powl == pow)
 printf
 printf_s
 putc
diff --git a/mingw-w64-crt/lib-common/ucrtbase.def.in 
b/mingw-w64-crt/lib-common/ucrtbase.def.in
index a208dd8a2..b2eff5ea2 100644
--- a/mingw-w64-crt/lib-common/ucrtbase.def.in
+++ b/mingw-w64-crt/lib-common/ucrtbase.def.in
@@ -2478,6 +2478,7 @@ norml
 perror
 pow F_X86_ANY(DATA)
 F_NON_I386(powf F_X86_ANY(DATA))
+F_ARM_ANY(powl == pow)
 putc
 putchar
 puts
-- 
2.17.1



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


[Mingw-w64-public] Updated versions for mingw-w64-install

2019-04-18 Thread Edward Diener
The last version that can be downloaded using mingw-w64-install is gcc 
8.1, which was released almost a year ago. In the meantime releases 8.2 
and 8.3 of gcc have been released, Can we not get an update so that 
mingw-w64-install can download releases 8.2 an 8.3 of gcc on Windows. 
Gcc is the most conforming and reliable compiler for testing on Windows, 
so since I test a number of libraries for Boost, and program mostly on 
Windows, I am always happy to get the latest releases from mingw-w64.




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


Re: [Mingw-w64-public] PKGBUILD script for toolchain, still having GCC compile errors

2019-04-18 Thread David Grayson
It's not really a chicken and egg situation.  You just need to
convince GCC to be a cross-compiler hosted on the mingw-msvcrt
environment and targeting the mingw-ucrt environment.  Any libraries
you build targeting ucrt (including mingw-w64's) would go in a
directory like /mingw64-ucrt instead of /mingw64 to avoid confusion.
When you build executables that are part of GCC, they would link to
the UCRT.

But that seems like an uncommon configuration and GCC might not
understand it.  I did a quick search for "ucrt" in the GCC 8.3.0
source code and I don't see anything about it except in libsanitizer.
I'm not sure if you can somehow add "ucrt" to the triple that GCC uses
to identify the system it's targeting (x86_64-w64-mingw32).  There
might be a lot of code in GCC that assumes that all MinGW environments
are equal if their architectures are equal, so it might be hard to
convince GCC that it is a cross-compiler.  That makes me think it
might actually be easier if the cross-compiler where hosted in the
msys2/Cygwin runtime, or on Linux.

Here's a project I made to make it easy to cross-compile for MinGW on Linux:

https://github.com/DavidEGrayson/nixcrpkgs

It has no support the UCRT, but since its scripts are small and
simple, it might be easy to add it.  (Right now it only takes 362
lines of scripts and 8 patches to build a cross-compiling toolchain
with binutils, GCC 8, and mingw-w64.)

--David

On Thu, Apr 18, 2019 at 7:04 AM Kacvinsky, Tom  wrote:
>
>
>
> > -Original Message-
> > From: Kacvinsky, Tom 
> > Sent: Wednesday, April 17, 2019 12:39 PM
> > To: mingw-w64-public@lists.sourceforge.net
> > Subject: Re: [Mingw-w64-public] PKGBUILD script for toolchain, still having
> > GCC compile errors
>
> 
>
> >
> > This is good stuff, thanks for the instructions.  One question, though.  I 
> > want
> > mingw-w64-crt v6.0.0 support for UCRT>  How did I modify the PKGBUILD
> > script to get this support?  While I am at it, I want winpthreads support 
> > and
> > perhaps she instead of sjlj exception handling for libgnat.
>
> So I thought I'd change the configure options in PKGBUILD for the CRT to add
>
> --with-default-msvcrt=ucrt
>
> built and installed it.  But now when building GCC, I get the following
>
> C:/msys64-redux/mingw64/lib/gcc/x86_64-w64-mingw32/8.3.0/adalib/libgnat.a(argv.o):(.rdata$.refptr.__imp__environ[.refptr.__imp__environ]+0x0):
>  undefined reference to `__imp__environ'
> collect2.exe: error: ld returned 1 exit status
> gnatlink: error when calling C:\msys64-redux\mingw64\bin\gcc.exe
> gnatmake: *** link failed.
>
> This is not surprising since the GCC I have on the system contains a libgnat 
> that
> uses the older MSVC runtime, which requires the _environ symbol.  So I have a
> chicken and egg situation here.
>
> Any way around this?
>
> Thanks,
>
> Tom
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


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


Re: [Mingw-w64-public] [PATCH] crt: x86: Add the missing _copysignf function in libmsvcrt-os.a for i386

2019-04-18 Thread Liu Hao
在 2019/4/18 16:51, Martin Storsjö 写道:
> This function exists in the import library for all other architectures,
> and exists in libmingwex.a without an underscore prefix.
> 
> Signed-off-by: Martin Storsjö 
> ---
>  mingw-w64-crt/Makefile.am   |  1 +
>  mingw-w64-crt/math/x86/_copysignf.c | 14 ++
>  2 files changed, 15 insertions(+)
>  create mode 100644 mingw-w64-crt/math/x86/_copysignf.c
> 
>

This patch looks good to me.


-- 
Best regards,
LH_Mouse

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


Re: [Mingw-w64-public] [PATCH] Add api-ms-win-core-datetime-l1-1-0 library

2019-04-18 Thread Liu Hao
在 2019/4/18 2:39, Biswapriyo Nath 写道:
> ...
> 
> 
> 


Thanks. Pushed this one.


-- 
Best regards,
LH_Mouse



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


Re: [Mingw-w64-public] PKGBUILD script for toolchain, still having GCC compile errors

2019-04-18 Thread Liu Hao
在 2019/4/18 0:38, Kacvinsky, Tom 写道:
> Hi,

> 
> This is good stuff, thanks for the instructions.  One question, though.  I
> want mingw-w64-crt v6.0.0 support for UCRT>  How did I modify the
> PKGBUILD script to get this support?  While I am at it, I want winpthreads
> support and perhaps she instead of sjlj exception handling for libgnat.
> 
> Thanks,

The exception model is specified in PKGBUILD.

winstorecompat and winpthreads are split into two separated package
named 'mingw-w64-winstorecompat-git' and 'mingw-w64-winpthreads-git'.
You may build them following alike instructions.



-- 
Best regards,
LH_Mouse



signature.asc
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: x86: Add the missing _copysignf function in libmsvcrt-os.a for i386

2019-04-18 Thread Martin Storsjö
This function exists in the import library for all other architectures,
and exists in libmingwex.a without an underscore prefix.

Signed-off-by: Martin Storsjö 
---
 mingw-w64-crt/Makefile.am   |  1 +
 mingw-w64-crt/math/x86/_copysignf.c | 14 ++
 2 files changed, 15 insertions(+)
 create mode 100644 mingw-w64-crt/math/x86/_copysignf.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 1d6370142..14399f440 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -232,6 +232,7 @@ src_ucrtbase=\
 
 src_msvcrt32=\
   $(src_msvcrt) \
+  math/x86/_copysignf.c \
   misc/lc_locale_func.c \
   misc/wassert.c
 
diff --git a/mingw-w64-crt/math/x86/_copysignf.c 
b/mingw-w64-crt/math/x86/_copysignf.c
new file mode 100644
index 0..134adf20e
--- /dev/null
+++ b/mingw-w64-crt/math/x86/_copysignf.c
@@ -0,0 +1,14 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include 
+
+float __cdecl _copysignf(float aX, float aY)
+{
+  return copysignf(aX, aY);
+}
+
+float (__cdecl *__MINGW_IMP_SYMBOL(_copysignf))(float, float) = _copysignf;
-- 
2.17.1



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