This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86: Add -march=cascadelake


On Fri, Dec 14, 2018 at 06:33:37PM +0800, Wei Xiao wrote:
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -832,8 +832,16 @@ const char *host_detect_local_cpu (int argc, const char **argv)
 	  cpu = "skylake";
 	  break;
 	case 0x55:
-	  /* Skylake with AVX-512.  */
-	  cpu = "skylake-avx512";
+	  if (has_avx512vnni)
+	  {
+	    /* Cascade Lake.  */
+	    cpu = "cascadelake";
+	  }
+	  else
+	  {
+	    /* Skylake with AVX-512.  */
+	    cpu = "skylake-avx512";
+	  }
 	  break;

Just a formatting nit here, if {}s are used, they should be indented
2 columns to the right from the if or else and the body of {} should
be indented by two further columns over {.
But, in this case, there is another rule, that if the body has a single
statement, then there shouldn't be {}s around it.  Thus just:
	  if (has_avx512vnni)
	    /* Cascade Lake.  */
	    cpu = "cascadelake";
	  else
	    /* Skylake with AVX-512.  */
	    cpu = "skylake-avx512";

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]