aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHu, Lin1 <lin1.hu@intel.com>2023-11-27 11:28:00 +0800
committerHu, Lin1 <lin1.hu@intel.com>2023-12-04 10:02:13 +0800
commit88029286c35d3bf65568fea1324d595a15441772 (patch)
treebce5eca0a0e4d27208b3c0d249ce7b18e7fcc628
parent4e5f5a8ae82c5f4f714102d2437175ec366f644c (diff)
downloadgcc-88029286c35d3bf65568fea1324d595a15441772.zip
gcc-88029286c35d3bf65568fea1324d595a15441772.tar.gz
gcc-88029286c35d3bf65568fea1324d595a15441772.tar.bz2
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.
-rw-r--r--gcc/common/config/i386/cpuinfo.h4
-rw-r--r--gcc/testsuite/gcc.target/i386/user_msr-1.c9
2 files changed, 7 insertions, 6 deletions
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index f90fb4d..a1eb285 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 4478523..f315016 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 <x86gprintrin.h>
@@ -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);
}