71 ms·
Doesn't -O2 still exclude any CPU features from the past ~15 years (like AVX). If you know the architecture and oldest CPU model, we're better served with adde
by alberth 10mo ago
Doesn't -O2 still exclude any CPU features from the past ~15 years (like AVX).
If you know the architecture and oldest CPU model, we're better served with added a bunch more flags, no?
I wish I could compile my server code to target CPU released on/after a particular date like:
-O2 -cpu-newer-than=2019
- SubjectToChange 10mo agoA CPU produced after a certain date is not guaranteed to have the every ISA extension, e.g. SVE for Arm chips. Hence things like the microarchitecure levels for x86-64.
- cogman10 10mo agoFor x86 it's a pretty good guarantee.
- teo_zero 10mo agoI don't understand if your comment is ironic. Intel is notorious for equipping different processors produced in the same period with different features. Sometimes even among different cores on the same chip. Sometimes later products have less features enabled (see e.g. AVX512 for Alder Lake).
- cogman10 10mo agoIt's not an -O2 thing. Rather it's a -march thing. -O2 in gcc has vectorization flags set which will use avx if the target CPU supports it. It is less aggressive on vectorization than -O3.
- singron 10mo agoYou can use x86_64-v2 or x86_64-v3. Dates are tricky since cpu features aren't included on all SKUs from all manufacturers on a certain date.