Thanks Bob,
You answered the questions I was about to post.
I'm just wondering though which is more efficient, your '-fprofile-arcs" or Jim's "-fprofile-generate" method?
I also have one question that has not been answered before. Is it possible that a 64 bit program could be compiled in a 32 bit OS without running it? Forgive my ignorance as I have no experience yet with compiling in 64 bit programs.
GCC Compiling
Moderator: Ras
-
Edsel Apostol
- Posts: 803
- Joined: Mon Jul 17, 2006 5:53 am
- Full name: Edsel Apostol
Re: GCC Compiling
Edsel Apostol
https://github.com/ed-apostol/InvictusChess
https://github.com/ed-apostol/InvictusChess
-
Jim Ablett
- Posts: 2366
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: GCC Compiling
Hi Edsel,Is it possible that a 64 bit program could be compiled in a 32 bit OS without running it?
I can answer that question because I did it for the first 64-bit sloppy compile.
On the mingw64 page you will find a version which runs on 32 bit processor/ 32 bit environment.
You can successfully compile 64 bit version, but downside side you won't be able to test it or run it in 32 bit os,
so you would have to send to somebody else whose got 64 bit os to test it.
Jim.
-
Edsel Apostol
- Posts: 803
- Joined: Mon Jul 17, 2006 5:53 am
- Full name: Edsel Apostol
Re: GCC Compiling
Thanks once again Jim!
My tester has a 64 bit OS so that's not a problem.
My tester has a 64 bit OS so that's not a problem.
Edsel Apostol
https://github.com/ed-apostol/InvictusChess
https://github.com/ed-apostol/InvictusChess
-
Aleks Peshkov
- Posts: 958
- Joined: Sun Nov 19, 2006 9:16 pm
- Location: Russia
- Full name: Aleks Peshkov
Re: GCC Compiling
It depends, my program is 30% faster in GCC, because I can order GCC to inline code much more aggressively.Jim Ablett wrote:Just using msvc in instead of gcc could give you an extra 30% maybe more.
Another example: I cannot make Visual C++ good use of x86 assembler bit test (bt, btc, bts, btr) instructions both in intrinsics and in inline assembler forms.
-
Jim Ablett
- Posts: 2366
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: GCC Compiling
Hi Aleks,Aleks Peshkov wrote:It depends, my program is 30% faster in GCC, because I can order GCC to inline code much more aggressively.Jim Ablett wrote:Just using msvc in instead of gcc could give you an extra 30% maybe more.
Another example: I cannot make Visual C++ good use of x86 assembler bit test (bt, btc, bts, btr) instructions both in intrinsics and in inline assembler forms.
Your program may be an exception rather than a rule here. My straight gcc chess engine compiles (no hand tuning) are almost without exception at least 30% slower than my equivalent Intel/mscv compiles. I can only think of one engine I've compiled , Phalanx where the speed was the same.
Jim.
-
Aleks Peshkov
- Posts: 958
- Joined: Sun Nov 19, 2006 9:16 pm
- Location: Russia
- Full name: Aleks Peshkov
Re: GCC Compiling
I use -Wdisabled-optimization -Winline for GCC and it helps much to control the shape of builded code.
-
wgarvin
- Posts: 838
- Joined: Thu Jul 05, 2007 5:03 pm
- Location: British Columbia, Canada
Re: GCC Compiling
By the way, you can force MSVC to inline code with a compiler-specific extension:Aleks Peshkov wrote:It depends, my program is 30% faster in GCC, because I can order GCC to inline code much more aggressively.Jim Ablett wrote:Just using msvc in instead of gcc could give you an extra 30% maybe more.
Another example: I cannot make Visual C++ good use of x86 assembler bit test (bt, btc, bts, btr) instructions both in intrinsics and in inline assembler forms.
Code: Select all
#define FORCE_INLINE __forceinline
FORCE_INLINE void Foo() { }Code: Select all
#define FORCE_INLINE __inline__ __attribute__((always_inline))
FORCE_INLINE void Foo() { }...Unfortunately, I don't know of a convenient way to force either compiler NOT to inline code, other than to put the function definition in another .cpp file which the compiler doesn't get to see before it sees the call site. So that's what I do when I need that behaviour, even though its a bit inconvenient.
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: GCC Compiling
I am not sure what profile-generate does that is different from the option I gave... but I will try to investigate it to find out...Edsel Apostol wrote:Thanks Bob,
You answered the questions I was about to post.
I'm just wondering though which is more efficient, your '-fprofile-arcs" or Jim's "-fprofile-generate" method?
I also have one question that has not been answered before. Is it possible that a 64 bit program could be compiled in a 32 bit OS without running it? Forgive my ignorance as I have no experience yet with compiling in 64 bit programs.