From: Hu, Lin1 Date: Mon, 27 Nov 2023 03:28:00 +0000 (+0800) Subject: i386: Fix CPUID of USER_MSR. X-Git-Tag: basepoints/gcc-15~4038 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88029286c35d3bf65568fea1324d595a15441772;p=thirdparty%2Fgcc.git i386: Fix CPUID of USER_MSR. gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_available_features): Move USER_MSR to the correct location. gcc/testsuite/ChangeLog: * gcc.target/i386/user_msr-1.c: Correct the MSR index for give the user an proper example. --- diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index f90fb4d56a2c..a1eb285daedf 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -861,8 +861,6 @@ get_available_features (struct __processor_model *cpu_model, set_feature (FEATURE_IBT); if (edx & bit_UINTR) set_feature (FEATURE_UINTR); - if (edx & bit_USER_MSR) - set_feature (FEATURE_USER_MSR); if (amx_usable) { if (edx & bit_AMX_TILE) @@ -921,6 +919,8 @@ get_available_features (struct __processor_model *cpu_model, set_feature (FEATURE_PREFETCHI); if (eax & bit_RAOINT) set_feature (FEATURE_RAOINT); + if (edx & bit_USER_MSR) + set_feature (FEATURE_USER_MSR); if (avx_usable) { if (eax & bit_AVXVNNI) diff --git a/gcc/testsuite/gcc.target/i386/user_msr-1.c b/gcc/testsuite/gcc.target/i386/user_msr-1.c index 447852306df2..f315016d0886 100644 --- a/gcc/testsuite/gcc.target/i386/user_msr-1.c +++ b/gcc/testsuite/gcc.target/i386/user_msr-1.c @@ -1,9 +1,9 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-musermsr -O2" } */ /* { dg-final { scan-assembler-times "urdmsr\[ \\t\]\\%r\[a-z\]x, \\%r\[a-z\]x" 1 } } */ -/* { dg-final { scan-assembler-times "urdmsr\[ \\t\]\\\$121" 1 } } */ +/* { dg-final { scan-assembler-times "urdmsr\[ \\t\]\\\$6912" 1 } } */ /* { dg-final { scan-assembler-times "uwrmsr\[ \\t\]\\%r\[a-z\]x, \\%r\[a-z\]x" 1 } } */ -/* { dg-final { scan-assembler-times "uwrmsr\[ \\t\]\\%r\[a-z\]x, \\\$121" 1 } } */ +/* { dg-final { scan-assembler-times "uwrmsr\[ \\t\]\\%r\[a-z\]x, \\\$6912" 1 } } */ #include @@ -13,8 +13,9 @@ volatile unsigned long long y; void extern user_msr_test (void) { + y = 6913; x = _urdmsr(y); - x = _urdmsr(121); + x = _urdmsr(6912); _uwrmsr(y, x); - _uwrmsr(121, x); + _uwrmsr(6912, x); }