diff gcc/config/i386/driver-i386.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/config/i386/driver-i386.c	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/config/i386/driver-i386.c	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* Subroutines for the gcc driver.
-   Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   Copyright (C) 2006-2018 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -17,6 +17,8 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define IN_TARGET_CODE 1
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -405,6 +407,7 @@
   unsigned int has_fma = 0, has_fma4 = 0, has_xop = 0;
   unsigned int has_bmi = 0, has_bmi2 = 0, has_tbm = 0, has_lzcnt = 0;
   unsigned int has_hle = 0, has_rtm = 0, has_sgx = 0;
+  unsigned int has_pconfig = 0, has_wbnoinvd = 0;
   unsigned int has_rdrnd = 0, has_f16c = 0, has_fsgsbase = 0;
   unsigned int has_rdseed = 0, has_prfchw = 0, has_adx = 0;
   unsigned int has_osxsave = 0, has_fxsr = 0, has_xsave = 0, has_xsaveopt = 0;
@@ -415,8 +418,14 @@
   unsigned int has_avx512vbmi = 0, has_avx512ifma = 0, has_clwb = 0;
   unsigned int has_mwaitx = 0, has_clzero = 0, has_pku = 0, has_rdpid = 0;
   unsigned int has_avx5124fmaps = 0, has_avx5124vnniw = 0;
-  unsigned int has_gfni = 0;
-  unsigned int has_ibt = 0, has_shstk = 0;
+  unsigned int has_gfni = 0, has_avx512vbmi2 = 0;
+  unsigned int has_avx512bitalg = 0;
+  unsigned int has_shstk = 0;
+  unsigned int has_avx512vnni = 0, has_vaes = 0;
+  unsigned int has_vpclmulqdq = 0;
+  unsigned int has_movdiri = 0, has_movdir64b = 0;
+  unsigned int has_waitpkg = 0;
+  unsigned int has_cldemote = 0;
 
   bool arch;
 
@@ -505,14 +514,23 @@
       has_prefetchwt1 = ecx & bit_PREFETCHWT1;
       has_avx512vbmi = ecx & bit_AVX512VBMI;
       has_pku = ecx & bit_OSPKE;
+      has_avx512vbmi2 = ecx & bit_AVX512VBMI2;
+      has_avx512vnni = ecx & bit_AVX512VNNI;
       has_rdpid = ecx & bit_RDPID;
       has_gfni = ecx & bit_GFNI;
+      has_vaes = ecx & bit_VAES;
+      has_vpclmulqdq = ecx & bit_VPCLMULQDQ;
+      has_avx512bitalg = ecx & bit_AVX512BITALG;
+      has_movdiri = ecx & bit_MOVDIRI;
+      has_movdir64b = ecx & bit_MOVDIR64B;
+      has_cldemote = ecx & bit_CLDEMOTE;
 
       has_avx5124vnniw = edx & bit_AVX5124VNNIW;
       has_avx5124fmaps = edx & bit_AVX5124FMAPS;
 
       has_shstk = ecx & bit_SHSTK;
-      has_ibt = edx & bit_IBT;
+      has_pconfig = edx & bit_PCONFIG;
+      has_waitpkg = ecx & bit_WAITPKG;
     }
 
   if (max_level >= 13)
@@ -551,6 +569,7 @@
     {
       __cpuid (0x80000008, eax, ebx, ecx, edx);
       has_clzero = ebx & bit_CLZERO;
+      has_wbnoinvd = ebx & bit_WBNOINVD;
     }
 
   /* Get XCR_XFEATURE_ENABLED_MASK register with xgetbv.  */
@@ -740,6 +759,15 @@
 	  /* Silvermont.  */
 	  cpu = "silvermont";
 	  break;
+	case 0x5c:
+	case 0x5f:
+	  /* Goldmont.  */
+	  cpu = "goldmont";
+	  break;
+	case 0x7a:
+	  /* Goldmont Plus.  */
+	  cpu = "goldmont-plus";
+	  break;
 	case 0x0f:
 	  /* Merom.  */
 	case 0x17:
@@ -792,24 +820,44 @@
 	  /* Kaby Lake.  */
 	  cpu = "skylake";
 	  break;
+	case 0x55:
+	  /* Skylake with AVX-512.  */
+	  cpu = "skylake-avx512";
+	  break;
 	case 0x57:
 	  /* Knights Landing.  */
 	  cpu = "knl";
 	  break;
+	case 0x66:
+	  /* Cannon Lake.  */
+	  cpu = "cannonlake";
+	  break;
 	case 0x85:
-	  /* Knights Mill. */
+	  /* Knights Mill.  */
 	  cpu = "knm";
 	  break;
 	default:
 	  if (arch)
 	    {
 	      /* This is unknown family 0x6 CPU.  */
-	      /* Assume Knights Landing.  */
-	      if (has_avx512f)
-		cpu = "knl";
-	      /* Assume Knights Mill */
+	      /* Assume Ice Lake Server.  */
+	      if (has_wbnoinvd)
+		cpu = "icelake-server";
+	      /* Assume Ice Lake.  */
+	      else if (has_gfni)
+		cpu = "icelake-client";
+	      /* Assume Cannon Lake.  */
+	      else if (has_avx512vbmi)
+		cpu = "cannonlake";
+	      /* Assume Knights Mill.  */
 	      else if (has_avx5124vnniw)
 		cpu = "knm";
+	      /* Assume Knights Landing.  */
+	      else if (has_avx512er)
+		cpu = "knl";
+	      /* Assume Skylake with AVX-512.  */
+	      else if (has_avx512f)
+		cpu = "skylake-avx512";
 	      /* Assume Skylake.  */
 	      else if (has_clflushopt)
 		cpu = "skylake";
@@ -824,7 +872,16 @@
 		cpu = "sandybridge";
 	      else if (has_sse4_2)
 		{
-		  if (has_movbe)
+		  if (has_gfni)
+		    /* Assume Tremont.  */
+		    cpu = "tremont";
+		  else if (has_sgx)
+		    /* Assume Goldmont Plus.  */
+		    cpu = "goldmont-plus";
+		  else if (has_xsave)
+		    /* Assume Goldmont.  */
+		    cpu = "goldmont";
+		  else if (has_movbe)
 		    /* Assume Silvermont.  */
 		    cpu = "silvermont";
 		  else
@@ -1015,6 +1072,8 @@
       const char *fma4 = has_fma4 ? " -mfma4" : " -mno-fma4";
       const char *xop = has_xop ? " -mxop" : " -mno-xop";
       const char *bmi = has_bmi ? " -mbmi" : " -mno-bmi";
+      const char *pconfig = has_pconfig ? " -mpconfig" : " -mno-pconfig";
+      const char *wbnoinvd = has_wbnoinvd ? " -mwbnoinvd" : " -mno-wbnoinvd";
       const char *sgx = has_sgx ? " -msgx" : " -mno-sgx";
       const char *bmi2 = has_bmi2 ? " -mbmi2" : " -mno-bmi2";
       const char *tbm = has_tbm ? " -mtbm" : " -mno-tbm";
@@ -1048,6 +1107,8 @@
       const char *avx512ifma = has_avx512ifma ? " -mavx512ifma" : " -mno-avx512ifma";
       const char *avx512vbmi = has_avx512vbmi ? " -mavx512vbmi" : " -mno-avx512vbmi";
       const char *avx5124vnniw = has_avx5124vnniw ? " -mavx5124vnniw" : " -mno-avx5124vnniw";
+      const char *avx512vbmi2 = has_avx512vbmi2 ? " -mavx512vbmi2" : " -mno-avx512vbmi2";
+      const char *avx512vnni = has_avx512vnni ? " -mavx512vnni" : " -mno-avx512vnni";
       const char *avx5124fmaps = has_avx5124fmaps ? " -mavx5124fmaps" : " -mno-avx5124fmaps";
       const char *clwb = has_clwb ? " -mclwb" : " -mno-clwb";
       const char *mwaitx  = has_mwaitx  ? " -mmwaitx"  : " -mno-mwaitx"; 
@@ -1055,18 +1116,28 @@
       const char *pku = has_pku ? " -mpku" : " -mno-pku";
       const char *rdpid = has_rdpid ? " -mrdpid" : " -mno-rdpid";
       const char *gfni = has_gfni ? " -mgfni" : " -mno-gfni";
-      const char *ibt = has_ibt ? " -mibt" : " -mno-ibt";
       const char *shstk = has_shstk ? " -mshstk" : " -mno-shstk";
+      const char *vaes = has_vaes ? " -mvaes" : " -mno-vaes";
+      const char *vpclmulqdq = has_vpclmulqdq ? " -mvpclmulqdq" : " -mno-vpclmulqdq";
+      const char *avx512bitalg = has_avx512bitalg ? " -mavx512bitalg" : " -mno-avx512bitalg";
+      const char *movdiri = has_movdiri ? " -mmovdiri" : " -mno-movdiri";
+      const char *movdir64b = has_movdir64b ? " -mmovdir64b" : " -mno-movdir64b";
+      const char *waitpkg = has_waitpkg ? " -mwaitpkg" : " -mno-waitpkg";
+      const char *cldemote = has_cldemote ? " -mcldemote" : " -mno-cldemote";
       options = concat (options, mmx, mmx3dnow, sse, sse2, sse3, ssse3,
 			sse4a, cx16, sahf, movbe, aes, sha, pclmul,
 			popcnt, abm, lwp, fma, fma4, xop, bmi, sgx, bmi2,
+			pconfig, wbnoinvd,
 			tbm, avx, avx2, sse4_2, sse4_1, lzcnt, rtm,
 			hle, rdrnd, f16c, fsgsbase, rdseed, prfchw, adx,
 			fxsr, xsave, xsaveopt, avx512f, avx512er,
 			avx512cd, avx512pf, prefetchwt1, clflushopt,
 			xsavec, xsaves, avx512dq, avx512bw, avx512vl,
 			avx512ifma, avx512vbmi, avx5124fmaps, avx5124vnniw,
-			clwb, mwaitx, clzero, pku, rdpid, gfni, ibt, shstk, NULL);
+			clwb, mwaitx, clzero, pku, rdpid, gfni, shstk,
+			avx512vbmi2, avx512vnni, vaes, vpclmulqdq,
+			avx512bitalg, movdiri, movdir64b, waitpkg, cldemote,
+			NULL);
     }
 
 done: