[Mingw-w64-public] [PATCH 4/4] math: arm: Replace the copysignl assembly file with a C file

2017-08-08 Thread Martin Storsjö
This function, on arm, just calls the normal double copysign function,
and there's no need to do that in assembly.
---
 mingw-w64-crt/Makefile.am   |  2 +-
 mingw-w64-crt/math/arm/{copysignl.S => copysignl.c} | 14 +-
 2 files changed, 6 insertions(+), 10 deletions(-)
 rename mingw-w64-crt/math/arm/{copysignl.S => copysignl.c} (52%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index f21bcd2..b640e87 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -319,7 +319,7 @@ src_libmingwex64=$(src_libmingwex_x86)
 
 # these only go into the ARM32 version:
 src_libmingwexarm32=\
-  math/arm/_chgsignl.S  math/arm/ceil.S   math/arm/ceilf.S 
 math/arm/ceill.S  math/arm/copysignl.S  \
+  math/arm/_chgsignl.S  math/arm/ceil.S   math/arm/ceilf.S 
 math/arm/ceill.S  math/arm/copysignl.c  \
   math/arm/floor.S  math/arm/floorf.S math/arm/floorl.S
 math/arm/nearbyint.S  math/arm/nearbyintf.S \
   math/arm/nearbyintl.S math/arm/trunc.S  math/arm/truncf.S
 
diff --git a/mingw-w64-crt/math/arm/copysignl.S 
b/mingw-w64-crt/math/arm/copysignl.c
similarity index 52%
rename from mingw-w64-crt/math/arm/copysignl.S
rename to mingw-w64-crt/math/arm/copysignl.c
index d58b7d1..ea66215 100644
--- a/mingw-w64-crt/math/arm/copysignl.S
+++ b/mingw-w64-crt/math/arm/copysignl.c
@@ -3,13 +3,9 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
-#include <_mingw_mac.h>
+#include 
 
-   .file   "copysignl.S"
-   .text
-   .align 4
-
-   .globl __MINGW_USYMBOL(copysignl)
-   .def__MINGW_USYMBOL(copysignl); .scl2;  .type   32; 
.endef
-__MINGW_USYMBOL(copysignl):
-   b   copysign
+long double copysignl(long double x, long double y)
+{
+return copysign(x, y);
+}
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 3/4] math: Split source files with plain assembly into different directories

2017-08-08 Thread Martin Storsjö
The files that previously had assembly for both x86 and arm are copied
into subdirectories and the arm specific parts are removed from x86 and
vice versa.

