各种版本的Visual Studio的最低目标CPU体系结构是什么? [英] What is the minimum target CPU architecture for the various versions of Visual Studio?

查看:252
本文介绍了各种版本的Visual Studio的最低目标CPU体系结构是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个版本的Visual Studio 2008、2010和2012支持的最低目标处理器体系结构(用_M_IX86预定义宏指示)是什么?

What is the minimum target processor architecture (indicated with _M_IX86 predefined macros) supported by every version of Visual Studio 2008, 2010 and 2012?

例如,MSVS 2012仅支持Pentium Pro和更高版本.

For example, MSVS 2012 supports only Pentium Pro and higher.

推荐答案

对此的经典选择是/G.对于不同版本的编译器,可用选项有所不同(新版本删除了旧选项,尽管出于兼容性原因继续接受它们).这就是你得到的:

The classic switch for this was /G. Your available options differed for different versions of the compiler (with newer versions dropping older options, albeit continuing to accept them for compatibility reasons). Here's what you got:

  • /G3构建的代码已针对386处理器进行了优化(_M_IX86设置为300)
  • 486处理器的
  • /G4(_M_IX86设置为400)
  • 为奔腾(_M_IX86设置为500)优化的
  • /G5内置代码
  • /G6构建的代码已针对Pentium Pro,II和III(_M_IX86设置为600)进行了优化.
  • 为Pentium 4或AMD Athlon(_M_IX86设置为700)优化的
  • /G7内置代码.

  • /G3 built code that was optimized for 386 processors (_M_IX86 was set to 300)
  • /G4 for the 486 processor (_M_IX86 was set to 400)
  • /G5 built code that was optimized for the Pentium (_M_IX86 was set to 500)
  • /G6 built code that was optimized for the Pentium Pro, II, and III (_M_IX86 was set to 600)
  • /G7 built code that was optimized for the Pentium 4 or AMD Athlon (_M_IX86 was set to 700)

/GB指定了混合"模式或发布该版本编译器时合理的最低公分母.如果未指定其他选项,则这是默认选项.

/GB specified either "blend" mode or the lowest common denominator that was reasonable when that version of the compiler was released. This was the default option if no other was specified.

当然,需要明确提及的是,设置此选项以针对较新的处理器体系结构进行优化不会阻止您的代码在较旧的处理器体系结构上运行.只是尚未对该架构进行优化,并且运行速度可能会更慢.

And of course, it bears explicit mention that setting this option to optimize for a newer processor architecture did not prevent your code from running on an older processor architecture. It just wasn't optimized for that architecture and might run more slowly.

但是,如果您在文档的当前版本中查找此编译器选项,,您不会看到任何提及.您所看到的只是关于Itanium处理器的内容(我们将放在一边).这是因为随VC ++ 2005一起提供的编译器完全放弃了/G3/G7编译器选项 :

However, if you look up this compiler option in a current version of the documentation, you'll see no mention of any of this. All you see is something about Itanium processors (which we'll put aside). That's because the compiler shipping with VC++ 2005 dropped the /G3/G7 compiler options altogether:

[The] /G3/G4/G5/G6/G7/GB编译器选项已被删除.编译器现在使用混合模型",该模型试图为所有体系结构创建最佳输出文件.

[The] /G3, /G4, /G5, /G6, /G7, and /GB compiler options have been removed. The compiler now uses a "blended model" that attempts to create the best output file for all architectures.

因此,尽管我们中的许多人都从VC ++ 6很好地记住了这一点,但是即使在VC ++ 2008之前,这种代码生成设置还是有历史的好奇心.因此,我不确定您会从哪里得到VS 2012仅支持VC 2012的印象.奔腾Pro.我在官方文档的任何地方或在线其他地方都找不到提到的内容.编译器版本2012的限制因素不是处理器体系结构,而是操作系统版本.如果您已经修补了编译器,库和所有其他附件,以支持针对Windows XP,那么您将能够在原始的Pentium-233上运行您的应用程序,并在其上随意安装了Windows XP.

