https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98361
Bug ID: 98361 Summary: L1/L2 cache characteristics not recognized with -mtune=znver2 Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sdack at gmx dot com Target Milestone: --- Hello, I've come across an unexpected behaviour of gcc and wanted to ask for help. I've noticed that when I specify '-march=znver2' does gcc use the incorrect values for the L1/L2 cache. Only when '-march=native' was used and gcc detected the CPU at run-time does it use the correct values. For example on a Ryzen 7 3800X (a Zen 2 CPU): $ gcc -march=znver2 --help=params -Q|fgrep cache --param=l1-cache-line-size= 32 --param=l1-cache-size= 64 --param=l2-cache-size= 512 versus: $ gcc -march=native --help=params -Q|fgrep cache --param=l1-cache-line-size= 64 --param=l1-cache-size= 32 --param=l2-cache-size= 512 GCC does detect the CPU as 'znver2': $ gcc -march=native --help=target -Q|fgrep march -march= znver2 I've also verified this behaviour with '-mtune=znver2', and again does GCC only use the correct values when it uses auto-detection. Why does GCC not use the correct L1/L2 cache values when '-march=znver2' or '-mtune=znver2' is specified? Sven PS: I've now also checked parts of the gcc source code and gcc/config/i386/x86-tune-costs.h (around line 1557) does hold the correct values and it appears these only don't get used somehow.