Some of the remaining .c files in the main math directory also include
arch specific assembly. But when porting to a new architecture, they
should be easier to identify (than assembly files that do assemble,
producing a symbol but no code), either via #error directives for
unsupported architectures, or via assembler errors if trying to
implicitly build inline assembly for the wrong architecture.
---
 mingw-w64-crt/Makefile.am | 42 +--
 mingw-w64-crt/math/arm/_chgsignl.S| 16 
 mingw-w64-crt/math/arm/ceil.S | 29 +
 mingw-w64-crt/math/arm/ceilf.S| 28 +
 mingw-w64-crt/math/arm/ceill.S| 28 +
 mingw-w64-crt/math/arm/copysignl.S| 15 +++
 mingw-w64-crt/math/arm/floor.S| 28 +
 mingw-w64-crt/math/arm/floorf.S   | 27 
 mingw-w64-crt/math/arm/floorl.S   | 28 +
 mingw-w64-crt/math/{ => arm}/nearbyint.S  | 39 
 mingw-w64-crt/math/{ => arm}/nearbyintf.S | 39 
 mingw-w64-crt/math/{ => arm}/nearbyintl.S | 40 -
 mingw-w64-crt/math/arm/trunc.S| 28 +
 mingw-w64-crt/math/arm/truncf.S   | 28 +
 mingw-w64-crt/math/{ => x86}/_chgsignl.S  |  3 ---
 mingw-w64-crt/math/{ => x86}/ceil.S   | 16 
 mingw-w64-crt/math/{ => x86}/ceilf.S  | 15 ---
 mingw-w64-crt/math/{ => x86}/ceill.S  | 16 
 mingw-w64-crt/math/{ => x86}/copysignl.S  |  2 --
 mingw-w64-crt/math/{ => x86}/floor.S  | 16 
 mingw-w64-crt/math/{ => x86}/floorf.S | 15 ---
 mingw-w64-crt/math/{ => x86}/floorl.S | 16 
 mingw-w64-crt/math/{ => x86}/nearbyint.S  | 13 --
 mingw-w64-crt/math/{ => x86}/nearbyintf.S | 13 --
 mingw-w64-crt/math/{ => x86}/nearbyintl.S | 13 --
 mingw-w64-crt/math/{ => x86}/trunc.S  | 15 ---
 mingw-w64-crt/math/{ => x86}/truncf.S | 15 ---
 27 files changed, 278 insertions(+), 305 deletions(-)
 create mode 100644 mingw-w64-crt/math/arm/_chgsignl.S
 create mode 100644 mingw-w64-crt/math/arm/ceil.S
 create mode 100644 mingw-w64-crt/math/arm/ceilf.S
 create mode 100644 mingw-w64-crt/math/arm/ceill.S
 create mode 100644 mingw-w64-crt/math/arm/copysignl.S
 create mode 100644 mingw-w64-crt/math/arm/floor.S
 create mode 100644 mingw-w64-crt/math/arm/floorf.S
 create mode 100644 mingw-w64-crt/math/arm/floorl.S
 copy mingw-w64-crt/math/{ => arm}/nearbyint.S (51%)
 copy mingw-w64-crt/math/{ => arm}/nearbyintf.S (51%)
 copy mingw-w64-crt/math/{ => arm}/nearbyintl.S (52%)
 create mode 100755 mingw-w64-crt/math/arm/trunc.S
 create mode 100755 mingw-w64-crt/math/arm/truncf.S
 rename mingw-w64-crt/math/{ => x86}/_chgsignl.S (94%)
 rename mingw-w64-crt/math/{ => x86}/ceil.S (85%)
 rename mingw-w64-crt/math/{ => x86}/ceilf.S (87%)
 rename mingw-w64-crt/math/{ => x86}/ceill.S (75%)
 rename mingw-w64-crt/math/{ => x86}/copysignl.S (94%)
 rename mingw-w64-crt/math/{ => x86}/floor.S (88%)
 rename mingw-w64-crt/math/{ => x86}/floorf.S (79%)
 rename mingw-w64-crt/math/{ => x86}/floorl.S (79%)
 rename mingw-w64-crt/math/{ => x86}/nearbyint.S (76%)
 rename mingw-w64-crt/math/{ => x86}/nearbyintf.S (77%)
 rename mingw-w64-crt/math/{ => x86}/nearbyintl.S (76%)
 rename mingw-w64-crt/math/{ => x86}/trunc.S (82%)
 rename mingw-w64-crt/math/{ => x86}/truncf.S (80%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 79a687d..f21bcd2 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -226,10 +226,6 @@ src_libmingwex=\
   gdtoa/misc.c  gdtoa/qnan.c gdtoa/smisc.c  gdtoa/strtodg.c  
gdtoa/strtodnrp.c  gdtoa/strtof.c \
   gdtoa/strtopx.c   gdtoa/sum.c  gdtoa/ulp.c\
   \
-  math/_chgsignl.S  math/ceil.Smath/ceilf.S  math/ceill.S  
   math/copysignl.S \
-  math/floor.S  math/floorf.S  math/floorl.S \
-  math/nearbyint.S  math/nearbyintf.S  math/nearbyintl.S \
-  math/trunc.S  math/truncf.S  \
   math/cbrt.c   \
   math/cbrtf.c  math/cbrtl.c   math/cephes_emath.c   
math/copysign.c  math/copysignf.c \
   math/coshf.c  math/coshl.c   math/erfl.c   \
@@ -297,30 +293,38 @@ src_libmingwex=\
 
 # these go into both 32 and 64 bit x86 versions:
 src_libmingwex_x86=\
-  math/x86/acosf.c  math/x86/acosh.c  math/x86/acosl.c 
 math/x86/acosh.def.h  math/x86/acoshf.c \
-  math/x86/acoshl.c math/x86/asinf.c  math/x86/asinh.c 
 math/x86/asinl.c  math/x86/asinhf.c \
-  mat

[Mingw-w64-public] [PATCH 2/4] math: Move x86 specific files to an x86 subdirectory

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-crt/Makefile.am| 36 +++-
 mingw-w64-crt/math/{ => x86}/acosf.c |  0
 mingw-w64-crt/math/{ => x86}/acosh.c |  0
 mingw-w64-crt/math/{ => x86}/acosh.def.h |  0
 mingw-w64-crt/math/{ => x86}/acoshf.c|  0
 mingw-w64-crt/math/{ => x86}/acoshl.c|  0
 mingw-w64-crt/math/{ => x86}/acosl.c |  0
 mingw-w64-crt/math/{ => x86}/asinf.c |  0
 mingw-w64-crt/math/{ => x86}/asinh.c |  0
 mingw-w64-crt/math/{ => x86}/asinhf.c|  0
 mingw-w64-crt/math/{ => x86}/asinhl.c|  0
 mingw-w64-crt/math/{ => x86}/asinl.c |  0
 mingw-w64-crt/math/{ => x86}/atan2.c |  0
 mingw-w64-crt/math/{ => x86}/atan2f.c|  0
 mingw-w64-crt/math/{ => x86}/atan2l.c|  0
 mingw-w64-crt/math/{ => x86}/atanf.c |  0
 mingw-w64-crt/math/{ => x86}/atanh.c |  0
 mingw-w64-crt/math/{ => x86}/atanhf.c|  0
 mingw-w64-crt/math/{ => x86}/atanhl.c|  0
 mingw-w64-crt/math/{ => x86}/atanl.c |  0
 mingw-w64-crt/math/{ => x86}/cos.c   |  0
 mingw-w64-crt/math/{ => x86}/cos.def.h   |  0
 mingw-w64-crt/math/{ => x86}/cosf.c  |  0
 mingw-w64-crt/math/{ => x86}/cosl.c  |  0
 mingw-w64-crt/math/{ => x86}/cosl_internal.S |  0
 mingw-w64-crt/math/{ => x86}/cossin.c|  0
 mingw-w64-crt/math/{ => x86}/exp.c   |  0
 mingw-w64-crt/math/{ => x86}/exp.def.h   |  0
 mingw-w64-crt/math/{ => x86}/exp2.S  |  0
 mingw-w64-crt/math/{ => x86}/exp2f.S |  0
 mingw-w64-crt/math/{ => x86}/exp2l.S |  0
 mingw-w64-crt/math/{ => x86}/expl.c  |  0
 mingw-w64-crt/math/{ => x86}/expm1.c |  0
 mingw-w64-crt/math/{ => x86}/expm1.def.h |  0
 mingw-w64-crt/math/{ => x86}/expm1f.c|  0
 mingw-w64-crt/math/{ => x86}/expm1l.c|  0
 mingw-w64-crt/math/{ => x86}/fastmath.h  |  0
 mingw-w64-crt/math/{ => x86}/fmod.c  |  0
 mingw-w64-crt/math/{ => x86}/fmodf.c |  0
 mingw-w64-crt/math/{ => x86}/fmodl.c |  0
 mingw-w64-crt/math/{ => x86}/frexpl.S|  0
 mingw-w64-crt/math/{ => x86}/fucom.c |  0
 mingw-w64-crt/math/{ => x86}/ilogb.S |  0
 mingw-w64-crt/math/{ => x86}/ilogbf.S|  0
 mingw-w64-crt/math/{ => x86}/ilogbl.S|  0
 mingw-w64-crt/math/{ => x86}/internal_logl.S |  0
 mingw-w64-crt/math/{ => x86}/ldexp.c |  0
 mingw-w64-crt/math/{ => x86}/ldexpl.c|  0
 mingw-w64-crt/math/{ => x86}/log.c   |  0
 mingw-w64-crt/math/{ => x86}/log.def.h   |  0
 mingw-w64-crt/math/{ => x86}/log10l.S|  0
 mingw-w64-crt/math/{ => x86}/log1p.S |  0
 mingw-w64-crt/math/{ => x86}/log1pf.S|  0
 mingw-w64-crt/math/{ => x86}/log1pl.S|  0
 mingw-w64-crt/math/{ => x86}/log2.S  |  0
 mingw-w64-crt/math/{ => x86}/log2f.S |  0
 mingw-w64-crt/math/{ => x86}/log2l.S |  0
 mingw-w64-crt/math/{ => x86}/logb.c  |  0
 mingw-w64-crt/math/{ => x86}/logbf.c |  0
 mingw-w64-crt/math/{ => x86}/logbl.c |  0
 mingw-w64-crt/math/{ => x86}/logl.c  |  0
 mingw-w64-crt/math/{ => x86}/pow.c   |  0
 mingw-w64-crt/math/{ => x86}/pow.def.h   |  0
 mingw-w64-crt/math/{ => x86}/powl.c  |  0
 mingw-w64-crt/math/{ => x86}/remainder.S |  0
 mingw-w64-crt/math/{ => x86}/remainderf.S|  0
 mingw-w64-crt/math/{ => x86}/remainderl.S|  0
 mingw-w64-crt/math/{ => x86}/remquo.S|  0
 mingw-w64-crt/math/{ => x86}/remquof.S   |  0
 mingw-w64-crt/math/{ => x86}/remquol.S   |  0
 mingw-w64-crt/math/{ => x86}/scalbn.S|  0
 mingw-w64-crt/math/{ => x86}/scalbnf.S   |  0
 mingw-w64-crt/math/{ => x86}/scalbnl.S   |  0
 mingw-w64-crt/math/{ => x86}/sin.c   |  0
 mingw-w64-crt/math/{ => x86}/sin.def.h   |  0
 mingw-w64-crt/math/{ => x86}/sinf.c  |  0
 mingw-w64-crt/math/{ => x86}/sinl.c  |  0
 mingw-w64-crt/math/{ => x86}/sinl_internal.S |  0
 mingw-w64-crt/math/{ => x86}/tanf.c  |  0
 mingw-w64-crt/math/{ => x86}/tanl.S  |  0
 80 files changed, 19 insertions(+), 17 deletions(-)
 rename mingw-w64-crt/math/{ => x86}/acosf.c (100%)
 rename mingw-w64-crt/math/{ => x86}/acosh.c (100%)
 rename mingw-w64-crt/math/{ => x86}/acosh.def.h (100%)
 rename mingw-w64-crt/math/{ => x86}/acoshf.c (100%)
 rename mingw-w64-crt/math/{ => x86}/acoshl.c (100%)
 rename mingw-w64-crt/math/{ => x86}/acosl.c (100%)
 rename mingw-w64-crt/math/{ => x86}/asinf.c (100%)
 rename mingw-w64-crt/math/{ => x86}/asinh.c (100%)
 rename mingw-w64-crt/math/{ => x86}/asinhf.c (100%)
 rename mingw-w64-crt/math/{ => x86}/asinhl.c (100%)
 rename mingw-w64-crt/math/{ => x86}/asinl.c (100%)
 rename mingw-w64-crt/math/{ => x86}/atan2.c (100%)
 rename mingw-w64-crt/math/{ => x86}/atan2f.c (100%)
 rename mingw-w64-crt/math/{ => x86}/atan2l.c (100%)
 rename mingw-w64-crt/math/{ => x86}/atanf.c (100%)
 rename mingw-w64-crt/math/{ => x86}/atanh.

[Mingw-w64-public] [PATCH 1/4] math: Deduplicate the list of x86 specific math source files

2017-08-08 Thread Martin Storsjö
Both src_libmingwex32 and src_libmingwex64 had the exact same list
of files; share this list in a common variable.
---
 mingw-w64-crt/Makefile.am | 24 +---
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index fb6c4da..a555800 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -296,25 +296,8 @@ src_libmingwex=\
   stdio/vscanf.c   stdio/vsnprintf.c stdio/vsnprintf_s.c  
stdio/vsnwprintf.cstdio/vsscanf.c \
   stdio/vswscanf.c stdio/vwscanf.c   stdio/wtoll.c
stdio/mingw_asprintf.cstdio/mingw_vasprintf.c
 
-# these only go into the 64 bit version:
-src_libmingwex64=\
-  math/acosf.c  math/acosh.c  math/acosl.c 
 math/acoshf.c math/acoshl.c \
-  math/asinf.c  math/asinh.c  math/asinl.c 
 math/asinhf.c math/asinhl.c \
-  math/atan2f.c   math/atan2.c math/atan2l.c math/atanf.c  
math/atanh.c  math/atanl.c  \
-  math/atanhf.c math/atanhl.c math/cos.c   
 math/cosf.c   math/cosl.c   \
-  math/cosl_internal.S  math/cossin.c math/exp.c   
 math/expl.c   math/exp2.S   \
-  math/exp2f.S  math/exp2l.S  math/expm1.c 
 math/expm1f.c math/expm1l.c \
-  math/fmod.c   math/fmodf.c  math/fmodl.c 
 math/frexpl.S math/fucom.c  \
-  math/ilogb.S  math/ilogbf.S math/ilogbl.S
 math/internal_logl.S  math/ldexp.c  \
-  math/ldexpl.c math/log.cmath/log10l.S
 math/log1p.S  math/log1pf.S \
-  math/log1pl.S math/log2.S   math/log2f.S 
 math/log2l.S  math/logb.c   \
-  math/logbf.c  math/logbl.c  math/logl.c  
 math/pow.cmath/powl.c   \
-  math/remainder.S  math/remainderf.S math/remainderl.S
 math/remquo.S math/remquof.S\
-  math/remquol.Smath/scalbn.S math/scalbnf.S   
 math/scalbnl.Smath/sin.c\
-  math/sinf.c   math/sinl.c   math/sinl_internal.S 
 math/tanf.c   math/tanl.S
-
-# these only go into the 32 bit version:
-src_libmingwex32=\
+# these go into both 32 and 64 bit x86 versions:
+src_libmingwex_x86=\
   math/acosf.c  math/acosh.c  math/acosl.c 
 math/acoshf.c math/acoshl.c \
   math/asinf.c  math/asinh.c  math/asinl.c 
 math/asinhf.c math/asinhl.c \
   math/atan2f.c math/atan2.c  math/atan2l.c 
math/atanf.c  math/atanh.c  math/atanl.c  \
@@ -330,6 +313,9 @@ src_libmingwex32=\
   math/remquol.Smath/scalbn.S math/scalbnf.S   
 math/scalbnl.Smath/sin.c\
   math/sinf.c   math/sinl.c   math/sinl_internal.S 
 math/tanf.c   math/tanl.S
 
+src_libmingwex32=$(src_libmingwex_x86)
+src_libmingwex64=$(src_libmingwex_x86)
+
 # these only go into the ARM32 version:
 if ENABLE_SOFTMATH
 src_libmingwexarm32=\
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
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 01/19] math: Add errors in assembly sources if no implementation exists

2017-08-08 Thread Martin Storsjö

On Mon, 7 Aug 2017, Martin Storsjö wrote:


On Sun, 6 Aug 2017, JonY via Mingw-w64-public wrote:


On 08/06/2017 02:59 PM, David Grayson wrote:

I would agree with Martin; I think it's a very good practice for
source files to have an error or not define a function instead of
defining a function that can't possibly work and letting the build
proceed with a broken function.  Compiler and linker errors are much
easier to figure out than segmentation faults.

If you try to do it with autoconf, it's easy for the autoconf layer to
get out of sync with the rest of the source code, or for someone to
decide they want to use their own build system instead of the autoconf
layer.  And it won't help very much when porting to a new architecture
like Martin said.

--David



The source file could be better split so you don't need to read all of
it, and you don't need any preprocessor directives sprinkled about, eg
math/asm/arm, math/common, math/asm/x86.


Sure, that'd at least make things clearer. It's straightforward to do for the 
plain assembly files, a bit less so for the C files that consist of mostly 
inline assembly, or C files with templates with inline assembly. But I guess 
I could start with the plain assembly files.


Does the 4 patch set I just sent look sensible and like what you had in 
mind? It doesn't sort out all files, but at least the ones that aren't 
built in all architectures, and all .S files.


I'll refrain from rebasing the arm64 patchset on top of this until it's 
settled and merged.


// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
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 1/4] math: Deduplicate the list of x86 specific math source files

2017-08-08 Thread JonY via Mingw-w64-public
On 08/08/2017 11:02 AM, Martin Storsjö wrote:
> Both src_libmingwex32 and src_libmingwex64 had the exact same list
> of files; share this list in a common variable.

Thanks for reorganizing the files, I don't have any objections. You can
go ahead for master if x86 builds don't break.



signature.asc
Description: OpenPGP digital signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 07/18] math: Use the same generic codepaths for arm64 as for arm

