Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference among cflgs sse options of -msse, -msse2, -mssse3, -msse4 rtc..? and how to determine?

Tags:

For the GCC CFLAGS options: -msse, -msse2, -mssse3, -msse4, -msse4.1, -msse4.2. Are they exclusive in their use or can they be used together?

My understanding is that the choosing which to set depends on whether the target arch, which the program will run on, supports it or not - is this correct?

If so, how could I know what sse my target arch supports? In Linux, I cat /proc/cpuinfo, but what if Mac or Windows?

Thanks!

like image 302
yaya Avatar asked May 21 '12 13:05

yaya


People also ask

Why is it important to use the standard flags variables?

Another reason is that these flags are standardized and have been used for a long time, so anyone building your software will expect you to use these flags. Using any other variable would force them to go through your makefile in order to figure out which variable is being used.

What is cppFlags?

cppFlags(vararg cppFlags: String) Specifies flags for the C++ compiler. abstract Unit. targets(vararg targets: String) Specifies the library and executable targets from your CMake project that Gradle should build.

What is Janus WebRTC?

Janus is an open source, general purpose, WebRTC server designed and developed by Meetecho. This version of the server is tailored for Linux systems, although it can be compiled for, and installed on, MacOS machines as well.

What is $( CC in Makefile?

$(CC) -o executablename fileA.o fileB.o fileC.o -lm. This is a dependency and it means that the target "myprogram" should invoke the compiler whenever fileA.o, fileB.o, or fileC.o change. In particular, it invokes the compiler referred to in the variable "CC" and creates an executable called "executablename".


1 Answers

The -m switched can be used in parallel, furthermore some of them are implied by the architecture or other switches. For instance, if you build code for x86_64, -msse -msse2 is always enabled.

For code intended to run on your system you should choose -march=native, which will select what is available on your processor. For instance, if you have a Sandy Bridge, this will enable -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx.

If you want to specify in detail which instruction set to use, you should only use what is available, not always the "latest". The "latest" one is currently -mavx2, which I don't recommend: The first processor which will support it will be available in 2013.

like image 174
Gunther Piez Avatar answered Sep 25 '22 20:09

Gunther Piez