How to test if your Linux Support SSE2

neversaint picture neversaint · Nov 17, 2010 · Viewed 22.1k times · Source

Actually I have 2 questions:

  1. Is SSE2 Compatibility a CPU issue or Compiler issue?
  2. How to check if your CPU or Compiler support SSE2?

I am using GCC Version:

gcc (GCC) 4.5.1

When I tried to compile a code it give me this error:

$ gcc -O3 -msse2 -fno-strict-aliasing -DHAVE_SSE2=1 -DMEXP=19937 -o test-sse2-M19937 test.c
cc1: error: unrecognized command line option "-msse2"

And cpuinfo showed this:

processor  : 0
vendor     : GenuineIntel
arch       : IA-64
family     : 32
model      : 1
model name : Dual-Core Intel(R) Itanium(R) Processor 9140M
revision   : 1
archrev    : 0
features   : branchlong, 16-byte atomic ops
cpu number : 0
cpu regs   : 4
cpu MHz    : 1669.000503
itc MHz    : 416.875000
BogoMIPS   : 3325.95
siblings   : 2
physical id: 0
core id    : 0
thread id  : 0

Answer

Gunther Piez picture Gunther Piez · Nov 17, 2010

The CPU needs to be able to execute SSE2 instrcutions, and the compiler needs to be able to generate them.

To check if your cpu supports SSE2:

# cat /proc/cpuinfo

It will be somewhere under "flags" if it is supported.

Update: So you cpu doesn't support it.

For the compiler:

# gcc -dumpmachine
# gcc --version

Target of your compiler needs to a kind of x86*, since only this cpus support sse2, which is part of the x86 instruction set

AND

gcc version needs to be >= 3.1 (most likely, since this is about 10 years old or something) for supporting SSE2.

Update: So your compiler doesn't support it on this target, it will if you are using it as a cross compiler for x86.