[PATCH, i386]: __builtin_cpu_is() is not detecting bdver2 with Model = 0x02

Uros Bizjak ubizjak@gmail.com
Thu May 31 19:57:00 GMT 2018


Hello!

As reported in the PR, AMDFAM15H model 0x2 should return
AMDFAM15H_BDVER2 subtype.

2018-05-31  Uros Bizjak  <ubizjak@gmail.com>

    PR target/85591
    * config/i386/cpuinfo.c (get_amd_cpu): Return
    AMDFAM15H_BDVER2 for AMDFAM15H model 0x2.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.
-------------- next part --------------
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 8c9878c..a7bb9da 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -83,17 +83,20 @@ get_amd_cpu (unsigned int family, unsigned int model)
     /* AMD Family 15h "Bulldozer".  */
     case 0x15:
       __cpu_model.__cpu_type = AMDFAM15H;
+
+      if (model == 0x2)
+	__cpu_model.__cpu_subtype = AMDFAM15H_BDVER2;      
       /* Bulldozer version 1.  */
-      if ( model <= 0xf)
+      else if (model <= 0xf)
 	__cpu_model.__cpu_subtype = AMDFAM15H_BDVER1;
       /* Bulldozer version 2 "Piledriver" */
-      if (model >= 0x10 && model <= 0x2f)
+      else if (model <= 0x2f)
 	__cpu_model.__cpu_subtype = AMDFAM15H_BDVER2;      
       /* Bulldozer version 3 "Steamroller"  */
-      if (model >= 0x30 && model <= 0x4f)
+      else if (model <= 0x4f)
 	__cpu_model.__cpu_subtype = AMDFAM15H_BDVER3;
       /* Bulldozer version 4 "Excavator"   */
-      if (model >= 0x60 && model <= 0x7f)
+      else if (model <= 0x7f)
 	__cpu_model.__cpu_subtype = AMDFAM15H_BDVER4;
       break;
     /* AMD Family 16h "btver2" */


More information about the Gcc-patches mailing list