Can clang-cl use /tune:cpu with MSVC, similar to -mtune=cpu on other platforms?

I’m incredibly happy with using clang-cl with Microsoft Visual Studio! It is really awesome work!

Now we have a use case where I’m not sure if this is covered? We need to target a sandybridge CPU for our software, but it gives poor performance on more modern CPUs with AVX2, so I’d like to use the equivalent of -march / -mtune. But I need it for clang-cl as a frontend of Microsoft Visual Studio.

Is that possible, does clang or clang-cl support tuning for a second CPU on top of -march=xxx?

I found ⚙ D86820 [X86] Add a /tune: option for clang-cl and it mentions /tune:haswell. I tested it and clang-cl happily accepts the option without build error. But I’m not sure if my code is now any different, at least binary size did almost not change…

clang-cl /tune:x is equivalent to clang -mtune=x
But it sounds like maybe it’s not enough?

You should also be able to parse an -march flag to clang-cl using: /clang:-march=y. Does that help?

Currently I am using -march=sandybridge /tune:skylake, but I’m under the impression that my code is much slower than before, when I was using only -march=skylake. However I do not even have good ground truth to compare to! I was hoping someone here could tell me what works, because I can mostly test this in my continuous integration setup, and that is slow and cumbersome…