So, although many of us remember it well from VC++ 6, this code generation setting was a historical curiosity only even as far back as VC++ 2008. Therefore I'm not sure where you get the impression that VS 2012 supports only the Pentium Pro. I can't find mention of that anywhere in the official documentation or elsewhere online. The limiting factor for version 2012 of the compiler is not the processor architecture but the OS version. If you've patched the compiler, libraries, and all the other accoutrements to support targeting Windows XP, then you will be able to run your application on an original Pentium-233, onto which you've masochistically shoe-horned Windows XP.

_M_IX86宏的用途实际上只是一个指标,表明您所针对的是Intel IA-32处理器家族(通常称为老式32位x86),而不是其他受支持的目标体系结构之一,例如_M_AMD64对于64位x86.您现在应该将其视为已定义/未定义的值.

The purpose of the _M_IX86 macro is really just an indicator that you're targeting the Intel IA-32 processor family—more commonly known as good old 32-bit x86—in contrast to one of the other supported target architectures, like _M_AMD64 for 64-bit x86. You should just treat it as a defined/undefined value now.

是的,_M_IX86的旧值表仍出现在最新版本的预处理器文档中,但是它已经完全过时了.您会注意到那里也出现了其他过时的符号,例如_M_PPC:PowerPC编译器随附的MSVC ++的最新版本是什么? 4.2?

Yes, the old table of values for _M_IX86 still appears in the latest version of the preprocessor documentation, but it is utterly obsolete. You'll note that other obsolete symbols appear there as well, such as _M_PPC: what was the last version of MSVC++ that shipped with a PowerPC compiler? 4.2?

但这只是故事的一部分.还有其他一些编译器选项可以控制有关目标体系结构的代码生成.

But that is only part of the story. There are still other compiler options that govern code generation with respect to target architectures.

例如,/arch开关.在文档的最新版本中,您可以使用以下选项:

For example, the /arch switch. From the latest version of the documentation, you have the following options:

  • /arch:IA32本质上设置了最小公分母,使用x87表示浮点数
  • /arch:SSE会打开SSE指令
  • /arch:SSE2会打开SSE2指令(对于x86是默认)
  • /arch:AVX可以打开英特尔高级矢量扩展
  • /arch:AVX2会打开Intel Advanced Vector Extensions 2

  • /arch:IA32 which essentially sets the lowest common denominator, using x87 for floating point
  • /arch:SSE which turns on SSE instructions
  • /arch:SSE2 which turns on SSE2 instructions (and is the default for x86)
  • /arch:AVX which turns on Intel Advanced Vector Extensions
  • /arch:AVX2 which turns on Intel Advanced Vector Extensions 2

如果阅读备注"部分,您还将看到这些选项不仅意味着指定的指令集,还意味着更多的隐含含义.例如,由于所有支持SSE指令的处理器也都支持CMOV指令,因此当指定/arch:SSE或更高版本时,将生成CMOV指令. CMOV指令与SSE无关.实际上,SSE是在Pentium III中引入的,而CMOV是在Pentium Pro中引入的.但是可以保证任何支持SSE的体系结构都将支持它.

If you read the Remarks section, you'll also see that these options can imply more than just the specified instruction set. For example, since all processors that support SSE instructions also support the CMOV instruction, the CMOV instruction will be generated when /arch:SSE or higher is specified. The CMOV instruction has nothing to do with SSE; in fact, SSE was introduced with the Pentium III while CMOV was introduced way back with the Pentium Pro. But it's guaranteed to be supported on any architectures that support SSE.

另一个相关选项由/favor开关控制.这是从VC ++ 2008开始的新功能,大概是旧的/G3/G7选项的替代品.正如文档所述:

The other relevant option is controlled by the /favor switch. This was new starting with VC++ 2008, and was presumably the replacement for the old /G3/G7 options. As the documentation says:

  • /favor:blend是默认设置,并且会生成没有独特优化的代码
  • /favor:INTEL64生成特定于英特尔x86-64实现的代码
  • /favor:AMD64生成特定于AMD x86-64实现的代码
  • /favor:ATOM生成特定于英特尔Atom处理器的代码
  • /favor:blend is the default and produces code with no unique optimizations
  • /favor:INTEL64 generates code specific for Intel's implementation of x86-64
  • /favor:AMD64 generates code specific for AMD's implementation of x86-64
  • /favor:ATOM generates code specific for Intel's Atom processor

这篇关于各种版本的Visual Studio的最低目标CPU体系结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