I struggle to see the exact division between the compiler options -march, -m, -arch and -x
What I got so far: using -x will generate code that only runs on Intel CPUs. E.g. using -xCORE-AVX2 will produce code that does not run on non-Intel CPUs, regardless of the instruction sets these CPUs claim to be capable of. Am I right so far?
Now for -m and -march, I got them to produce code that runs on nun-Intel CPUs. But where exactly do these two options differ? Is it only a different set of supported instruction sets? For example, I can't find an equivalent option for -mavx in the list of -march arguments. Vice-versa, I find no equivalent for -march=core-avx2 in the list of -m arguments.
I guess this boils down to 2 questions from my side:
1) What exactly is the difference between -m and -march and -arch?
2) Since both -m and -march produce code that runs on non-Intel CPUs, can I be sure that the instruction set will actually be used?