2017-08-08 Thread Martin Storsjö
Just as on arm, long double is the same as double.
---
 mingw-w64-crt/math/cephes_mconf.h |  4 ++--
 mingw-w64-crt/math/fabs.c |  4 ++--
 mingw-w64-crt/math/fabsf.c|  4 ++--
 mingw-w64-crt/math/fabsl.c|  2 +-
 mingw-w64-crt/math/fmal.c |  2 +-
 mingw-w64-crt/math/fpclassifyf.c  |  2 +-
 mingw-w64-crt/math/fpclassifyl.c  |  2 +-
 mingw-w64-crt/math/isnan.c|  2 +-
 mingw-w64-crt/math/isnanf.c   |  2 +-
 mingw-w64-crt/math/isnanl.c   |  2 +-
 mingw-w64-crt/math/lgammal.c  |  4 ++--
 mingw-w64-crt/math/lrintl.c   |  2 +-
 mingw-w64-crt/math/rintl.c|  2 +-
 mingw-w64-crt/math/signbit.c  |  2 +-
 mingw-w64-crt/math/signbitf.c |  2 +-
 mingw-w64-crt/math/signbitl.c |  2 +-
 mingw-w64-crt/math/truncl.c   |  4 ++--
 mingw-w64-headers/crt/math.h  | 30 +++---
 18 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/mingw-w64-crt/math/cephes_mconf.h 
b/mingw-w64-crt/math/cephes_mconf.h
index 832fae0..f502f18 100644
--- a/mingw-w64-crt/math/cephes_mconf.h
+++ b/mingw-w64-crt/math/cephes_mconf.h
@@ -66,7 +66,7 @@ extern double __QNAN;
 #endif
 
 /*long double*/
-#if defined(__arm__) || defined(_ARM_)
+#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || 
defined(_ARM64_)
 #define MAXNUML1.7976931348623158E308
 #define MAXLOGL7.09782712893383996843E2
 #define MINLOGL-7.08396418532264106224E2
@@ -84,7 +84,7 @@ extern double __QNAN;
 #define PIL3.1415926535897932384626L
 #define PIO2L  1.5707963267948966192313L
 #define PIO4L  7.8539816339744830961566E-1L
-#endif /* defined(__arm__) || defined(_ARM_) */
+#endif /* defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || 
defined(_ARM64_) */
 
 #define isfinitel isfinite
 #define isinfl isinf
diff --git a/mingw-w64-crt/math/fabs.c b/mingw-w64-crt/math/fabs.c
index cf2e6ef..2011378 100644
--- a/mingw-w64-crt/math/fabs.c
+++ b/mingw-w64-crt/math/fabs.c
@@ -9,12 +9,12 @@
 double
 fabs (double x)
 {
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_)
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
   return __builtin_fabs (x);
 #elif defined(__i386__) || defined(_X86_)
   double res = 0.0;
 
   asm ("fabs;" : "=t" (res) : "0" (x));
   return res;
-#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) */
+#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
 }
diff --git a/mingw-w64-crt/math/fabsf.c b/mingw-w64-crt/math/fabsf.c
index 5431c96..e8520d5 100644
--- a/mingw-w64-crt/math/fabsf.c
+++ b/mingw-w64-crt/math/fabsf.c
@@ -8,11 +8,11 @@ float fabsf (float x);
 float
 fabsf (float x)
 {
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_)
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
   return __builtin_fabsf (x);
 #elif defined(__i386__) || defined(_X86_)
   float res = 0.0F;
   asm ("fabs;" : "=t" (res) : "0" (x));
   return res;
-#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) */
+#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
 }
diff --git a/mingw-w64-crt/math/fabsl.c b/mingw-w64-crt/math/fabsl.c
index 2dfdfaa..20b8b22 100644
--- a/mingw-w64-crt/math/fabsl.c
+++ b/mingw-w64-crt/math/fabsl.c
@@ -12,7 +12,7 @@ fabsl (long double x)
   long double res = 0.0L;
   asm ("fabs;" : "=t" (res) : "0" (x));
   return res;
-#elif defined(__arm__) || defined(_ARM_)
+#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || 
defined(_ARM64_)
   return __builtin_fabsl (x);
 #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) */
 }
diff --git a/mingw-w64-crt/math/fmal.c b/mingw-w64-crt/math/fmal.c
index f1d575d..bea6742 100644
--- a/mingw-w64-crt/math/fmal.c
+++ b/mingw-w64-crt/math/fmal.c
@@ -5,7 +5,7 @@
  */
 long double fmal(long double x, long double y, long double z);
 
-#if defined(_ARM_) || defined(__arm__)
+#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__)
 
 double fma(double x, double y, double z);
 
diff --git a/mingw-w64-crt/math/fpclassifyf.c b/mingw-w64-crt/math/fpclassifyf.c
index 93fc6b7..1fbbfa5 100644
--- a/mingw-w64-crt/math/fpclassifyf.c
+++ b/mingw-w64-crt/math/fpclassifyf.c
@@ -8,7 +8,7 @@
 
 int __fpclassifyf (float _x)
 {
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_)
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || 
defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
 __mingw_flt_type_t hlp;
 
 hlp.x = _x;
diff --git a/mingw-w64-crt/math/fpclassifyl.c b/mingw-w64-crt/math/fpclassifyl.c
ind

[Mingw-w64-public] [PATCH 01/18] setjmp.h: Add a fallback definition for unsupported architectures

2017-08-08 Thread Martin Storsjö
This allows including the header without errors, if building for an
architecture that we lack setjmp support for so far.

This matches what wine have got at the end of their setjmp.h.
---
 mingw-w64-headers/crt/setjmp.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h
index 79c28a5..c931c77 100644
--- a/mingw-w64-headers/crt/setjmp.h
+++ b/mingw-w64-headers/crt/setjmp.h
@@ -162,6 +162,11 @@ extern "C" {
 unsigned long long D[8];
   } _JUMP_BUFFER;
 
+#else
+
+#define _JBLEN 1
+#define _JBTYPE int
+
 #endif
 
 #ifndef _JMP_BUF_DEFINED
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 05/18] headers: Skip the inline interlocked functions for arm64 (as on all other non-i386 archs)

2017-08-08 Thread Martin Storsjö
These are skipped on x86_64, arm and arm64 - in practice the condition
maybe should be inverted to only include i386.
---
 mingw-w64-headers/include/interlockedapi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-headers/include/interlockedapi.h 
b/mingw-w64-headers/include/interlockedapi.h
index 49f5cd7..bec2a93 100755
--- a/mingw-w64-headers/include/interlockedapi.h
+++ b/mingw-w64-headers/include/interlockedapi.h
@@ -14,7 +14,7 @@ extern "C" {
 #endif
 
 #if !defined (NOWINBASEINTERLOCK) && !defined (_NTOS_)
-#if !defined (__x86_64__) && !defined (__ia64__) && !defined (__arm__)
+#if !defined (__x86_64__) && !defined (__ia64__) && !defined (__arm__) && 
!defined (__aarch64__)
   WINBASEAPI LONG WINAPI InterlockedIncrement (LONG volatile *lpAddend);
   WINBASEAPI LONG WINAPI InterlockedDecrement (LONG volatile *lpAddend);
   WINBASEAPI LONG WINAPI InterlockedExchange (LONG volatile *Target, LONG 
Value);
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 04/18] headers: Detection of arm64 in some main locations

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-headers/crt/malloc.h|  2 +-
 mingw-w64-headers/include/winnt.h | 21 ++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/mingw-w64-headers/crt/malloc.h b/mingw-w64-headers/crt/malloc.h
index b4c9dc4..9d75ea6 100644
--- a/mingw-w64-headers/crt/malloc.h
+++ b/mingw-w64-headers/crt/malloc.h
@@ -136,7 +136,7 @@ void * __mingw_aligned_realloc (void *_Memory, size_t 
_Size, size_t _Offset);
 
 #if defined(_ARM_) || (defined(_X86_) && !defined(__x86_64))
 #define _ALLOCA_S_MARKER_SIZE 8
-#elif defined(__ia64__) || defined(__x86_64)
+#elif defined(__ia64__) || defined(__x86_64) || defined(__aarch64__)
 #define _ALLOCA_S_MARKER_SIZE 16
 #endif
 
diff --git a/mingw-w64-headers/include/winnt.h 
b/mingw-w64-headers/include/winnt.h
index ad077f8..9107a36 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -28,21 +28,28 @@ extern "C" {
 #endif
 
 #if defined(__x86_64) && \
-  !(defined(_X86_) || defined(__i386__) || defined(_IA64_) || defined 
(__arm__))
+  !(defined(_X86_) || defined(__i386__) || defined(_IA64_) || defined 
(__arm__) || defined(__aarch64__))
 #if !defined(_AMD64_)
 #define _AMD64_
 #endif
 #endif /* _AMD64_ */
 
 #if defined(__arm__) && \
-  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined 
(__ia64__))
+  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined 
(__ia64__) || defined(__aarch64__))
 #if !defined(_ARM_)
 #define _ARM_
 #endif
 #endif /* _ARM_ */
 
+#if defined(__aarch64__) && \
+  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined 
(__ia64__) || defined(__arm__))
+#if !defined(_ARM64_)
+#define _ARM64_
+#endif
+#endif /* _ARM64_ */
+
 #if defined(__ia64__) && \
-  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined 
(__arm__))
+  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined 
(__arm__) || defined(__aarch64__))
 #if !defined(_IA64_)
 #define _IA64_
 #endif
@@ -94,7 +101,7 @@ extern "C" {
 
 #undef  UNALIGNED  /* avoid redefinition warnings vs _mingw.h */
 #undef  UNALIGNED64
-#if defined (__ia64__) || defined (__x86_64__) || defined (__arm__)
+#if defined (__ia64__) || defined (__x86_64__) || defined (__arm__) || 
defined(__aarch64__)
 #define ALIGNMENT_MACHINE
 #define UNALIGNED __unaligned
 #if defined (_WIN64)
@@ -124,7 +131,7 @@ extern "C" {
 
 #if defined (__x86_64__) || defined (__i386__)
 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
-#elif defined (__ia64__) || defined (__arm__)
+#elif defined (__ia64__) || defined (__arm__) || defined(__aarch64__)
 #define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT (_s) > TYPE_ALIGNMENT (DWORD) ? 
TYPE_ALIGNMENT (_s) : TYPE_ALIGNMENT (DWORD))
 #elif !defined (RC_INVOKED) && !defined (__WIDL__)
 #error No supported target architecture.
@@ -143,7 +150,7 @@ extern "C" {
 #include 
 
 #ifndef DECLSPEC_IMPORT
-#if (defined (__i386__) || defined (__ia64__) || defined (__x86_64__) || 
defined (__arm__)) && !defined (__WIDL__)
+#if (defined (__i386__) || defined (__ia64__) || defined (__x86_64__) || 
defined (__arm__) || defined(__aarch64__)) && !defined (__WIDL__)
 #define DECLSPEC_IMPORT __declspec (dllimport)
 #else
 #define DECLSPEC_IMPORT
