https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78762
--- Comment #20 from Peter Cordes <pcordes at gmail dot com> --- This specific bug only got fixed by making tune=generic not care about Sandybridge or Bulldozer-family anymore, rather than by having -mtune=generic actually be aware of options like -mavx2. It still would be nice to have a general mechanism for -mtune=generic choices to be based on ISA selection via options like -mavx512f ruling out certain uarches. Maybe with -mtune=generic-isa so it's an opt-in thing, at least at first. Right now on x86 there aren't any huge potholes we work around in tune=generic for certain uarches in a way that makes it slower on on newer uarches, but that has been the case in the past and could be the case in the future again sometime. Splitting unaligned loads / stores was a more significant case than most. My comments on bug 80568 (marked as a duplicate) discussed some hand-wavy possibilities for how that kind of thing might work, like having certain tuning options marked as workarounds which should get disabled by certain ISA options. e.g. the old rep ret tuning for old AMD branch predictors could get disabled by -mavx or sse4. This specific bug still happens if you use -mtune=sandybridge -mavx2 so it could be argued that it's not even fixed. (IDK why anyone would use that tuning option on purpose, since first-gen sandy/ivy bridge doesn't support AVX2, only AVX1. So it's vastly less relevant after the change to generic tuning.)
