![]() |
|
|
#12 | |
|
Account Deleted
"Tim Sorbera"
Aug 2006
San Antonio, TX USA
102678 Posts |
Quote:
|
|
|
|
|
|
|
#13 | |
|
Mar 2006
2·277 Posts |
Quote:
Code:
static u64_t mulmod64(u64_t a, u64_t b, u64_t c)
{
u64_t d; /* to hold the result of a*b mod c */
/* calculates a*b mod c, stores result in d */
asm ("mov %1, %%rax;" /* put a into rax */
"mul %2;" /* mul a*b -> rdx:rax */
"div %3;" /* (a*b)/c -> quot in rax remainder in rdx */
"mov %%rdx, %0;" /* store result in d */
:"=r"(d) /* output */
:"r"(a), "r"(b), "r"(c) /* input */
:"%rax", "%rdx" /* clobbered registers */
);
return d;
}/* method mulmod64 */
|
|
|
|
|
|
|
#14 | |
|
∂2ω=0
Sep 2002
República de California
22×2,939 Posts |
Quote:
For the instruction-level profiling I mentioned I will still likely want to pay real $ for an Intel C license, but your suggestion should allow me to get a quick 64-bit build capability, so I can see how much of a performance difference the ASM using the full 64-bit-visible register set makes on my i7. |
|
|
|
|
|
|
#15 |
|
∂2ω=0
Sep 2002
República de California
22·2,939 Posts |
OK, I installed the current version of MinGW, added "C:\MinGw\bin" to my Windows path envvar, and tried a quick compile. The path update apparently doesn't take effect until the next restart, and I find it inconvenient to reboot just now, so for now I used the full path to the gcc binaries. The compile seems to succeed, but I see no object files created:
C:\Users\mayer\Visual Studio Projects\Mlucas\SRC>C:\MinGW\bin\gcc.exe -Wall -c br.c ...produces no .o or .obj files (or files of any kind) in the SRC directory. The compiler seems to be installed properly: C:\Users\mayer\Visual Studio Projects\Mlucas\SRC>C:\MinGW\bin\gcc.exe -v Using built-in specs. COLLECT_GCC=C:\MinGW\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.5.0/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --ena ble-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror - -build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.5.0 (GCC) I also tried creating an executable using "gcc.exe br.c -o foo.exe", which should give an error message since that small source file contains no main and is not suitable for standalone build - again, no error messages, no files created. Any ideas as to what may (or may not) be happening? |
|
|
|
|
|
#16 | |
|
Mar 2006
55410 Posts |
Quote:
http://sourceforge.net/projects/mingw-w64/ On the main page they have a source tarball where you can compile your own environment, or if you drill down into the all-files they have some precompiled toolchains available. If you go the precompiled route, I would recommend getting sezero's builds. If you are building -in- Win64 -for- Win64 I'd recommend the sezero personal build named: mingw-w64-bin_x86_64-mingw_20101003_sezero.zip Where mingw-w64 means your target is 64-bit windows; bin means it is precompiled; x86_64 is the host machine & OS, and mingw means the host OS is Windows. He also has personal builds if you want to cross compile 64-bit windows binaries from 32-bit and/or linux machines. My gcc -v gives (I currently have an old version): Code:
Using built-in specs. Target: x86_64-w64-mingw32 Configured with: ../gcc44-svn/configure --target=x86_64-w64-mingw32 --host=x86_6 4-w64-mingw32 --disable-multilib --disable-nls --disable-win32-registry --prefix =/mingw64 --with-sysroot=/mingw64 --with-gmp=/mingw64 --with-mpfr=/mingw64 --ena ble-languages=c,c++ Thread model: win32 gcc version 4.4.3 (GCC) If that doesn't work, or you already have mingw64, they have an excellent group of developers who are quick to respond to questions on their public mailing list located here: https://lists.sourceforge.net/lists/...ngw-w64-public |
|
|
|
|
|
|
#17 | |
|
∂2ω=0
Sep 2002
República de California
101101111011002 Posts |
Quote:
4.4.5 20101001 (release) [svn/rev.164871 - mingw-w64/oz] ...and a trial-build of the small file I tried previously shows it is working properly - in my case that means it is issuing a raft of predefine-related errors which tell me I need to modify my platform.h file to properly detect mingw64-for-windows. Thanks, will post an update once I get something approaching a working 64-bit build of the SSE2-enabled code. Weird thst the MinGW install looked like it succeeded, down to providing correct gcc -v diagnostics, but neither built anything nor issued any error messages indicating a problem. -Ernst |
|
|
|
|
|
|
#18 |
|
∂2ω=0
Sep 2002
República de California
1175610 Posts |
Update: OK, things look promising: With a few tweaks to my platform-specific predefines (previously "OS = Windows" was treated as a euphemism for "Compiler = Visual studio"), I am able to successfully build all but a handful of files, and the failures are all files containing or referencing a handful of recently-written ASM macros which I have not yet ported to GCC format. A few evenings' work should get me there...
|
|
|
|
|
|
#19 |
|
∂2ω=0
Sep 2002
República de California
22·2,939 Posts |
Up-update: Got one of the newer macros translated to GCC syantx, but while working out various issues with that, encountered something interesting ... I had been using a preprocessor block based on the value of the __LONG_MAX__ predefine to determine whether the OS was 32 or 64-bit. If __LONG_MAX__ was not defined, I instead examined sizeof(long).
That fails under mingw-w64 because even explicitly invokinh the -m64 compile flag, I see __LONG_MAX__ defined as 2147483647, which is the same as 32-bit mode under every "real" linux/GCC install I've ever used. At the same time I do see a __SIZEOF_POINTER__ = 8 predefine which I could use, but that is not predefined for any linux/GCC installs I've used up until now, so this gets messy. Is doing something like sizeof(void *) safe, in the sense of being truly portable? That works fine in non-preprocessor (i.e. regular C) code, but the preprocessor does not like this: Code:
#if(sizeof(void *) == 4) #define OS_BITS 32 #elif(sizeof(void *) == 8) #define OS_BITS 64 #else #error Value of sizeof(void *) not recognized! #endif error: missing binary operator before token "(" Is there a simple, genuinely portable way of doing this detection at preprocessor time? |
|
|
|
|
|
#20 | |
|
"Mark"
Apr 2003
Between here and the
11100101010102 Posts |
Quote:
Look for LONG_MAX instead of __LONG_MAX__ (in limits.h). You should be able to do something like this: #ifdef LONG_MAX #if LONG_MAX == LLONG_MAX #define OS_BITS 64 #else #define OS_BITS 32 #endif #else #error WTF #endif |
|
|
|
|
|
|
#21 | |
|
Mar 2006
10528 Posts |
Quote:
http://www.alexkr.com/pics/ilp32.png You might try to compare the size of a size_t which should be in SIZE_MAX (or __SIZE_MAX__). I'm not sure if this is standard across all gcc implementations, but size_t is supposed to be the same size as the pointer on any given system. I've found a list of some predefined macros on the gcc web site here: http://gcc.gnu.org/onlinedocs/cpp/Co...ed-Macros.html |
|
|
|
|
|
|
#22 | |
|
"Mark"
Apr 2003
Between here and the
1CAA16 Posts |
Quote:
Note that the first line might need to be #if (LONG_MAX == LLONG_MAX) as parenthesis might be required by the pre-processor. |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PauseWhileRunning and running as admin [Win7] | ixfd64 | Software | 8 | 2016-03-14 01:17 |
| Query - Running GIMPS on a 4 way system | Unregistered | Hardware | 6 | 2005-07-04 04:27 |
| Torture Test - System running processor very low compared to other systems | DougTheSlug | Hardware | 5 | 2005-01-27 09:51 |
| Running prime95 and NFSNET together on a HT enabled system | TauCeti | NFSNET Discussion | 1 | 2003-07-02 16:26 |
| How long has your system been running without a reset? | Gary Edstrom | Lounge | 14 | 2003-06-28 15:00 |