@@ -258,7 +265,7 @@ extern "C" {
 #endif
 #endif /* FASTCALL */
 
-#if defined(_ARM_)
+#if defined(_ARM_) || defined(_ARM64_)
 #define NTAPI
 #else
 #define NTAPI __stdcall
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 10/18] stdio: Add arm64 assembly wrappers for the v*scanf functions

2017-08-08 Thread Martin Storsjö
Implement the forwarding function in scanf2-template.S and the
va_list unwrapper in the __argtos function in scanf.S, and add
arm64 to the list of supported architectures in the files that
need it.
---
 mingw-w64-crt/stdio/scanf.S   | 32 
 mingw-w64-crt/stdio/scanf2-template.S |  2 ++
 mingw-w64-crt/stdio/vfscanf.c |  3 ++-
 mingw-w64-crt/stdio/vfwscanf.c|  3 ++-
 mingw-w64-crt/stdio/vsscanf.c |  3 ++-
 mingw-w64-crt/stdio/vswscanf.c|  3 ++-
 6 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-crt/stdio/scanf.S b/mingw-w64-crt/stdio/scanf.S
index 8983190..3a0e977 100644
--- a/mingw-w64-crt/stdio/scanf.S
+++ b/mingw-w64-crt/stdio/scanf.S
@@ -197,4 +197,36 @@ __argtos:
 add sp, sp, #128
 pop {r4-r7, pc}
 
