]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Fix CPUID of USER_MSR.
authorHu, Lin1 <lin1.hu@intel.com>
Mon, 27 Nov 2023 03:28:00 +0000 (11:28 +0800)
committerHu, Lin1 <lin1.hu@intel.com>
Mon, 4 Dec 2023 02:02:13 +0000 (10:02 +0800)
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.

gcc/common/config/i386/cpuinfo.h
gcc/testsuite/gcc.target/i386/user_msr-1.c

index f90fb4d56a2c5f40a8903cba463951eaeebdb81f..a1eb285daedf7d667bf740319b384ae92c74cb05 100644 (file)
@@ -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)
index 447852306df2da686d121d285872dc7e1c0f0f40..f315016d0886053fd3027fd3e9fd685548900270 100644 (file)
@@ -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);
 }