All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...

Thursday 8 May 2008

How to determine if you program is using MMX, SSE and SSE2 extensions on Linux with GCC

1. compile for your particular processor, generating assembly files. Just use your normal compile command line and add -S and -march=
g++  -g -Wall -march=pentium4 -O2 -S -I.. *.cc
2. search through the .s files for the new instructions and xmm registers listed on this page: http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions
eg.
fgrep "movss" *.s  | grep -v "\.string" -
fgrep "xmm" *.s  | grep -v "\.string" -

I found that it used xmm0 now and then but only used a couple of the new instructions a couple of times.
It makes me wonder if this will make it slower because it has to save the extra registers on to the stack every time. I can only assume GCC is smart enough so it knows it doesn't have to do this.

No comments:

tim's shared items

Add to Google Reader or Homepage