+#elif defined (__aarch64__)
+
+.text
+.align 2
+.globl __argtos
+
+__argtos:
+stp x29, x30, [sp, #-16]!
+mov x29, sp
+sub sp, sp, #256
+mov x9, sp
+mov x10, x2
+mov x11, x3
+
+ldr x2, [x10], #8
+ldr x3, [x10], #8
+ldr x4, [x10], #8
+ldr x5, [x10], #8
+ldr x6, [x10], #8
+ldr x7, [x10], #8
+
+mov x12, #240
+1:  ldr x13, [x10], #8
+str x13, [x9], #8
+subsx12, x12, #8
+b.ne1b
+
+blr x11
+mov sp, x29
+ldp x29, x30, [sp], #16
+ret
+
 #endif
diff --git a/mingw-w64-crt/stdio/scanf2-template.S 
b/mingw-w64-crt/stdio/scanf2-template.S
index 9ed0cf7..892b7e6 100644
--- a/mingw-w64-crt/stdio/scanf2-template.S
+++ b/mingw-w64-crt/stdio/scanf2-template.S
@@ -23,6 +23,8 @@ FCT:
 #elif defined(_ARM_) || defined(__arm__)
 .thumb_func
 b   FWD
+#elif defined(_ARM64_) || defined(__aarch64__)
+b   FWD
 #endif
 #ifdef _WIN64
 .seh_endproc
diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index ffb5aef..dab72fe 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -20,7 +20,8 @@ int __ms_vfscanf (FILE * __restrict__ stream, const char * 
__restrict__ format,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vfscanf_internal (stream, format, arg, fscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index 6437dc8..52cf928 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -21,7 +21,8 @@ int __ms_vfwscanf (FILE * __restrict__ stream,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined (_ARM64_) || defined (__aarch64__)
   ret = __ms_vfwscanf_internal (stream, format, arg, fwscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index 1566b1b..6c8fe5a 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -21,7 +21,8 @@ int __ms_vsscanf (const char * __restrict__ s,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vsscanf_internal (s, format, arg, sscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
index 7393204..941ed12 100644
--- a/mingw-w64-crt/stdio/vswscanf.c
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -21,7 +21,8 @@ int __ms_vswscanf(const wchar_t * __restrict__ s, const 
wchar_t * __restrict__ f
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vswscanf_internal (s, format, arg, swscanf);
 #else
 #error "unknown platform"
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 06/18] fenv: Add arm64 specific codepaths in fenv functions, add arm64 fenv.h header section

2017-08-08 Thread Martin Storsjö
The fpcr register used in arm64 is the same as the fpscr register in 32
bit arm, but when the register is accessed via the msr/mrs instructions,
a 64 bit register has to be used - thus use a 64 bit local variable instead
of accessing a fenv_t directly.
---
 mingw-w64-crt/crt/CRT_fp10.c |  3 +++
 mingw-w64-crt/misc/feclearexcept.c   | 12 +---
 mingw-w64-crt/misc/fegetenv.c| 10 +++---
 mingw-w64-crt/misc/fegetexceptflag.c | 10 +++---
 mingw-w64-crt/misc/fegetround.c  |  6 +-
 mingw-w64-crt/misc/feholdexcept.c|  8 +++-
 mingw-w64-crt/misc/feraiseexcept.c   |  8 +++-
 mingw-w64-crt/misc/fesetenv.c| 14 +++---
 mingw-w64-crt/misc/fesetexceptflag.c | 13 ++---
 mingw-w64-crt/misc/fesetround.c  | 14 +++---
 mingw-w64-crt/misc/fetestexcept.c| 10 +++---
 mingw-w64-headers/crt/fenv.h | 16 +++-
 12 files changed, 99 insertions(+), 25 deletions(-)

diff --git a/mingw-w64-crt/crt/CRT_fp10.c b/mingw-w64-crt/crt/CRT_fp10.c
index 41cb573..f39b517 100644
--- a/mingw-w64-crt/crt/CRT_fp10.c
+++ b/mingw-w64-crt/crt/CRT_fp10.c
@@ -11,6 +11,9 @@ void _fpreset (void)
 #if defined(_ARM_) || defined(__arm__)
   __asm__ __volatile__ (
 "vmsr  fpscr, %0\n\t" : : "r"(0 /* INITIAL_FPSCR */));
+#elif defined(_ARM64_) || defined(__aarch64__)
+  __asm__ __volatile__ (
+"msr   fpcr, %0\n\t" : : "r"(0LL /* INITIAL_FPSCR */));
 #else
 #ifdef __GNUC__
   __asm__ ("fninit");
diff --git a/mingw-w64-crt/misc/feclearexcept.c 
b/mingw-w64-crt/misc/feclearexcept.c
index b5a3b70..673528b 100644
--- a/mingw-w64-crt/misc/feclearexcept.c
+++ b/mingw-w64-crt/misc/feclearexcept.c
@@ -5,7 +5,7 @@
  */
 #include 
 
-#if !(defined(_ARM_) || defined(__arm__))
+#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__))
 int __mingw_has_sse (void);
 
 int __mingw_has_sse(void)
@@ -32,7 +32,7 @@ int __mingw_has_sse(void)
 return 1;
   return 0;
 }
-#endif /* !(defined(_ARM_) || defined(__arm__)) */
+#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__)) */
 
 /* 7.6.2.1
The feclearexcept function clears the supported exceptions
@@ -45,6 +45,12 @@ int feclearexcept (int excepts)
   __asm__ volatile ("fmrx %0, FPSCR" : "=r" (_env));
   _env.__cw &= ~(excepts & FE_ALL_EXCEPT);
   __asm__ volatile ("fmxr FPSCR, %0" : : "r" (_env));
+#elif defined(_ARM64_) || defined(__aarch64__)
+  unsigned __int64 fpcr;
+  (void) _env;
+  __asm__ volatile ("mrs %0, fpcr" : "=r" (fpcr));
+  fpcr &= ~(excepts & FE_ALL_EXCEPT);
+  __asm__ volatile ("msr fpcr, %0" : : "r" (fpcr));
 #else
   int _mxcsr;
   if (excepts == FE_ALL_EXCEPT)
@@ -63,6 +69,6 @@ int feclearexcept (int excepts)
   _mxcsr &= ~(((excepts & FE_ALL_EXCEPT)));
   __asm__ volatile ("ldmxcsr %0" : : "m" (_mxcsr));
 }
-#endif /* defined(_ARM_) || defined(__arm__) */
+#endif /* defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__) */
   return (0);
 }
diff --git a/mingw-w64-crt/misc/fegetenv.c b/mingw-w64-crt/misc/fegetenv.c
index 96f57e4..3196081 100644
--- a/mingw-w64-crt/misc/fegetenv.c
+++ b/mingw-w64-crt/misc/fegetenv.c
@@ -5,9 +5,9 @@
  */
 #include 
 
-#if !(defined(_ARM_) || defined(__arm__))
+#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__))
 int __mingw_has_sse (void);
-#endif /* !(defined(_ARM_) || defined(__arm__)) */
+#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__)) */
 
 /* 7.6.4.1
The fegetenv function stores the current floating-point environment
@@ -17,6 +17,10 @@ int fegetenv (fenv_t * envp)
 {
 #if defined(_ARM_) || defined(__arm__)
   __asm__ volatile ("fmrx %0, FPSCR" : "=r" (*envp));
+#elif defined(_ARM64_) || defined(__aarch64__)
+  unsigned __int64 fpcr;
+  __asm__ volatile ("mrs %0, fpcr" : "=r" (fpcr));
+  envp->__cw = fpcr;
 #else
   __asm__ __volatile__ ("fnstenv %0;": "=m" (*envp));
  /* fnstenv sets control word to non-stop for all exceptions, so we
@@ -29,7 +33,7 @@ int fegetenv (fenv_t * envp)
   envp->__unused0 = (((unsigned int) _mxcsr) >> 16);
   envp->__unused1 = (((unsigned int) _mxcsr) & 0x);
 }
-#endif /* defined(_ARM_) || defined(__arm__) */
+#endif /* defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__) */
   return 0;
 }
 
diff --git a/mingw-w64-crt/misc/fegetexceptflag.c 
b/mingw-w64-crt/misc/fegetexceptflag.c
index e8dae96..eaa940a 100644
--- a/mingw-w64-crt/misc/fegetexceptflag.c
+++ b/mingw-w64-crt/misc/fegetexceptflag.c
@@ -5,9 +5,9 @@
  */
 #include 
 
-#if !(defined(_ARM_) || defined(__arm__))
+#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__))
 extern int __mingw_has_sse (void);
-#endif /* !(defined(_ARM_) || defined(__arm__)) */
+#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || 
defined(__aarch64__)) */
 
 /* 7.6.2.2  
The fegetexceptflag function

[Mingw-w64-public] [PATCH 09/18] math: Implement the exp2() wrappers using assembly on arm64

2017-08-08 Thread Martin Storsjö
The LLVM optimizer replaces a call to pow(2, x) back into a call to
exp2(x), which ends up in an infinite loop/recursion here. To avoid
the issue, one could either build exp2.c (or easier to accomplish, all
of libmingwex.a) using -fno-builtin or -ffreestanding, or produce the
exp2() function wrappers using assembly instead, to force a function
call to the real pow/powf functions.
---
 mingw-w64-crt/Makefile.am |  6 +++---
 mingw-w64-crt/math/arm64/exp2.S   | 19 +++
 mingw-w64-crt/math/arm64/exp2.c   | 26 --
 mingw-w64-crt/math/arm64/{ceill.S => exp2f.S} | 13 +++--
 4 files changed, 29 insertions(+), 35 deletions(-)
 create mode 100644 mingw-w64-crt/math/arm64/exp2.S
 delete mode 100644 mingw-w64-crt/math/arm64/exp2.c
 copy mingw-w64-crt/math/arm64/{ceill.S => exp2f.S} (61%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index ce208b6..3771f98 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -355,9 +355,9 @@ endif
 # these only go into the ARM64 version:
 src_libmingwexarm64=\
   math/arm64/_chgsignl.Smath/arm64/ceil.S math/arm64/ceilf.S   
 math/arm64/ceill.Smath/arm64/copysignl.c\
-  math/arm64/exp2.c math/arm64/floor.Smath/arm64/floorf.S  
 math/arm64/floorl.S   math/arm64/log2.c \
-  math/arm64/nearbyint.Smath/arm64/nearbyintf.S   math/arm64/nearbyintl.S  
 math/arm64/scalbn.c   math/arm64/sincos.c   \
-  math/arm64/trunc.Smath/arm64/truncf.S
+  math/arm64/exp2.S math/arm64/exp2f.Smath/arm64/floor.S   
 math/arm64/floorf.S   math/arm64/floorl.S   \
+  math/arm64/log2.c math/arm64/nearbyint.Smath/arm64/nearbyintf.S  
 math/arm64/nearbyintl.S   math/arm64/scalbn.c   \
+  math/arm64/sincos.c   math/arm64/trunc.Smath/arm64/truncf.S
 
 
 # These intrinsics are target independent:
diff --git a/mingw-w64-crt/math/arm64/exp2.S b/mingw-w64-crt/math/arm64/exp2.S
new file mode 100644
index 000..b1f7a07
--- /dev/null
+++ b/mingw-w64-crt/math/arm64/exp2.S
@@ -0,0 +1,19 @@
+/**
+ * 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 <_mingw_mac.h>
+
+   .file   "exp2.S"
+   .text
+   .align 2
+   .globl __MINGW_USYMBOL(exp2)
+   .globl __MINGW_USYMBOL(exp2l)
+   .def__MINGW_USYMBOL(exp2);  .scl2;  .type   32; .endef
+   .def__MINGW_USYMBOL(exp2l); .scl2;  .type   32; .endef
+__MINGW_USYMBOL(exp2):
+__MINGW_USYMBOL(exp2l):
+   fmov d1, d0
+   fmov d0, #2.0
+   b pow
diff --git a/mingw-w64-crt/math/arm64/exp2.c b/mingw-w64-crt/math/arm64/exp2.c
deleted file mode 100644
index eb9ddf5..000
--- a/mingw-w64-crt/math/arm64/exp2.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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 
-
-double exp2(double x)
-{
-return pow(2, x);
-}
-
-float exp2f(float x)
-{
-return powf(2, x);
-}
-
-long double exp2l(long double x)
-{
-#if defined(__aarch64__) || defined(_ARM64_)
-return exp2(x);
-#else
-#error Not supported on your platform yet
-#endif
-}
diff --git a/mingw-w64-crt/math/arm64/ceill.S b/mingw-w64-crt/math/arm64/exp2f.S
similarity index 61%
copy from mingw-w64-crt/math/arm64/ceill.S
copy to mingw-w64-crt/math/arm64/exp2f.S
index 99385a3..c00f003 100644
--- a/mingw-w64-crt/math/arm64/ceill.S
+++ b/mingw-w64-crt/math/arm64/exp2f.S
@@ -5,11 +5,12 @@
  */
 #include <_mingw_mac.h>
 
-   .file   "ceill.S"
+   .file   "exp2f.S"
.text
.align 2
-   .globl __MINGW_USYMBOL(ceill)
-   .def__MINGW_USYMBOL(ceill); .scl2;  .type   32; .endef
-__MINGW_USYMBOL(ceill):
-   frintp  d0, d0
-   ret
+   .globl __MINGW_USYMBOL(exp2f)
+   .def__MINGW_USYMBOL(exp2f); .scl2;  .type   32; .endef
+__MINGW_USYMBOL(exp2f):
+   fmov s1, s0
+   fmov s0, #2.0
+   b powf
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 08/18] math: Add arm64 specific implementations of math functions

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-crt/Makefile.am  |  6 -
 mingw-w64-crt/math/{arm => arm64}/_chgsignl.S  |  6 ++---
 .../{stdio/vsscanf2.S => math/arm64/ceil.S}| 12 ++
 .../{stdio/vsscanf2.S => math/arm64/ceilf.S}   | 12 ++
 .../{stdio/vsscanf2.S => math/arm64/ceill.S}   | 13 ++-
 mingw-w64-crt/math/{arm => arm64}/copysignl.c  |  0
 mingw-w64-crt/math/arm64/exp2.c| 26 ++
 .../{stdio/vsscanf2.S => math/arm64/floor.S}   | 13 ++-
 .../math/{arm/_chgsignl.S => arm64/floorf.S}   | 17 +++---
 .../{stdio/vsscanf2.S => math/arm64/floorl.S}  | 13 ++-
 mingw-w64-crt/math/arm64/log2.c| 26 ++
 mingw-w64-crt/math/{arm => arm64}/nearbyint.S  | 18 +--
 mingw-w64-crt/math/{arm => arm64}/nearbyintf.S | 18 +--
 mingw-w64-crt/math/{arm => arm64}/nearbyintl.S | 18 +--
 mingw-w64-crt/math/arm64/scalbn.c  | 26 ++
 mingw-w64-crt/math/{arm => arm64}/sincos.c |  2 +-
 .../math/{arm/_chgsignl.S => arm64/trunc.S}| 16 ++---
 mingw-w64-crt/math/{arm => arm64}/truncf.S | 18 +++
 mingw-w64-crt/math/fma.c   | 12 ++
 mingw-w64-crt/math/fmaf.c  | 12 ++
 mingw-w64-crt/math/lrint.c |  5 +
 mingw-w64-crt/math/lrintf.c|  5 +
 mingw-w64-crt/math/rint.c  |  2 ++
 mingw-w64-crt/math/rintf.c |  2 ++
 mingw-w64-crt/math/sqrt.def.h  |  6 +
 25 files changed, 205 insertions(+), 99 deletions(-)
 copy mingw-w64-crt/math/{arm => arm64}/_chgsignl.S (92%)
 copy mingw-w64-crt/{stdio/vsscanf2.S => math/arm64/ceil.S} (60%)
 copy mingw-w64-crt/{stdio/vsscanf2.S => math/arm64/ceilf.S} (59%)
 copy mingw-w64-crt/{stdio/vsscanf2.S => math/arm64/ceill.S} (59%)
 copy mingw-w64-crt/math/{arm => arm64}/copysignl.c (100%)
 create mode 100644 mingw-w64-crt/math/arm64/exp2.c
 copy mingw-w64-crt/{stdio/vsscanf2.S => math/arm64/floor.S} (59%)
 copy mingw-w64-crt/math/{arm/_chgsignl.S => arm64/floorf.S} (52%)
 copy mingw-w64-crt/{stdio/vsscanf2.S => math/arm64/floorl.S} (58%)
 create mode 100644 mingw-w64-crt/math/arm64/log2.c
 copy mingw-w64-crt/math/{arm => arm64}/nearbyint.S (60%)
 copy mingw-w64-crt/math/{arm => arm64}/nearbyintf.S (60%)
 copy mingw-w64-crt/math/{arm => arm64}/nearbyintl.S (60%)
 create mode 100644 mingw-w64-crt/math/arm64/scalbn.c
 copy mingw-w64-crt/math/{arm => arm64}/sincos.c (93%)
 copy mingw-w64-crt/math/{arm/_chgsignl.S => arm64/trunc.S} (57%)
 copy mingw-w64-crt/math/{arm => arm64}/truncf.S (55%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 489f513..ce208b6 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -353,7 +353,11 @@ src_libmingwexarm32+=\
 endif
 
 # these only go into the ARM64 version:
-src_libmingwexarm64=
+src_libmingwexarm64=\
+  math/arm64/_chgsignl.Smath/arm64/ceil.S math/arm64/ceilf.S   
 math/arm64/ceill.Smath/arm64/copysignl.c\
+  math/arm64/exp2.c math/arm64/floor.Smath/arm64/floorf.S  
 math/arm64/floorl.S   math/arm64/log2.c \
+  math/arm64/nearbyint.Smath/arm64/nearbyintf.S   math/arm64/nearbyintl.S  
 math/arm64/scalbn.c   math/arm64/sincos.c   \
+  math/arm64/trunc.Smath/arm64/truncf.S
 
 
 # These intrinsics are target independent:
diff --git a/mingw-w64-crt/math/arm/_chgsignl.S 
b/mingw-w64-crt/math/arm64/_chgsignl.S
similarity index 92%
copy from mingw-w64-crt/math/arm/_chgsignl.S
copy to mingw-w64-crt/math/arm64/_chgsignl.S
index 355d355..0472c70 100644
--- a/mingw-w64-crt/math/arm/_chgsignl.S
+++ b/mingw-w64-crt/math/arm64/_chgsignl.S
@@ -8,9 +8,9 @@
 
.file   "_chgignl.S"
.text
-   .align 4
+   .align 2
.globl __MINGW_USYMBOL(_chgsignl)
.def__MINGW_USYMBOL(_chgsignl); .scl2;  .type   32; 
.endef
 __MINGW_USYMBOL(_chgsignl):
-   vneg.f64d0, d0
-   bx  lr
+   fnegd0, d0
+   ret
diff --git a/mingw-w64-crt/stdio/vsscanf2.S b/mingw-w64-crt/math/arm64/ceil.S
similarity index 60%
copy from mingw-w64-crt/stdio/vsscanf2.S
copy to mingw-w64-crt/math/arm64/ceil.S
index e840a97..6f46d35 100644
--- a/mingw-w64-crt/stdio/vsscanf2.S
+++ b/mingw-w64-crt/math/arm64/ceil.S
@@ -5,8 +5,12 @@
  */
 #include <_mingw_mac.h>
 
-#define FCT __MINGW_USYMBOL(vsscanf)
-#define FWD __MINGW_USYMBOL(__ms_vsscanf)
+   .file   "ceil.S"
+   .text
+   .align 2
+   .globl __MINGW_USYMBOL(ceil)
+   .def__MINGW_USYMBOL(ceil);  .scl2;  .type   32; .endef
 
-   .file   "vsscanf2.S"
-#include "scanf2-template.S"
+__MINGW_USYMBOL(ceil):
+   frintp  d0, d0
+   ret
diff --git a/mingw-w64-crt/stdio/vsscanf2

[Mingw-w64-public] [PATCH 14/18] crt: Change a check for _WIN64 into __x86_64__ in an assembly file

2017-08-08 Thread Martin Storsjö
This is similar to what was done in 40f03bb9eb. This isn't necessarily
supported on arm64 (at least not yet) even though it is on x86_64.
---
 mingw-w64-crt/stdio/scanf2-template.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/stdio/scanf2-template.S 
b/mingw-w64-crt/stdio/scanf2-template.S
index 892b7e6..bbd0e21 100644
--- a/mingw-w64-crt/stdio/scanf2-template.S
+++ b/mingw-w64-crt/stdio/scanf2-template.S
@@ -11,11 +11,11 @@
 .p2align 4,,15
 .globl  FCT
 .defFCT;.scl2;  .type   32; .endef
-#ifdef _WIN64
+#ifdef __x86_64__
 .seh_proc   FCT
 #endif
 FCT:
-#ifdef _WIN64
+#ifdef __x64_86__
 .seh_endprologue
 #endif
 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
@@ -26,7 +26,7 @@ FCT:
 #elif defined(_ARM64_) || defined(__aarch64__)
 b   FWD
 #endif
-#ifdef _WIN64
+#ifdef __x86_64__
 .seh_endproc
 #endif
 .defFWD;  .scl2;  .type   32; .endef
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 00/18] ARM64 support in MinGW, v2

2017-08-08 Thread Martin Storsjö
Hi,

This is v2 of the patchset, rebased on top of master with the
math files split into subdirectories.


Martin Storsjö (18):
  setjmp.h: Add a fallback definition for unsupported architectures
  crt: Add initial support for arm64 in mingw-w64-crt
Makefile.am/configure.ac
  crt: Add an initial libarm64 directory with def files
  headers: Detection of arm64 in some main locations
  headers: Skip the inline interlocked functions for arm64 (as on all
other non-i386 archs)
  fenv: Add arm64 specific codepaths in fenv functions, add arm64 fenv.h
header section
  math: Use the same generic codepaths for arm64 as for arm
  math: Add arm64 specific implementations of math functions
  math: Implement the exp2() wrappers using assembly on arm64
  stdio: Add arm64 assembly wrappers for the v*scanf functions
  intrin-impl.h: Include compiler builtins based parts on arm64 as well
  intrin-impl.h: Add arm64 functions corresponding to the arm ones
  crtexe: Skip __initenv on arm64 just as on arm
  crt: Change a check for _WIN64 into __x86_64__ in an assembly file
  crt: Change checks for _WIN64 into __x86_64__ around exception
handling
  winnt.h: Add arm64 specific handling of TEB
  winnt.h: Add empty definition of arch specific structs for arm64
  crt: Disable win64 unwinding on arm64

 mingw-w64-crt/Makefile.am  |  256 +
 mingw-w64-crt/configure.ac |   21 +
 mingw-w64-crt/crt/CRT_fp10.c   |3 +
 mingw-w64-crt/crt/crt_handler.c|2 +-
 mingw-w64-crt/crt/crtdll.c |2 +-
 mingw-w64-crt/crt/crtexe.c |6 +-
 mingw-w64-crt/crt/gs_support.c |2 +-
 mingw-w64-crt/libarm64/Makefile.am | 1164 
 mingw-w64-crt/{libarm32 => libarm64}/*.def |0
 mingw-w64-crt/math/{arm => arm64}/_chgsignl.S  |6 +-
 .../{stdio/vsscanf2.S => math/arm64/ceil.S}|   12 +-
 .../{stdio/vsscanf2.S => math/arm64/ceilf.S}   |   12 +-
 .../{stdio/vsscanf2.S => math/arm64/ceill.S}   |   13 +-
 mingw-w64-crt/math/{arm => arm64}/copysignl.c  |0
 mingw-w64-crt/math/arm64/exp2.S|   19 +
 .../math/{arm/_chgsignl.S => arm64/exp2f.S}|   16 +-
 .../{stdio/vsscanf2.S => math/arm64/floor.S}   |   13 +-
 .../math/{arm/_chgsignl.S => arm64/floorf.S}   |   17 +-
 .../{stdio/vsscanf2.S => math/arm64/floorl.S}  |   13 +-
 mingw-w64-crt/math/arm64/log2.c|   26 +
 mingw-w64-crt/math/{arm => arm64}/nearbyint.S  |   18 +-
 mingw-w64-crt/math/{arm => arm64}/nearbyintf.S |   18 +-
 mingw-w64-crt/math/{arm => arm64}/nearbyintl.S |   18 +-
 mingw-w64-crt/math/arm64/scalbn.c  |   26 +
 mingw-w64-crt/math/{arm => arm64}/sincos.c |2 +-
 .../math/{arm/_chgsignl.S => arm64/trunc.S}|   16 +-
 mingw-w64-crt/math/{arm => arm64}/truncf.S |   18 +-
 mingw-w64-crt/math/cephes_mconf.h  |4 +-
 mingw-w64-crt/math/fabs.c  |4 +-
 mingw-w64-crt/math/fabsf.c |4 +-
 mingw-w64-crt/math/fabsl.c |2 +-
 mingw-w64-crt/math/fma.c   |   12 +
 mingw-w64-crt/math/fmaf.c  |   12 +
 mingw-w64-crt/math/fmal.c  |2 +-
 mingw-w64-crt/math/fpclassifyf.c   |2 +-
 mingw-w64-crt/math/fpclassifyl.c   |2 +-
 mingw-w64-crt/math/isnan.c |2 +-
 mingw-w64-crt/math/isnanf.c|2 +-
 mingw-w64-crt/math/isnanl.c|2 +-
 mingw-w64-crt/math/lgammal.c   |4 +-
 mingw-w64-crt/math/lrint.c |5 +
 mingw-w64-crt/math/lrintf.c|5 +
 mingw-w64-crt/math/lrintl.c|2 +-
 mingw-w64-crt/math/rint.c  |2 +
 mingw-w64-crt/math/rintf.c |2 +
 mingw-w64-crt/math/rintl.c |2 +-
 mingw-w64-crt/math/signbit.c   |2 +-
 mingw-w64-crt/math/signbitf.c  |2 +-
 mingw-w64-crt/math/signbitl.c  |2 +-
 mingw-w64-crt/math/sqrt.def.h  |6 +
 mingw-w64-crt/math/truncl.c|4 +-
 mingw-w64-crt/misc/feclearexcept.c |   12 +-
 mingw-w64-crt/misc/fegetenv.c  |   10 +-
 mingw-w64-crt/misc/fegetexceptflag.c   |   10 +-
 mingw-w64-crt/misc/fegetround.c|6 +-
 mingw-w64-crt/misc/feholdexcept.c  |8 +-
 mingw-w64-crt/misc/feraiseexcept.c |8 +-
 mingw-w64-crt/misc/fesetenv.c  |   14 +-
 mingw-w64-crt/misc/fesetexceptflag.c   |   13 +-
 mingw-w64-crt/misc/fesetro

[Mingw-w64-public] [PATCH 16/18] winnt.h: Add arm64 specific handling of TEB

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-headers/include/winnt.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/mingw-w64-headers/include/winnt.h 
b/mingw-w64-headers/include/winnt.h
index 9107a36..f48cb30 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -8395,6 +8395,17 @@ typedef DWORD (WINAPI 
*PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID *);
 FORCEINLINE PVOID GetFiberData (VOID) { return *(PVOID *)GetCurrentFiber 
(); }
 #endif /* arm */
 
+#if defined (__aarch64__) && !defined (__WIDL__)
+struct _TEB *NtCurrentTeb (VOID);
+PVOID GetCurrentFiber (VOID);
+PVOID GetFiberData (VOID);
+FORCEINLINE struct _TEB *NtCurrentTeb(VOID) { struct _TEB *teb;
+__asm ("mov %0, x18" : "=r" (teb));
+return teb; }
+FORCEINLINE PVOID GetCurrentFiber(VOID) { return 
(PVOID)(((PNT_TIB)NtCurrentTeb())->FiberData); }
+FORCEINLINE PVOID GetFiberData (VOID) { return *(PVOID *)GetCurrentFiber 
(); }
+#endif /* aarch64 */
+
 #ifndef _NTTMAPI_
 #define _NTTMAPI_
 
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 11/18] intrin-impl.h: Include compiler builtins based parts on arm64 as well

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-headers/include/psdk_inc/intrin-impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h 
b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index 352b686..a1c77b5 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -1071,7 +1071,7 @@ __buildbittesti(InterlockedBitTestAndComplement, 
__LONG32, "eor", /* unused para
 
 /* * */
 
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) || defined(__arm__) || defined(_ARM_)
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || 
defined(_ARM64_)
 
 #if __INTRINSIC_PROLOG(__popcnt16)
 unsigned short __popcnt16(unsigned short);
@@ -1279,7 +1279,7 @@ void *_InterlockedExchangePointer(void *volatile 
*Target,void *Value) {
 #define __INTRINSIC_DEFINED__InterlockedExchangePointer
 #endif /* __INTRINSIC_PROLOG */
 
-#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) || defined(__arm__) || defined(_ARM_) */
+#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || 
defined(_ARM64_) */
 
 #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_)
 
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 02/18] crt: Add initial support for arm64 in mingw-w64-crt Makefile.am/configure.ac

2017-08-08 Thread Martin Storsjö
This is only supported by llvm-dlltool so far.

The actual def files in the libarm64 subdirectory are added in a separate 
commit.
---
 mingw-w64-crt/Makefile.am  | 252 +
 mingw-w64-crt/configure.ac |  21 
 2 files changed, 273 insertions(+)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index b640e87..489f513 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -28,17 +28,21 @@ CPPFLAGS64=-m64
 if WITH_GENLIB
   AM_DLLTOOLFLAGS=-o $@
   DLLTOOLFLAGSARM32=-a arm
+  DLLTOOLFLAGSARM64=
   DLLTOOLFLAGS32=-a x86
   DLLTOOLFLAGS64=-a x86_64
   DTDEFARM32=$(GENLIB) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS)
