INSTALLING 64-BIT AND 32-BIT GCC 5.4 EXECUTABLES THAT CAN COMPILE TO 64-BIT AND 32-BIT CODE,
RESPECTIVELY (MY FOLDER STRUCTURE).

To do this install, I install two of the mingw-64 automated builds under one folder and
then make some slight adjustments to them.  The combined distribution takes up about 650 MiB
of disk space.

Aug 12, 2016
------------
1. Download these two distros:
    a. x86_64-5.4.0-release-win32-seh-rt_v5-rev0.7z
        Folder:  Win64 Toolchain
    b. i686-5.4.0-release-win32-dwarf-rt_v5-rev0.7z
        Folder:   Win32 Toolchain
   (available from http://sourceforge.net/projects/mingw-w64)
   See the Stack Overflow Page for the difference between seh, sjlj, and dwarf distros.

2. Extract the two distros under a root folder like "d:\mingw"

3. Move to d:\mingw (or whatever the intall folder is) and run the gosetup.bat script
   from that folder.  Make sure make.exe and rsxnt.dll are in d:\mingw before running
   the script if you want those files.

        d:\mingw
            +- x64        (re-named from \mingw64)
               +- include (from \mingw64\include and \mingw64\x86_64-w64-mingw32\include)
               +- libexec (from \mingw64\libexec)
               +- lib     (from \mingw64\lib and \mingw64\x86_64-w64-mingw32\lib)
               +- bin     (from \mingw64\bin)
            +- x32        (re-named from \mingw32)
               +- include (from \mingw32\include and \mingw32\i686-w64-mingw32\include)
               +- libexec (from \mingw32\libexec)
               +- lib     (from \mingw32\lib and \mingw32\i686-w64-mingw32\lib)
               +- bin     (from \mingw32\bin)

4. Edit \mingw\x64\include\float.h and \mingw\x32\include\float.h and add these lines
   to both (I insert them after the line that says #define LDBL_MIN	__LDBL_MIN__):

    /* The difference between 1 and the least value greater than 1 that is
       representable in the given floating point type, b**1-p.  */
    #undef FLT_EPSILON
    #undef DBL_EPSILON
    #undef LDBL_EPSILON
    #define FLT_EPSILON	__FLT_EPSILON__
    #define DBL_EPSILON	__DBL_EPSILON__
    #define LDBL_EPSILON	__LDBL_EPSILON__

5. Optimizations

   a. One-pass max:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                     -fgraphite-identity -floop-interchange -floop-block
                     -floop-parallelize-all -ftree-loop-distribution
                     -ftree-parallelize-loops=2 -pthread -m64 -Wall

   b. Profile generate:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                         -fgraphite-identity -floop-interchange -floop-block -pthread
                         -floop-parallelize-all -ftree-parallelize-loops=4
                         -ftree-loop-distribution -march=native -m64 -Wall
                         -fprofile-generate=d:\gcc_profiles

   c. Profile use:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                    -fgraphite-identity -floop-interchange -floop-block -pthread
                    -floop-parallelize-all -ftree-parallelize-loops=4
                    -ftree-loop-distribution -march=native -m64 -Wall
                    -fprofile-use=d:\gcc_profiles

6. Scripts to set environment/path:
   
   a. 64-bit:
        @echo off
        call goclear.bat (removes all other compiler dirs from path)
        call _repath.bat
        del _repath.bat
        repath -u c:\mingw* -e d:\mingw\x64\bin
        repath -e d:\mingw\x64\bin
        call _repath.bat
        del _repath.bat
        set c_include_path=d:\my_include;d:\mingw\x64\include
        set cplus_include_path=d:\my_include;d:\mingw\x64\include;d:\mingw\x64\include\c++;d:\mingw\x64\include\c++\backward
        set library_path=d:\my_libs\mingw64;d:\mingw\x64\lib
        set cflags=-Ofast -m64 -Wall
        gcc -v

   b. 32-bit:
        @echo off
        call goclear.bat (removes all other compiler dirs from path)
        call _repath.bat
        del _repath.bat
        repath -u c:\mingw* -e d:\mingw\x32\bin
        call _repath.bat
        del _repath.bat
        set c_include_path=d:\my_include;d:\mingw\x32\include
        set cplus_include_path=d:\my_include;d:\mingw\x32\include;d:\mingw\x32\include\c++;d:\mingw\x32\in
        clude\c++\backward
        set library_path=d:\my_libs\mingw32;d:\mingw\x32\lib
        set cflags=-Ofast -m32 -Wall
        gcc -v