39

I've added x64 configuration to my C++ project to compile 64-bit version of my app. Everything looks fine, but compiler gives the following warning:

`cl : Command line warning D9002 : ignoring unknown option '/arch:SSE2'`

Is there SSE2 optimization really not available for 64-bit projects?

Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212
  • Did you figure out with it? For me it' absolutely strange. https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/jj620901%28v%3dvs.110%29 and https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/jj620901%28v%3dvs.110%29 - documentaion is so poor. I completely misunderstand how turn on SSE2,SSE3,SSE4.1, SSE4.2 (in GCC it can be done via -m***) – Konstantin Burlachenko Oct 24 '18 at 12:44
  • I asked question here in this topic, beause I don't know how to specify used SSE* version for code compilation: https://stackoverflow.com/questions/52969655/how-compile-code-with-sse4-2-in-visual-studio-2012-or-2015 – Konstantin Burlachenko Oct 24 '18 at 13:00

3 Answers3

50

Seems to be all 64-bit processors has SSE2. Since compiler option always switched on by default no need to switch it on manually.

From Wikipedia:

SSE instructions: The original AMD64 architecture adopted Intel's SSE and SSE2 as core instructions. SSE3 instructions were added in April 2005. SSE2 replaces the x87 instruction set's IEEE 80-bit precision with the choice of either IEEE 32-bit or 64-bit floating-point mathematics. This provides floating-point operations compatible with many other modern CPUs. The SSE and SSE2 instructions have also been extended to operate on the eight new XMM registers. SSE and SSE2 are available in 32-bit mode in modern x86 processors; however, if they're used in 32-bit programs, those programs will only work on systems with processors that have the feature. This is not an issue in 64-bit programs, as all AMD64 processors have SSE and SSE2, so using SSE and SSE2 instructions instead of x87 instructions does not reduce the set of machines on which x64 programs can be run. SSE and SSE2 are generally faster than, and duplicate most of the features of the traditional x87 instructions, MMX, and 3DNow!.

Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212
  • 4
    yep, SSE2 is the only option in 64-bit mode. The old x87 FPU is no longer available. – jalf Jul 01 '09 at 19:09
  • 4
    It's not an error, it's a warning, and it's there to warn you that the flag isn't doing what you think it's doing. – Ben Hymers Feb 11 '13 at 11:54
  • 1
    It's a bit weird the VS IDE has this option then for x64 projects, if it's an "unknown option". It's still present in VS2015. – Ela782 Dec 29 '15 at 16:23
  • @Ela782: may be it is for not obliging a person to do changes when migrating a project from 32 to 64 bits. – sergiol May 25 '16 at 10:30
5

The compiler option /arch:AVX will not work on old CPUs hence you need to ensure your CPU supports it. I ran into this issues when I had to re-compile the 1.12 tensorflow package for my old Xeon CPU which does not support.

I have switched on /arch:SSE2 (as Kirill) posted above but getting exactly same issue. The Microsoft compiler issues a warning (INFO) that this option will be ignored.

Command line warning D9002 : ignoring unknown option '/arch:SSE2'

From the Microsoft documentation my understanding is that this option is only available on x86 and that does not make sense to me either.

However on MSDN says:

/arch:SSE and /arch:SSE2 are only available when you compile for the x86 platform.

and that SSE is used on x64 anyways. Hence I just removed the option now.

Adam Spalek
  • 71
  • 1
  • 1
  • 2
    SSE2 is baseline for x86-64, so apparently MSVC turns off any options that would set that or lower when compiling for x86-64. – Peter Cordes Nov 04 '18 at 10:15
3

I understand the warning appearing if you choose SSE2, althought its still silly. However you still get the warning if you select /arch:AVX. I'm sure it'll get fixed with SP1. Its just a bit spammy and an annoyance.

Ian
  • 433
  • 3
  • 6