+  DTDEFARM64=$(GENLIB) $(DLLTOOLFLAGSARM64) $(AM_DLLTOOLFLAGS)
   DTDEF32=$(GENLIB) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS)
   DTDEF64=$(GENLIB) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS)
 else
   AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
   DLLTOOLFLAGSARM32=-m arm
+  DLLTOOLFLAGSARM64=-m arm64
   DLLTOOLFLAGS32=--as-flags=--32 -m i386
   DLLTOOLFLAGS64=--as-flags=--64 -m i386:x86-64
   DTDEFARM32=$(DLLTOOL) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS) --input-def
+  DTDEFARM64=$(DLLTOOL) $(DLLTOOLFLAGSARM64) $(AM_DLLTOOLFLAGS) --input-def
   DTDEF32=$(DLLTOOL) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS) --input-def
   DTDEF64=$(DLLTOOL) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS) --input-def
 endif
@@ -46,9 +50,11 @@ if DELAY_IMPORT_LIBS
   AM_DLLTOOLFLAGS += --output-delaylib $@.delayimp.a
 endif
 DTLIBARM32=$(DTDEFARM32) $(top_srcdir)/`echo $@ | $(SED) 
's|/lib|/|;s|\.a|.def|'`
+DTLIBARM64=$(DTDEFARM64) $(top_srcdir)/`echo $@ | $(SED) 
's|/lib|/|;s|\.a|.def|'`
 DTLIB32=$(DTDEF32) $(top_srcdir)/`echo $@ | $(SED) 's|/lib|/|;s|\.a|.def|'`
 DTLIB64=$(DTDEF64) $(top_srcdir)/`echo $@ | $(SED) 's|/lib|/|;s|\.a|.def|'`
 LDFLAGSARM32= -L$(top_builddir)/libarm32
