-
April 30th, 2015, 05:53 AM
#1
Compiling on an x86 CPU
I'm compiling some open source code (originally written for Linux / gcc) which uses the following line to determine if a particular section is being compiled for an x86 processor:-
Code:
#if ( defined(__x86_64__) || defined(__i386__) )
Sadly, neither of those seems to be defined by my ageing compiler (VC++ 8.0). What would be the equivalent for building with VC8 ?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
April 30th, 2015, 07:41 AM
#2
Re: Compiling on an x86 CPU
not that used to defines on gcc.
but I would guess....
for __x86_64__
-> _WIN64
the second not entirely sure, depends on meaning if it specifies the target (which it propbably does) machine
then
_M_IX86 >= 300
which will always be the case for VS (if it's not _WIN64) since it can't target anything less than a 386.
-
April 30th, 2015, 08:55 AM
#3
Re: Compiling on an x86 CPU
Thanks OReubens. Something occurred to me just after I posted - am I right in thinking that MSVC can only target the x86 architecture? If so, I guess I could just test for _MSC_VER
[Edit...] No, I think I'm wrong about that. It seems like ARM processors are also supported (and possibly others).
However, I discovered one called _M_X64. So perhaps a combination of _M_X64 and _M_IX86 might do the trick ?
Last edited by John E; April 30th, 2015 at 09:20 AM.
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
April 30th, 2015, 11:48 AM
#4
Re: Compiling on an x86 CPU
-
May 1st, 2015, 02:36 AM
#5
Re: Compiling on an x86 CPU
That's a really interesting list. Thanks for finding it.!
What's Itanium BTW?? I only ever hear it mentioned in relation to servers so I've never been 100% certain. Is it related to x86 or something entirely different? For example, my PC uses an Intel Core 2 Duo (which I regard as part of the x86 family). But I'm pretty sure it would run a 64-bit OS. So does that make it an Itanium chip - or is Itanium totally different?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
May 1st, 2015, 11:04 AM
#6
Re: Compiling on an x86 CPU
Totally different. Normal 64bit is what that site calls "AMD64".
https://en.wikipedia.org/wiki/Itanium
gg
-
May 4th, 2015, 06:56 AM
#7
Re: Compiling on an x86 CPU
The itanium is a RISC based 64-bit processor jointly developed by then DEC (now HP) and Intel.
It is NOT x86, though it did have a means to efficiently run x86 code in a VM hosted in the OS.
Microsoft recently announced it would no longer support the itanium in upcoming versions of Windows.
Which pretty much means an end of the line for the itanium as a whole.
THe itanium never was a good seller and all companies involved essentially pumped lots of money into the project. But other technologies caught up with the hole the itanium was intended to plug, such as x64, multi cores , hyperthreading, increasing speeds, internal pipelining etc etc etc. So while a lot of promise on paper, the itanium was Always sort of limping behind the more consumer oriented CPU's that got more attention and optimisations due to being moneymakers whereas the itanium never was.
It looks as though MS is finding more solace in supporting the ARM, which is/was already popular in units sold (pretty much every mobile device, as well as a lot of applicances like TV's, Dvd's, dishwashers... use arm's), but is now rapidly moving ahead in supported CPU clockspeeds, and the latest version of the ARM instruction set is getting instructions to (better) support more complex OSes like WIndows and Unix.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|