3 ms·
> The whole point of using C++ in 2018 is to have control over memory layout and CPU instructions emitted. Memory layout, yes. CPU instructions emitted? Not s
by inetknght 5y ago
> The whole point of using C++ in 2018 is to have control over memory layout and CPU instructions emitted.
Memory layout, yes.
CPU instructions emitted? Not so much.
- jcelerier 5y agoI really disagree, on some of my use cases I measured the difference between -O3 (sse2) and -O3 -march=native (avx2) to be 30-to-50-ish percent faster
- Quekid5 5y agoThat's as may be, but nowhere in your program does it say that it should use either sse2 or avx2, which was the parent poster's point. At least that's what I understood it to be. Technically you could have different code paths and inline asm, but that's not really specified by the C++ standard either.
- inetknght 5y agoI've found that `-march=native` with _any_ optimization level will almost always result in faster code. However, that faster code isn't always backwards-compatible to older generation hardware. And, where it is backwards-compatible, it can actually be slower.