+LDFLAGSARM64= -L$(top_builddir)/libarm64
 LDFLAGS32=-m32 -L$(top_builddir)/lib32
 LDFLAGS64=-m64 -L$(top_builddir)/lib64
 extra_include=-I$(top_srcdir)/include
@@ -346,6 +352,8 @@ src_libmingwexarm32+=\
   math/arm/exp2.c   math/arm/log2.c   math/arm/scalbn.c
 math/arm/sincos.c
 endif
 
+# these only go into the ARM64 version:
+src_libmingwexarm64=
 
 
 # These intrinsics are target independent:
@@ -385,6 +393,9 @@ src_intrincs32=\
 # these only go into the ARM32 version:
 src_intrincsarm32=
 
+# these only go into the ARM64 version:
+src_intrincsarm64=
+
 if LIB32
 #
 # Compiling 32-bit runtime
@@ -1503,6 +1514,247 @@ endif
 # End ARM 32-bit runtime
 # ##
 
+if LIBARM64
+#
+# Compiling ARM 64-bit runtime
+#
+
+libarm64dir=$(prefix)/@LIBARM64SUFFIXDIR@
+crt64dir=$(libarm64dir)
+winrt64dir=$(libarm64dir)
+dx64dir=$(libarm64dir)
+
+if !W32API
+crt64_DATA = \
+  libarm64/crt1.olibarm64/crt2.o libarm64/crt1u.o   libarm64/crt2u.o   
 libarm64/dllcrt1.olibarm64/dllcrt2.o \
+  libarm64/CRT_fp8.o libarm64/CRT_fp10.o libarm64/txtmode.o libarm64/binmode.o 
 libarm64/crtbegin.o   libarm64/crtend.o \
+  libarm64/gcrt0.o   libarm64/gcrt1.olibarm64/gcrt2.o   
libarm64/CRT_glob.o libarm64/CRT_noglob.o
+else
+crt64_DATA =
+endif
+
+COMPILE64=$(COMPILE) $(CPPFLAGSARM64) $(extra_include) -D_SYSCRT=1 -DCRTDLL=1
+libarm64/crt1.o: crt/crtexe.c
+   $(COMPILE64) -c $< -o $@ -D__CRTDLL__ -U__MSVCRT__
+libarm64/crt2.o: crt/crtexe.c
+   $(COMPILE64) -c $< -o $@ -U__CRTDLL__ -D__MSVCRT__
+libarm64/crt1u.o: crt/ucrtexe.c
+   $(COMPILE64) -c $< -o $@ -D__CRTDLL__ -U__MSVCRT__
+libarm64/crt2u.o: crt/ucrtexe.c
+   $(COMPILE64) -c $< -o $@ -U__CRTDLL__ -D__MSVCRT__
+libarm64/dllcrt1.o: crt/crtdll.c
+   $(COMPILE64) -c $< -o $@ -D__CRTDLL__ -U__MSVCRT__
+libarm64/dllcrt2.o: crt/crtdll.c
+   $(COMPILE64) -c $< -o $@ -U__CRTDLL__ -D__MSVCRT__
+
+libarm64/gcrt0.o: profile/gcrt0.c
+   $(COMPILE) $(CPPFLAGSARM64) -c $< -o $@
+libarm64/gcrt1.o: profile/gcrt0.c
+   $(COMPILE) $(CPPFLAGSARM64) -c $< -o $@ -U__MSVCRT__
+libarm64/gcrt2.o: profile/gcrt0.c
+   $(COMPILE) $(CPPFLAGSARM64) -c $< -o $@ -D__MSVCRT__
+
+libarm64/%.o: crt/%.c
+   $(COMPILE) $(CPPFLAGSARM64) -c $< -o $@
+
+# These source files aren't compiled in to any library yet.  I'm not sure how 
/ where to do so.
+# The source files that I did compile somewhere I just guessed at anyway.
+#
+
+temp= \
+dxerr.c \
+test.c
+
+libarm64_LIBRARIES = libarm64/libkernel32.a
+libarm64_libkernel32_a_SOURCES = $(src_intrincs) $(src_intrincsarm64)
+libarm64_libkernel32_a_AR = $(DTLIBARM64) && $(AR) $(ARFLAGS)
+libarm64_libkernel32_a_CPPFLAGS=$(CPPFLAGSARM64) $(extra_include) 
$(AM_CPPFLAGS)
+
+if !W32API
+libarm64_LIBRARIES += libarm64/libmsvcrt.a
+libarm64_libmsvcrt_a_SOURCES = $(src_msvcrt32) libarm64/msvcrt.def.in
+libarm64_libmsvcrt_a_AR = $(DTDEFARM64) libarm64/msvcrt.def && $(AR) $(ARFLAGS)
+libarm64_libmsvcrt_a_CPPFLAGS=$(CPPFLAGSARM64) -D__LIBMSVCRT__ 
$(extra_include) $(sysincludes)
+EXTRA_libarm64_libmsvcrt_a_DEPENDENCIES=libarm64/msvcrt.def
+endif
+
+libarm64_LIBRARIES += 

[Mingw-w64-public] [PATCH 13/18] crtexe: Skip __initenv on arm64 just as on arm

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-crt/crt/crtexe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index ae37e0f..bbef685 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -26,7 +26,7 @@ extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
 #define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
 #endif
 
-#if !defined(__initenv) && !defined(__arm__)
+#if !defined(__initenv) && !defined(__arm__) && !defined(__aarch64__)
 extern char *** __MINGW_IMP_SYMBOL(__initenv);
 #define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
 #endif
@@ -328,7 +328,7 @@ __tmainCRTStartup (void)
gcc inserts this call automatically for a function called main, but not 
for wmain.  */
 mainret = wmain (argc, argv, envp);
 #else
-#ifndef __arm__
+#if !defined(__arm__) && !defined(__aarch64__)
 __initenv = envp;
 #endif
 mainret = main (argc, argv, envp);
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 12/18] intrin-impl.h: Add arm64 functions corresponding to the arm ones

2017-08-08 Thread Martin Storsjö
---
 mingw-w64-headers/include/psdk_inc/intrin-impl.h | 145 +++
 1 file changed, 145 insertions(+)

diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h 
b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index a1c77b5..6f7d60e 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -152,6 +152,24 @@ __INTRINSICS_USEINLINE
   : "memory", "cc"); \
return (old >> Offset) & 1; \
 }
