2

I have a question regarding compiling a build of x264 on GCC.

x264 has assembly code dealing with instruction sets such as SSE3 and SSSE3 and by default has auto-vectorization disabled in the makefile.

Should I compile it with the -mssse3 flag anyways or could that actually cause a loss in performance?

And does -mssse3 imply -msse3 or is SSE3 separate from SSSE3?

Philos
  • 37
  • 4
  • The answer to the last part is yes, `-mssse3` implies `-msse3`. This is true in general for all the different levels of SSE, i.e. level N implies all levels up to N. – Paul R Jul 19 '12 at 11:22

1 Answers1

1

The -m<isa> flag tells the compiler what instructions to use in the code that it generates. It does not affect inline assembly that just gets further passed unmodified to the assembler not does it affect assembly (.s) files compiled separately. Compiling with SSSE3 and without automatic vectorisation is pointless as SSE is all about vectorisation, although it also can be used to perform scalar floating-point operations.

Hristo Iliev
  • 72,659
  • 12
  • 135
  • 186
  • Not necessarily - the compiler flag also sets predefined macros, e.g. `-msse3` typically causes `__SSE__`, `__SSE2__` and `__SSE3__` to be defined, so if there is appropriately `#ifdef`'d code in the project then this will get compiled or not depending on the compiler switches. – Paul R Jul 19 '12 at 13:18
  • My point is that it is not an error to compile code with inline assembly that uses SSSE3 instructions without `-mssse3` being specified. Of course ISA flags could influence conditional compilation but not in the case when CPU detection is done at run-time (as is the case with most codecs). – Hristo Iliev Jul 19 '12 at 13:28