CPU -> OS -> Compiler for 64-bit programs.

Discussion of chess software programming and technical issues.

Moderator: Ras

TL

CPU -> OS -> Compiler for 64-bit programs.

Post by TL »

Hello.

Can someone explain the relation of the CPU to Operting System to Compiler and how it relates to compiling for 64-bit programs.

I have a Dell laptop with Windows XP Pro and it compiles 32-bit using MSVC and nmake.exe but I'd like to eventually compile programs for 64-bit. Which CPUs support 64-bit and which do not? I have a P4. Do all pentiums support 64-bit? Can I just install Windows XP 64-bit? I know there is an AMD64, does that mean all other AMD do not support 64 bit instructions?

I've never used unix/linux. Does the gcc compiler already support 64-bit compiles or would I need to buy software for that?

Lastly, can you recommend software to compile 64-bit on windows? The latest MSVC?

TL
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by sje »

Earlier versions of the Pentium IV do not support 64 bit operation.

You do not have to pay for any Linux/GNU software; it can all be had for free from the net.

If you want to continue to use XP, you might want to try the cygwin Linux system running as an application. It's not as good as a native Unix/Linux, but it's still quite decent and it's actively supported.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by bob »

TL wrote:Hello.

Can someone explain the relation of the CPU to Operting System to Compiler and how it relates to compiling for 64-bit programs.

I have a Dell laptop with Windows XP Pro and it compiles 32-bit using MSVC and nmake.exe but I'd like to eventually compile programs for 64-bit. Which CPUs support 64-bit and which do not? I have a P4. Do all pentiums support 64-bit? Can I just install Windows XP 64-bit? I know there is an AMD64, does that mean all other AMD do not support 64 bit instructions?

I've never used unix/linux. Does the gcc compiler already support 64-bit compiles or would I need to buy software for that?

Lastly, can you recommend software to compile 64-bit on windows? The latest MSVC?

TL
Several issues.

1. All current Intel and AMD processors will run 32 bit or 64 bit, so that is not going to be an issue. To get a 32 bit processor, for Intel you would have to back up to a PIV. For AMD you can forget about it.

2. To use 64 bit mode, the operating system has to know about it. There are extra registers that have to be saved/restored on context switches, 64 bit memory addressing is done differently with respect to the virtual memory management part of the operating system, etc. If you run a pure 32 bit operating system, then the processor will only run in 32 bit mode and there is no way to get to the new features. You will still have 64 bit registers, but you can't access the extra 8 that are present in a 64 bit environment. So you do gain something by running on a 64 bit processor, but without a 64 bit operating system, you don't gain a lot.

3. To compile you need a 64 bit compiler. if you are set on running windows, then 64 bit MSVC is one choice, or the 64 bit Intel C Compiler (not free either) is the other. Or gcc which is free will work fine. If you run unix (linux) then there are tons of 64 bit distributions around, and then the free (for linux only, non-commercial applications) Intel C++ compiler is the way to go.
jdart
Posts: 4408
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by jdart »

<To get a 32 bit processor, for Intel you would have to back up to a PIV. For AMD you can forget about it.>

Some P4 era chips had 64-bit support (Xeons for example) but I don't think the consumer grade P4s did. You can find details here: http://www.intel.com/products/processor ... /index.htm.

If your particular chip doesn't have 64-bit support (aka EM64T) you need to think about a CPU upgrade (could be costly because other components will need replacement also) or a new system. If you are not picky about having the fastest system then you can pick up an older 64-bit server (Opteron or P4 Xeon) pretty cheap. I was in a local surplus shop recently and saw stacks of them.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by Carey »

bob wrote: 3. To compile you need a 64 bit compiler. if you are set on running windows, then 64 bit MSVC is one choice, or the 64 bit Intel C Compiler (not free either) is the other. Or gcc which is free will work fine.
For windows, I don't believe there is a stable 64 bit version of GNU C available. GNU C for windows is pretty far behind the times compared to Linux.

I've heard that you can use the free MS VC+ Express compilers with the PSDK to generate 64 bit binaries.

I don't know if that still works for the MSVC2008 Express versions or not.

And I'm not running a 64 bit OS (no stable Win64 bit drivers for my laptop and never will be), so I can't give any more info than what I've heard.
jdart
Posts: 4408
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by jdart »

Only Visual Studio 2008 Standard and Professional editions (not VC++ Express) support 64-bit targets.

--Jon
User avatar
xsadar
Posts: 147
Joined: Wed Jun 06, 2007 10:01 am
Location: United States
Full name: Mike Leany

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by xsadar »

jdart wrote:Only Visual Studio 2008 Standard and Professional editions (not VC++ Express) support 64-bit targets.

--Jon
Visual Studio 2005 Professional also has 64-bit capability (and I think standard does too, but am not certain of that). It's not a well advertised feature and does take a little effort to get it working (which is probably why it's not advertised so much), but it is there.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by Carey »

jdart wrote:Only Visual Studio 2008 Standard and Professional editions (not VC++ Express) support 64-bit targets.

--Jon
Not VSC++ itself, but the Platform SDK supposedly does.

With the older version of MSVC Express, that was the part you had to install seperately so that it could generate native code instead of the .net junk. A 64 bit compiler back end was included.

Here's the quote from the PSDK description.
Microsoft® Windows Server 2003 R2 Platform SDK - March 2006 Edition
The Platform SDK for Microsoft® Windows® Server 2003 R2 contains the information and tools you need to develop Windows-based applications. You can use this SDK to develop both 32- and 64-bit applications.
(Note: There are newer versions. That just happens to be one I found first. This was used with the previous version of MSVC++ Express. I think they've changed the name, too.)

So once the PSDK was properly installed, Visual Studio Express used the PSDK to actually generate the code instead of its own back end. Therefor, if you turned on the 64 bit stuff in the PSDK, you'd get 64 bit compiled code.

I've heard people talk about it working, but I haven't tried it. My brief experience with Win64 was disapointing due to buggy hardware drivers with no hope of them ever being updated. (My laptop vendor doesn't support Win64 on this model. They provide one set of drivers only because Microsoft requires it as part of vista certification.)

I don't know about the currently available version of Visual Studio Express though. I think they changed it so it can generate native code and you don't need the PSDK, so it might not work anymore.

(I don't use the current version of VSC++ Express.)
plattyaj

Re: CPU -> OS -> Compiler for 64-bit programs.

Post by plattyaj »

Carey wrote:I don't know about the currently available version of Visual Studio Express though. I think they changed it so it can generate native code and you don't need the PSDK, so it might not work anymore.
I use Visual Studio Express 2008 (e.g. the latest one) and I can confirm that the PSDK is not needed and that there are no configuration hacks needed to enable native compiles.

What I haven't done (yet) is to install a PSDK and see if I can get the 64 bit cl working with VSE 2008. I just got a new laptop with 64 bit Vista; prior to that compiling a 64 bit version had little value to me because I would have had nowhere to run it!

Andy.