+#elif defined(__aarch64__) || defined(_ARM64_)
+#define __buildbittesti(x, y, z, a, b) unsigned char x(b y *Base, y Offset) \
+{ \
+   unsigned int old, tmp1, tmp2; \
+   unsigned int bit = 1 << Offset; \
+   __asm__ __volatile__ ("dmb  sy\n\t" \
+"1: ldxr   %w[old], %[Base]\n\t" \
+"mov   %w[tmp1], %w[old]\n\t" \
+z "%w[tmp1], %w[tmp1], %w[bit]\n\t" \
+"stxr  %w[tmp2], %w[tmp1], %[Base]\n\t" \
+"cmp   %w[tmp2], #0\n\t" \
+"b.ne  1b\n\t" \
+"dmb   sy" \
+  : [old] "=&r" (old), [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [Base] 
"+m" (*Base) \
+  : [bit] a "r" (bit) \
+  : "memory", "cc"); \
+   return (old >> Offset) & 1; \
+}
 #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || 
defined(_X86_) */
 
 /* This macro is used by YieldProcessor when compiling x86 w/o SSE2.
@@ -1069,6 +1087,133 @@ __buildbittesti(InterlockedBitTestAndComplement, 
__LONG32, "eor", /* unused para
 
 #endif /* defined(__arm__) || defined(_ARM_) */
 
+#if defined(__aarch64__) || defined(_ARM64_)
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandset)
+unsigned char _interlockedbittestandset(__LONG32 *a, __LONG32 b);
+#if !__has_builtin(_interlockedbittestandset)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandset, __LONG32, "orr", /* unused param 
*/, /* unused param */)
+#endif
+#define __INTRINSIC_DEFINED__interlockedbittestandset
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandreset)
+unsigned char _interlockedbittestandreset(__LONG32 *a, __LONG32 b);
+__INTRINSICS_USEINLINE 
+#if !__has_builtin(_interlockedbittestandreset)
+__buildbittesti(_interlockedbittestandreset, __LONG32, "bic", /* unused param 
*/, /* unused param */)
+#endif
+#define __INTRINSIC_DEFINED__interlockedbittestandreset
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandcomplement)
+unsigned char _interlockedbittestandcomplement(__LONG32 *a, __LONG32 b);
+#if !__has_builtin(_interlockedbittestandcomplement)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandcomplement, __LONG32, "eor", /* unused 
param */, /* unused param */)
+#endif
+#define __INTRINSIC_DEFINED__interlockedbittestandcomplement
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)
+unsigned char InterlockedBitTestAndSet(volatile __LONG32 *a, __LONG32 b);
+#if !__has_builtin(InterlockedBitTestAndSet)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndSet, __LONG32, "orr", /* unused param */, 
volatile)
+#endif
+#define __INTRINSIC_DEFINED_InterlockedBitTestAndSet
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndReset)
+unsigned char InterlockedBitTestAndReset(volatile __LONG32 *a, __LONG32 b);
+#if !__has_builtin(InterlockedBitTestAndReset)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndReset, __LONG32, "bic", /* unused param 
*/, volatile)
+#endif
+#define __INTRINSIC_DEFINED_InterlockedBitTestAndReset
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement)
+unsigned char InterlockedBitTestAndComplement(volatile __LONG32 *a, __LONG32 
b);
+#if !__has_builtin(InterlockedBitTestAndComplement)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndComplement, __LONG32, "eor", /* unused 
param */, volatile)
+#endif
+#define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_InterlockedAnd64)
+__MINGW_EXTENSION __int64 _InterlockedAnd64(__int64 volatile *, __int64);
+#if !__has_builtin(_InterlockedAnd64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedAnd64, __int64, and)
+#endif
+#define __INTRINSIC_DEFINED__InterlockedAnd64
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_InterlockedOr64)
+__MINGW_EXTENSION __int64 _InterlockedOr64(__int64 volatile *, __int64);
+#if !__has_builtin(_InterlockedOr64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedOr64, __int64, or)
+#endif
+#define __INTRINSIC_DEFINED__InterlockedOr64
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_InterlockedXor64)
+__MINGW_EXTENSION __int64 _InterlockedXor64(__int64 volatile *, __int64);
+#if !__has_builtin(_InterlockedXor64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedXor64, __int64, xor)
+#endif
+#define __INTRINSIC_DEFINED__InterlockedXor64
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_InterlockedIncrement64)
+__MINGW_EX

[Mingw-w64-public] [PATCH 18/18] crt: Disable win64 unwinding on arm64

2017-08-08 Thread Martin Storsjö
This allows building this file for now, until the necessary struct
(CONTEXT in winnt.h) is available.
---
 mingw-w64-crt/crt/gs_support.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/crt/gs_support.c b/mingw-w64-crt/crt/gs_support.c
index c5c1773..0c6ac68 100644
--- a/mingw-w64-crt/crt/gs_support.c
+++ b/mingw-w64-crt/crt/gs_support.c
@@ -104,7 +104,7 @@ __declspec(noreturn) void __cdecl
 __report_gsfailure (ULONG_PTR StackCookie)
 {
   volatile UINT_PTR cookie[2] __MINGW_ATTRIB_UNUSED;
-#ifdef _WIN64
+#if defined(_WIN64) && !defined(__aarch64__)
   ULONG64 controlPC, imgBase, establisherFrame;
   PRUNTIME_FUNCTION fctEntry;
   PVOID hndData;
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 17/18] winnt.h: Add empty definition of arch specific structs for arm64

2017-08-08 Thread Martin Storsjö
---
The correct/official definition of these structs are available in
winnt.h in the win10 sdk (but they are not documented on e.g. MSDN).
I haven't looked closer at them other than noticing that they exist
there. This setup (with empty dummy structs) is enough for code to
compile without error at least, as long as one doesn't try to use
functions that need these structs.
---
 mingw-w64-headers/include/winnt.h | 97 +++
 1 file changed, 97 insertions(+)

diff --git a/mingw-w64-headers/include/winnt.h 
b/mingw-w64-headers/include/winnt.h
index f48cb30..6a51c44 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -1948,6 +1948,103 @@ extern "C" {
 #endif /* _ARM_ */
 
 
+#ifdef _ARM64_
+
+#if defined(__aarch64__) && !defined(RC_INVOKED)
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#define BitTest _bittest
+#define BitTestAndComplement _bittestandcomplement
+#define BitTestAndSet _bittestandset
+#define BitTestAndReset _bittestandreset
+
+#define BitScanForward _BitScanForward
+#define BitScanReverse _BitScanReverse
+
+#define InterlockedIncrement16 _InterlockedIncrement16
+#define InterlockedDecrement16 _InterlockedDecrement16
+#define InterlockedCompareExchange16 _InterlockedCompareExchange16
+
+#define InterlockedAnd _InterlockedAnd
+#define InterlockedOr _InterlockedOr
+#define InterlockedXor _InterlockedXor
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedIncrementAcquire InterlockedIncrement
+#define InterlockedIncrementRelease InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedDecrementAcquire InterlockedDecrement
+#define InterlockedDecrementRelease InterlockedDecrement
+#define InterlockedAdd _InterlockedAdd
+#define InterlockedExchange _InterlockedExchange
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#define InterlockedCompareExchange _InterlockedCompareExchange
+#define InterlockedCompareExchangeAcquire InterlockedCompareExchange
+#define InterlockedCompareExchangeRelease InterlockedCompareExchange
+
+#define InterlockedAnd64 _InterlockedAnd64
+#define InterlockedAndAffinity InterlockedAnd64
+#define InterlockedOr64 _InterlockedOr64
+#define InterlockedOrAffinity InterlockedOr64
+#define InterlockedXor64 _InterlockedXor64
+#define InterlockedIncrement64 _InterlockedIncrement64
+#define InterlockedDecrement64 _InterlockedDecrement64
+#define InterlockedAdd64 _InterlockedAdd64
+#define InterlockedExchange64 _InterlockedExchange64
+#define InterlockedExchangeAcquire64 InterlockedExchange64
+#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
+#define InterlockedCompareExchange64 _InterlockedCompareExchange64
+#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
+#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
+
+#define InterlockedExchangePointer _InterlockedExchangePointer
+#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
+#define InterlockedCompareExchangePointerAcquire 
_InterlockedCompareExchangePointer
+#define InterlockedCompareExchangePointerRelease 
_InterlockedCompareExchangePointer
+
+#ifdef __cplusplus
+  }
+#endif
+#endif /* defined(__aarch64__) && !defined(RC_INVOKED) */
+
+#define EXCEPTION_READ_FAULT0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+#if !defined(RC_INVOKED)
+
+// TODO: #define CONTEXT_*
+
+#endif /* !defined(RC_INVOKED) */
+
+  typedef struct _CONTEXT {
+// TODO
+  } CONTEXT, *PCONTEXT;
+
+//  typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, 
*PRUNTIME_FUNCTION;
+//  typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 
ControlPc,PVOID Context);
+
+// TODO: #define UNW_*
+
+  typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
+// TODO
+  } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
+
+  typedef struct _UNWIND_HISTORY_TABLE {
+// TODO
+  } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
+
+  typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
+// TODO
+  } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
+
+#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME 
"OutOfProcessFunctionTableCallback"
+
+#endif /* _ARM64_ */
+
+
 #ifdef _X86_
 
 #if defined(__i386__) && !defined(__x86_64) && !defined(RC_INVOKED)
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 15/18] crt: Change checks for _WIN64 into __x86_64__ around exception handling

2017-08-08 Thread Martin Storsjö
This keeps these codepaths disabled on arm64 for now, where _WIN64
also is defined, but exception handling isn't supported yet.
---
 mingw-w64-crt/crt/crt_handler.c | 2 +-
 mingw-w64-crt/crt/crtdll.c  | 2 +-
 mingw-w64-crt/crt/crtexe.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/crt/crt_handler.c b/mingw-w64-crt/crt/crt_handler.c
index a1b51ce..6571e69 100644
--- a/mingw-w64-crt/crt/crt_handler.c
+++ b/mingw-w64-crt/crt/crt_handler.c
@@ -40,7 +40,7 @@ PBYTE _GetPEImageBase (void);
 int __mingw_init_ehandler (void);
 extern void _fpreset (void);
 
-#if defined(_WIN64) && !defined(_MSC_VER)
+#if defined(__x86_64__) && !defined(_MSC_VER)
 EXCEPTION_DISPOSITION __mingw_SEH_error_handler(struct _EXCEPTION_RECORD *, 
void *, struct _CONTEXT *, void *);
 
 #define MAX_PDATA_ENTRIES 32
diff --git a/mingw-w64-crt/crt/crtdll.c b/mingw-w64-crt/crt/crtdll.c
index 07a1840..7f6cf07 100644
--- a/mingw-w64-crt/crt/crtdll.c
+++ b/mingw-w64-crt/crt/crtdll.c
@@ -164,7 +164,7 @@ DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, 
LPVOID lpreserved)
   if (dwReason == DLL_PROCESS_ATTACH)
 {
   __security_init_cookie ();
-#ifdef _WIN64
+#ifdef __x86_64__
   __mingw_init_ehandler ();
 #endif
 }
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index bbef685..c2c4bbd 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -279,7 +279,7 @@ __tmainCRTStartup (void)
 
 _pei386_runtime_relocator ();
 __mingw_oldexcpt_handler = SetUnhandledExceptionFilter 
(_gnu_exception_handler);
-#ifdef _WIN64
+#ifdef __x86_64__
 __mingw_init_ehandler ();
 #endif
 _set_invalid_parameter_handler (__mingw_invalidParameterHandler);
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
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 00/18] ARM64 support in MinGW, v2

2017-08-08 Thread Jean-Baptiste Kempf
Hello,

On Tue, 8 Aug 2017, at 22:32, Martin Storsjö wrote:
> This is v2 of the patchset, rebased on top of master with the
> math files split into subdirectories.

From a quick review from a clueless guy like me:
- 1, 2, 3, 4, 5, 7, 11, 13, 14, 15 seems very much OK to me.
- 6 is so-so to understand for me. It feels right.
- 8, 9 and 12 no idea, I guess it would be better with a test-suite
(sic). OK if tested.
- 10 seems ok from my limited ARM understanding
- 16 and 17 no clue.


Best

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public