Hello, > -----Original Message----- > From: Martin Jambor <[email protected]> > Sent: Monday, September 29, 2025 5:16 PM > To: Kalvakuntla, Umesh <[email protected]>; gcc- > [email protected] > Cc: Gopalasubramanian, Ganesh <[email protected]>; Jan > Hubicka <[email protected]> > Subject: RE: [PATCH] [X86] Fixes for AMD znver5 enablement > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Hello, > > On Fri, Sep 26 2025, Kalvakuntla, Umesh wrote: > > [AMD Official Use Only - AMD Internal Distribution Only] > > > > Hello Martin, > > > > Can you please commit this? I don't have the required rights. > > Honza is in favor, so I think I can. Can you please write the corresponding > ChangeLog and provide information how the patch has been tested?
Tested the patch with below command on znver5 machine: $ gcc -Q -march=native --help=target | grep prefetchi -mprefetchi [enabled] Model numbers are updated as per specification. Updated patch with Changelog : --- gcc/ChangeLog | 7 +++++++ gcc/common/config/i386/cpuinfo.h | 12 +++++++++++- gcc/config/i386/cpuid.h | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63fd0f27d03..60a8a1af697 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2025-09-29 Umesh Kalvakuntla <[email protected]> + + * common/config/i386/cpuinfo.h (get_amd_cpu): + Fix znver5 family model numbers. + (get_available_features): Set FEATURE_PREFETCHI for bit_AMD_PREFETCHI. + * config/i386/cpuid.h (bit_AMD_PREFETCHI): New Macro. + 2025-09-28 liuhongt <[email protected]> PR target/121970 diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index c93ea07239a..3f29f17e2a5 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -312,7 +312,8 @@ get_amd_cpu (struct __processor_model *cpu_model, break; case 0x1a: cpu_model->__cpu_type = AMDFAM1AH; - if (model <= 0x77) + if (model <= 0x4f || (model >= 0x60 && model <= 0x77) || + (model >= 0xd0 && model <= 0xd7)) { cpu = "znver5"; CHECK___builtin_cpu_is ("znver5"); @@ -1102,6 +1103,15 @@ get_available_features (struct __processor_model *cpu_model, set_feature (FEATURE_WBNOINVD); } + if (ext_level >= 0x80000021) + { + __cpuid (0x80000021, eax, ebx, ecx, edx); + if (eax & bit_AMD_PREFETCHI) + { + set_feature (FEATURE_PREFETCHI); + } + } + #undef set_feature } diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index afd4ef06e9f..dac01d887f1 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -72,6 +72,10 @@ #define bit_CLZERO (1 << 0) #define bit_WBNOINVD (1 << 9) +/* Extended Features (%eax == 0x80000021) */ +/* %eax */ +#define bit_AMD_PREFETCHI (1 << 20) + /* Extended Features Leaf (%eax == 7, %ecx == 0) */ /* %ebx */ #define bit_FSGSBASE (1 << 0) -- 2.43.0 Thanks, Umesh
