[gcc(refs/users/marxin/heads/i386-option-cleanup)] Overhaul in isa_flags and handling it.

Martin Liska marxin@gcc.gnu.org
Mon Mar 8 15:02:39 GMT 2021


https://gcc.gnu.org/g:c831912e5c905de1ffa7fa99a2d2459f340e9f07

commit c831912e5c905de1ffa7fa99a2d2459f340e9f07
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Mar 8 14:54:18 2021 +0100

    Overhaul in isa_flags and handling it.

Diff:
---
 gcc/config/i386/i386-options.c | 303 ++++-------------------------------------
 gcc/config/i386/i386.h         | 192 +-------------------------
 gcc/opth-gen.awk               |  11 +-
 3 files changed, 45 insertions(+), 461 deletions(-)

diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index 0142618fa08..2c90c8e0306 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -2080,285 +2080,40 @@ ix86_option_override_internal (bool main_args_p,
 	else
 	  ix86_tune = PROCESSOR_GENERIC;
 
-	if (((processor_alias_table[i].flags & PTA_MMX) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_MMX))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_MMX;
-	if (((processor_alias_table[i].flags & PTA_3DNOW) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_3DNOW))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_3DNOW;
-	if (((processor_alias_table[i].flags & PTA_3DNOW_A) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_3DNOW_A))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_3DNOW_A;
-	if (((processor_alias_table[i].flags & PTA_SSE) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE;
-	if (((processor_alias_table[i].flags & PTA_SSE2) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE2))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE2;
-	if (((processor_alias_table[i].flags & PTA_SSE3) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE3))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE3;
-	if (((processor_alias_table[i].flags & PTA_SSSE3) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSSE3))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSSE3;
-	if (((processor_alias_table[i].flags & PTA_SSE4_1) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4_1))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_1;
-	if (((processor_alias_table[i].flags & PTA_SSE4_2) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4_2))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_2;
-	if (((processor_alias_table[i].flags & PTA_AVX) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX;
-	if (((processor_alias_table[i].flags & PTA_AVX2) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX2))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX2;
-	if (((processor_alias_table[i].flags & PTA_FMA) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FMA))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FMA;
-	if (((processor_alias_table[i].flags & PTA_SSE4A) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4A))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4A;
-	if (((processor_alias_table[i].flags & PTA_FMA4) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FMA4))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FMA4;
-	if (((processor_alias_table[i].flags & PTA_XOP) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XOP))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XOP;
-	if (((processor_alias_table[i].flags & PTA_LWP) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_LWP))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_LWP;
+	/* Enable PTA flags that are enabled by default by a -march option.  */
+#define TARGET_EXPLICIT_NO_SAHF_P(opts) (false)
+#define SET_TARGET_NO_SAHF(opts) {}
+#define TARGET_EXPLICIT_PREFETCH_SSE_P(opts) (false)
+#define SET_TARGET_PREFETCH_SSE(opts) {}
+#define TARGET_EXPLICIT_NO_TUNE_P(opts) (false)
+#define SET_TARGET_NO_TUNE(opts) {}
+#define TARGET_EXPLICIT_NO_80387_P(opts) (false)
+#define SET_TARGET_NO_80387(opts) {}
+
+#define DEF_PTA(NAME) \
+	if (((processor_alias_table[i].flags & PTA_ ## NAME) != 0) \
+	    && PTA_ ## NAME != PTA_64BIT \
+	    && !TARGET_EXPLICIT_ ## NAME ## _P (opts)) \
+	  SET_TARGET_ ## NAME (opts);
+#include "i386.def"
+#undef DEF_PTA
+
+
+       if (!(TARGET_64BIT_P (opts->x_ix86_isa_flags)
+           && ((processor_alias_table[i].flags & PTA_NO_SAHF) != 0))
+	   && !TARGET_EXPLICIT_SAHF_P (opts))
+	    SET_TARGET_SAHF (opts);
+
 	if (((processor_alias_table[i].flags & PTA_ABM) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_ABM))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_ABM;
-	if (((processor_alias_table[i].flags & PTA_BMI) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_BMI))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_BMI;
-	if (((processor_alias_table[i].flags & (PTA_LZCNT | PTA_ABM)) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_LZCNT))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_LZCNT;
-	if (((processor_alias_table[i].flags & PTA_TBM) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_TBM))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_TBM;
-	if (((processor_alias_table[i].flags & PTA_BMI2) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_BMI2))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_BMI2;
-	if (((processor_alias_table[i].flags & PTA_CX16) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_CX16))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_CX16;
-	if (((processor_alias_table[i].flags & (PTA_POPCNT | PTA_ABM)) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_POPCNT))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_POPCNT;
-	if (!(TARGET_64BIT_P (opts->x_ix86_isa_flags)
-	    && ((processor_alias_table[i].flags & PTA_NO_SAHF) != 0))
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SAHF))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SAHF;
-	if (((processor_alias_table[i].flags & PTA_MOVBE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_MOVBE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_MOVBE;
-	if (((processor_alias_table[i].flags & PTA_AES) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AES))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AES;
-	if (((processor_alias_table[i].flags & PTA_SHA) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SHA))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SHA;
-	if (((processor_alias_table[i].flags & PTA_PCLMUL) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PCLMUL))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PCLMUL;
-	if (((processor_alias_table[i].flags & PTA_FSGSBASE) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FSGSBASE))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FSGSBASE;
-	if (((processor_alias_table[i].flags & PTA_RDRND) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_RDRND))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_RDRND;
-	if (((processor_alias_table[i].flags & PTA_F16C) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_F16C))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_F16C;
-	if (((processor_alias_table[i].flags & PTA_RTM) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_RTM))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_RTM;
-	if (((processor_alias_table[i].flags & PTA_HLE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_HLE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_HLE;
-	if (((processor_alias_table[i].flags & PTA_PRFCHW) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PRFCHW))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PRFCHW;
-	if (((processor_alias_table[i].flags & PTA_RDSEED) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_RDSEED))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_RDSEED;
-	if (((processor_alias_table[i].flags & PTA_ADX) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_ADX))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_ADX;
-	if (((processor_alias_table[i].flags & PTA_FXSR) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FXSR))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FXSR;
-	if (((processor_alias_table[i].flags & PTA_XSAVE) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVE))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XSAVE;
-	if (((processor_alias_table[i].flags & PTA_XSAVEOPT) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVEOPT))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XSAVEOPT;
-	if (((processor_alias_table[i].flags & PTA_AVX512F) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512F))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512F;
-	if (((processor_alias_table[i].flags & PTA_AVX512ER) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512ER))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512ER;
-	if (((processor_alias_table[i].flags & PTA_AVX512PF) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512PF))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512PF;
-	if (((processor_alias_table[i].flags & PTA_AVX512CD) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512CD))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512CD;
-	if (((processor_alias_table[i].flags & PTA_PREFETCHWT1) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PREFETCHWT1))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PREFETCHWT1;
-	if (((processor_alias_table[i].flags & PTA_CLWB) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_CLWB))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_CLWB;
-	if (((processor_alias_table[i].flags & PTA_CLFLUSHOPT) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_CLFLUSHOPT))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_CLFLUSHOPT;
-	if (((processor_alias_table[i].flags & PTA_CLZERO) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_CLZERO))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_CLZERO;
-	if (((processor_alias_table[i].flags & PTA_XSAVEC) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVEC))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XSAVEC;
-	if (((processor_alias_table[i].flags & PTA_XSAVES) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVES))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XSAVES;
-	if (((processor_alias_table[i].flags & PTA_AVX512DQ) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512DQ))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512DQ;
-	if (((processor_alias_table[i].flags & PTA_AVX512BW) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512BW))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512BW;
-	if (((processor_alias_table[i].flags & PTA_AVX512VL) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512VL))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512VL;
-	if (((processor_alias_table[i].flags & PTA_AVX512VBMI) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512VBMI))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512VBMI;
-	if (((processor_alias_table[i].flags & PTA_AVX512IFMA) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512IFMA))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512IFMA;
-	if (((processor_alias_table[i].flags & PTA_AVX512VNNI) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX512VNNI))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512VNNI;
-	if (((processor_alias_table[i].flags & PTA_GFNI) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_GFNI))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_GFNI;
-	if (((processor_alias_table[i].flags & PTA_AVX512VBMI2) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit
-	    & OPTION_MASK_ISA_AVX512VBMI2))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512VBMI2;
-	if (((processor_alias_table[i].flags & PTA_VPCLMULQDQ) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_VPCLMULQDQ))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_VPCLMULQDQ;
-	if (((processor_alias_table[i].flags & PTA_AVX512BITALG) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit
-	    & OPTION_MASK_ISA_AVX512BITALG))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512BITALG;
-
-	if (((processor_alias_table[i].flags & PTA_AVX512VP2INTERSECT) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AVX512VP2INTERSECT))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVX512VP2INTERSECT;
-	if (((processor_alias_table[i].flags & PTA_AVX5124VNNIW) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AVX5124VNNIW))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVX5124VNNIW;
-	if (((processor_alias_table[i].flags & PTA_AVX5124FMAPS) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AVX5124FMAPS))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVX5124FMAPS;
-	if (((processor_alias_table[i].flags & PTA_AVX512VPOPCNTDQ) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit
-		 & OPTION_MASK_ISA_AVX512VPOPCNTDQ))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX512VPOPCNTDQ;
-	if (((processor_alias_table[i].flags & PTA_AVX512BF16) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AVX512BF16))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVX512BF16;
-	if (((processor_alias_table[i].flags & PTA_AMX_TILE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AMX_TILE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_TILE;
-	if (((processor_alias_table[i].flags & PTA_AMX_INT8) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AMX_INT8))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_INT8;
-	if (((processor_alias_table[i].flags & PTA_AMX_BF16) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AMX_BF16))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_BF16;
-	if (((processor_alias_table[i].flags & PTA_AVXVNNI) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit
-		 & OPTION_MASK_ISA2_AVXVNNI))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVXVNNI;
-        if (((processor_alias_table[i].flags & PTA_MOVDIRI) != 0)
-            && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_MOVDIRI))
-          opts->x_ix86_isa_flags |= OPTION_MASK_ISA_MOVDIRI;
-        if (((processor_alias_table[i].flags & PTA_MOVDIR64B) != 0)
-            && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_MOVDIR64B))
-          opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_MOVDIR64B;
-	if (((processor_alias_table[i].flags & PTA_SGX) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_SGX))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_SGX;
-	if (((processor_alias_table[i].flags & PTA_VAES) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_VAES))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_VAES;
-	if (((processor_alias_table[i].flags & PTA_RDPID) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_RDPID))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_RDPID;
-	if (((processor_alias_table[i].flags & PTA_PCONFIG) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_PCONFIG))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_PCONFIG;
-	if (((processor_alias_table[i].flags & PTA_WBNOINVD) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_WBNOINVD))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_WBNOINVD;
-	if (((processor_alias_table[i].flags & PTA_PTWRITE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_PTWRITE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_PTWRITE;
-	if (((processor_alias_table[i].flags & PTA_WAITPKG) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_WAITPKG))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_WAITPKG;
-	if (((processor_alias_table[i].flags & PTA_ENQCMD) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_ENQCMD))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_ENQCMD;
-	if (((processor_alias_table[i].flags & PTA_CLDEMOTE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_CLDEMOTE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_CLDEMOTE;
-	if (((processor_alias_table[i].flags & PTA_SERIALIZE) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_SERIALIZE))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_SERIALIZE;
-	if (((processor_alias_table[i].flags & PTA_TSXLDTRK) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_TSXLDTRK))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_TSXLDTRK;
-	if (((processor_alias_table[i].flags & PTA_KL) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_KL))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_KL;
-	if (((processor_alias_table[i].flags & PTA_WIDEKL) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_WIDEKL))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_WIDEKL;
+	    && !TARGET_EXPLICIT_ABM_P (opts))
+	  {
+	    SET_TARGET_LZCNT (opts);
+	    SET_TARGET_POPCNT (opts);
+	  }
 
 	if ((processor_alias_table[i].flags
 	   & (PTA_PREFETCH_SSE | PTA_SSE)) != 0)
 	  ix86_prefetch_sse = true;
-	if (((processor_alias_table[i].flags & PTA_MWAITX) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_MWAITX))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_MWAITX;
-	if (((processor_alias_table[i].flags & PTA_PKU) != 0)
-	    && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PKU))
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PKU;
-	if (((processor_alias_table[i].flags & PTA_UINTR) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_UINTR))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_UINTR;
-	if (((processor_alias_table[i].flags & PTA_HRESET) != 0)
-	    && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_HRESET))
-	  opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_HRESET;
-
 
 	/* Don't enable x87 instructions if only general registers are
 	   allowed by target("general-regs-only") function attribute or
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 47e67cc6dda..51009b2fc92 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -39,192 +39,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 /* Redefines for option macros.  */
 
-#define TARGET_64BIT	TARGET_ISA_64BIT
-#define TARGET_64BIT_P(x)	TARGET_ISA_64BIT_P(x)
-#define TARGET_MMX	TARGET_ISA_MMX
-#define TARGET_MMX_P(x)	TARGET_ISA_MMX_P(x)
-#define TARGET_3DNOW	TARGET_ISA_3DNOW
-#define TARGET_3DNOW_P(x)	TARGET_ISA_3DNOW_P(x)
-#define TARGET_3DNOW_A	TARGET_ISA_3DNOW_A
-#define TARGET_3DNOW_A_P(x)	TARGET_ISA_3DNOW_A_P(x)
-#define TARGET_SSE	TARGET_ISA_SSE
-#define TARGET_SSE_P(x)	TARGET_ISA_SSE_P(x)
-#define TARGET_SSE2	TARGET_ISA_SSE2
-#define TARGET_SSE2_P(x)	TARGET_ISA_SSE2_P(x)
-#define TARGET_SSE3	TARGET_ISA_SSE3
-#define TARGET_SSE3_P(x)	TARGET_ISA_SSE3_P(x)
-#define TARGET_SSSE3	TARGET_ISA_SSSE3
-#define TARGET_SSSE3_P(x)	TARGET_ISA_SSSE3_P(x)
-#define TARGET_SSE4_1	TARGET_ISA_SSE4_1
-#define TARGET_SSE4_1_P(x)	TARGET_ISA_SSE4_1_P(x)
-#define TARGET_SSE4_2	TARGET_ISA_SSE4_2
-#define TARGET_SSE4_2_P(x)	TARGET_ISA_SSE4_2_P(x)
-#define TARGET_AVX	TARGET_ISA_AVX
-#define TARGET_AVX_P(x)	TARGET_ISA_AVX_P(x)
-#define TARGET_AVX2	TARGET_ISA_AVX2
-#define TARGET_AVX2_P(x)	TARGET_ISA_AVX2_P(x)
-#define TARGET_AVX512F	TARGET_ISA_AVX512F
-#define TARGET_AVX512F_P(x)	TARGET_ISA_AVX512F_P(x)
-#define TARGET_AVX512PF	TARGET_ISA_AVX512PF
-#define TARGET_AVX512PF_P(x)	TARGET_ISA_AVX512PF_P(x)
-#define TARGET_AVX512ER	TARGET_ISA_AVX512ER
-#define TARGET_AVX512ER_P(x)	TARGET_ISA_AVX512ER_P(x)
-#define TARGET_AVX512CD	TARGET_ISA_AVX512CD
-#define TARGET_AVX512CD_P(x)	TARGET_ISA_AVX512CD_P(x)
-#define TARGET_AVX512DQ	TARGET_ISA_AVX512DQ
-#define TARGET_AVX512DQ_P(x)	TARGET_ISA_AVX512DQ_P(x)
-#define TARGET_AVX512BW	TARGET_ISA_AVX512BW
-#define TARGET_AVX512BW_P(x)	TARGET_ISA_AVX512BW_P(x)
-#define TARGET_AVX512VL	TARGET_ISA_AVX512VL
-#define TARGET_AVX512VL_P(x)	TARGET_ISA_AVX512VL_P(x)
-#define TARGET_AVX512VBMI	TARGET_ISA_AVX512VBMI
-#define TARGET_AVX512VBMI_P(x)	TARGET_ISA_AVX512VBMI_P(x)
-#define TARGET_AVX512IFMA	TARGET_ISA_AVX512IFMA
-#define TARGET_AVX512IFMA_P(x)	TARGET_ISA_AVX512IFMA_P(x)
-#define TARGET_AVX5124FMAPS	TARGET_ISA2_AVX5124FMAPS
-#define TARGET_AVX5124FMAPS_P(x) TARGET_ISA2_AVX5124FMAPS_P(x)
-#define TARGET_AVX5124VNNIW	TARGET_ISA2_AVX5124VNNIW
-#define TARGET_AVX5124VNNIW_P(x) TARGET_ISA2_AVX5124VNNIW_P(x)
-#define TARGET_AVX512VBMI2	TARGET_ISA_AVX512VBMI2
-#define TARGET_AVX512VBMI2_P(x) TARGET_ISA_AVX512VBMI2_P(x)
-#define TARGET_AVX512VPOPCNTDQ	TARGET_ISA_AVX512VPOPCNTDQ
-#define TARGET_AVX512VPOPCNTDQ_P(x) TARGET_ISA_AVX512VPOPCNTDQ_P(x)
-#define TARGET_AVX512VNNI	TARGET_ISA_AVX512VNNI
-#define TARGET_AVX512VNNI_P(x) TARGET_ISA_AVX512VNNI_P(x)
-#define TARGET_AVX512BITALG	TARGET_ISA_AVX512BITALG
-#define TARGET_AVX512BITALG_P(x) TARGET_ISA_AVX512BITALG_P(x)
-#define TARGET_AVX512VP2INTERSECT	TARGET_ISA2_AVX512VP2INTERSECT
-#define TARGET_AVX512VP2INTERSECT_P(x) TARGET_ISA2_AVX512VP2INTERSECT_P(x)
-#define TARGET_FMA	TARGET_ISA_FMA
-#define TARGET_FMA_P(x)	TARGET_ISA_FMA_P(x)
-#define TARGET_SSE4A	TARGET_ISA_SSE4A
-#define TARGET_SSE4A_P(x)	TARGET_ISA_SSE4A_P(x)
-#define TARGET_FMA4	TARGET_ISA_FMA4
-#define TARGET_FMA4_P(x)	TARGET_ISA_FMA4_P(x)
-#define TARGET_XOP	TARGET_ISA_XOP
-#define TARGET_XOP_P(x)	TARGET_ISA_XOP_P(x)
-#define TARGET_LWP	TARGET_ISA_LWP
-#define TARGET_LWP_P(x)	TARGET_ISA_LWP_P(x)
-#define TARGET_ABM	TARGET_ISA_ABM
-#define TARGET_ABM_P(x)	TARGET_ISA_ABM_P(x)
-#define TARGET_PCONFIG	TARGET_ISA2_PCONFIG
-#define TARGET_PCONFIG_P(x)	TARGET_ISA2_PCONFIG_P(x)
-#define TARGET_WBNOINVD	TARGET_ISA2_WBNOINVD
-#define TARGET_WBNOINVD_P(x)	TARGET_ISA2_WBNOINVD_P(x)
-#define TARGET_SGX	TARGET_ISA2_SGX
-#define TARGET_SGX_P(x)	TARGET_ISA2_SGX_P(x)
-#define TARGET_RDPID	TARGET_ISA2_RDPID
-#define TARGET_RDPID_P(x)	TARGET_ISA2_RDPID_P(x)
-#define TARGET_GFNI	TARGET_ISA_GFNI
-#define TARGET_GFNI_P(x)	TARGET_ISA_GFNI_P(x)
-#define TARGET_VAES	TARGET_ISA2_VAES
-#define TARGET_VAES_P(x)	TARGET_ISA2_VAES_P(x)
-#define TARGET_VPCLMULQDQ	TARGET_ISA_VPCLMULQDQ
-#define TARGET_VPCLMULQDQ_P(x)	TARGET_ISA_VPCLMULQDQ_P(x)
-#define TARGET_BMI	TARGET_ISA_BMI
-#define TARGET_BMI_P(x)	TARGET_ISA_BMI_P(x)
-#define TARGET_BMI2	TARGET_ISA_BMI2
-#define TARGET_BMI2_P(x)	TARGET_ISA_BMI2_P(x)
-#define TARGET_LZCNT	TARGET_ISA_LZCNT
-#define TARGET_LZCNT_P(x)	TARGET_ISA_LZCNT_P(x)
-#define TARGET_TBM	TARGET_ISA_TBM
-#define TARGET_TBM_P(x)	TARGET_ISA_TBM_P(x)
-#define TARGET_POPCNT	TARGET_ISA_POPCNT
-#define TARGET_POPCNT_P(x)	TARGET_ISA_POPCNT_P(x)
-#define TARGET_SAHF	TARGET_ISA_SAHF
-#define TARGET_SAHF_P(x)	TARGET_ISA_SAHF_P(x)
-#define TARGET_MOVBE	TARGET_ISA2_MOVBE
-#define TARGET_MOVBE_P(x)	TARGET_ISA2_MOVBE_P(x)
-#define TARGET_CRC32	TARGET_ISA_CRC32
-#define TARGET_CRC32_P(x)	TARGET_ISA_CRC32_P(x)
-#define TARGET_AES	TARGET_ISA_AES
-#define TARGET_AES_P(x)	TARGET_ISA_AES_P(x)
-#define TARGET_SHA	TARGET_ISA_SHA
-#define TARGET_SHA_P(x)	TARGET_ISA_SHA_P(x)
-#define TARGET_CLFLUSHOPT	TARGET_ISA_CLFLUSHOPT
-#define TARGET_CLFLUSHOPT_P(x)	TARGET_ISA_CLFLUSHOPT_P(x)
-#define TARGET_CLZERO	TARGET_ISA2_CLZERO
-#define TARGET_CLZERO_P(x)	TARGET_ISA2_CLZERO_P(x)
-#define TARGET_XSAVEC	TARGET_ISA_XSAVEC
-#define TARGET_XSAVEC_P(x)	TARGET_ISA_XSAVEC_P(x)
-#define TARGET_XSAVES	TARGET_ISA_XSAVES
-#define TARGET_XSAVES_P(x)	TARGET_ISA_XSAVES_P(x)
-#define TARGET_PCLMUL	TARGET_ISA_PCLMUL
-#define TARGET_PCLMUL_P(x)	TARGET_ISA_PCLMUL_P(x)
-#define TARGET_CMPXCHG16B	TARGET_ISA2_CX16
-#define TARGET_CMPXCHG16B_P(x)	TARGET_ISA2_CX16_P(x)
-#define TARGET_FSGSBASE	TARGET_ISA_FSGSBASE
-#define TARGET_FSGSBASE_P(x)	TARGET_ISA_FSGSBASE_P(x)
-#define TARGET_RDRND	TARGET_ISA_RDRND
-#define TARGET_RDRND_P(x)	TARGET_ISA_RDRND_P(x)
-#define TARGET_F16C	TARGET_ISA_F16C
-#define TARGET_F16C_P(x)	TARGET_ISA_F16C_P(x)
-#define TARGET_RTM	TARGET_ISA_RTM
-#define TARGET_RTM_P(x)	TARGET_ISA_RTM_P(x)
-#define TARGET_HLE	TARGET_ISA2_HLE
-#define TARGET_HLE_P(x)	TARGET_ISA2_HLE_P(x)
-#define TARGET_RDSEED	TARGET_ISA_RDSEED
-#define TARGET_RDSEED_P(x)	TARGET_ISA_RDSEED_P(x)
-#define TARGET_PRFCHW	TARGET_ISA_PRFCHW
-#define TARGET_PRFCHW_P(x)	TARGET_ISA_PRFCHW_P(x)
-#define TARGET_ADX	TARGET_ISA_ADX
-#define TARGET_ADX_P(x)	TARGET_ISA_ADX_P(x)
-#define TARGET_FXSR	TARGET_ISA_FXSR
-#define TARGET_FXSR_P(x)	TARGET_ISA_FXSR_P(x)
-#define TARGET_XSAVE	TARGET_ISA_XSAVE
-#define TARGET_XSAVE_P(x)	TARGET_ISA_XSAVE_P(x)
-#define TARGET_XSAVEOPT	TARGET_ISA_XSAVEOPT
-#define TARGET_XSAVEOPT_P(x)	TARGET_ISA_XSAVEOPT_P(x)
-#define TARGET_PREFETCHWT1	TARGET_ISA_PREFETCHWT1
-#define TARGET_PREFETCHWT1_P(x)	TARGET_ISA_PREFETCHWT1_P(x)
-#define TARGET_CLWB	TARGET_ISA_CLWB
-#define TARGET_CLWB_P(x)	TARGET_ISA_CLWB_P(x)
-#define TARGET_MWAITX	TARGET_ISA2_MWAITX
-#define TARGET_MWAITX_P(x)	TARGET_ISA2_MWAITX_P(x)
-#define TARGET_PKU	TARGET_ISA_PKU
-#define TARGET_PKU_P(x)	TARGET_ISA_PKU_P(x)
-#define TARGET_SHSTK	TARGET_ISA_SHSTK
-#define TARGET_SHSTK_P(x)	TARGET_ISA_SHSTK_P(x)
-#define TARGET_MOVDIRI	TARGET_ISA_MOVDIRI
-#define TARGET_MOVDIRI_P(x) TARGET_ISA_MOVDIRI_P(x)
-#define TARGET_MOVDIR64B	TARGET_ISA2_MOVDIR64B
-#define TARGET_MOVDIR64B_P(x) TARGET_ISA2_MOVDIR64B_P(x)
-#define TARGET_WAITPKG	TARGET_ISA2_WAITPKG
-#define TARGET_WAITPKG_P(x)	TARGET_ISA2_WAITPKG_P(x)
-#define TARGET_CLDEMOTE	TARGET_ISA2_CLDEMOTE
-#define TARGET_CLDEMOTE_P(x) TARGET_ISA2_CLDEMOTE_P(x)
-#define TARGET_PTWRITE	TARGET_ISA2_PTWRITE
-#define TARGET_PTWRITE_P(x)	TARGET_ISA2_PTWRITE_P(x)
-#define TARGET_AVX512BF16	TARGET_ISA2_AVX512BF16
-#define TARGET_AVX512BF16_P(x)	TARGET_ISA2_AVX512BF16_P(x)
-#define TARGET_ENQCMD	TARGET_ISA2_ENQCMD
-#define TARGET_ENQCMD_P(x) TARGET_ISA2_ENQCMD_P(x)
-#define TARGET_SERIALIZE	TARGET_ISA2_SERIALIZE
-#define TARGET_SERIALIZE_P(x) TARGET_ISA2_SERIALIZE_P(x)
-#define TARGET_TSXLDTRK	TARGET_ISA2_TSXLDTRK
-#define TARGET_TSXLDTRK_P(x) TARGET_ISA2_TSXLDTRK_P(x)
-#define TARGET_AMX_TILE TARGET_ISA2_AMX_TILE
-#define TARGET_AMX_TILE_P(x) TARGET_ISA2_AMX_TILE(x)
-#define TARGET_AMX_INT8 TARGET_ISA2_AMX_INT8
-#define TARGET_AMX_INT8_P(x) TARGET_ISA2_AMX_INT8(x)
-#define TARGET_AMX_BF16 TARGET_ISA2_AMX_BF16
-#define TARGET_AMX_BF16_P(x) TARGET_ISA2_AMX_BF16(x)
-#define TARGET_UINTR	TARGET_ISA2_UINTR
-#define TARGET_UINTR_P(x) TARGET_ISA2_UINTR_P(x)
-#define TARGET_HRESET	    TARGET_ISA2_HRESET
-#define TARGET_HRESET_P(x)  TARGET_ISA2_HRESET_P(x)
-#define TARGET_KL	TARGET_ISA2_KL
-#define TARGET_KL_P(x) TARGET_ISA2_KL_P(x)
-#define TARGET_WIDEKL	TARGET_ISA2_WIDEKL
-#define TARGET_WIDEKL_P(x) TARGET_ISA2_WIDEKL_P(x)
-#define TARGET_AVXVNNI	TARGET_ISA2_AVXVNNI
-#define TARGET_AVXVNNI_P(x)	TARGET_ISA2_AVXVNNI_P(x)
-
-#define TARGET_LP64	TARGET_ABI_64
+#define TARGET_CMPXCHG16B	TARGET_CX16
+#define TARGET_CMPXCHG16B_P(x)	TARGET_CX16_P(x)
+
+#define TARGET_LP64		TARGET_ABI_64
 #define TARGET_LP64_P(x)	TARGET_ABI_64_P(x)
-#define TARGET_X32	TARGET_ABI_X32
-#define TARGET_X32_P(x)	TARGET_ABI_X32_P(x)
-#define TARGET_16BIT	TARGET_CODE16
+#define TARGET_X32		TARGET_ABI_X32
+#define TARGET_X32_P(x)		TARGET_ABI_X32_P(x)
+#define TARGET_16BIT		TARGET_CODE16
 #define TARGET_16BIT_P(x)	TARGET_CODE16_P(x)
 
 #define TARGET_MMX_WITH_SSE	(TARGET_64BIT && TARGET_SSE2)
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 0491525da94..32475fd7eb4 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -439,10 +439,17 @@ for (i = 0; i < n_opts; i++) {
 			mask = "MASK_"
 			extra_mask_macros[name] = 1
 		}
+		original_name = name
+		gsub("ISA_", "", name)
+		gsub("ISA2_", "", name)
+		print "/* " original_name " mask */"
 		print "#define TARGET_" name \
-		      " ((" vname " & " mask name ") != 0)"
+		      " ((" vname " & " mask original_name ") != 0)"
 		print "#define TARGET_" name "_P(" vname ")" \
-		      " (((" vname ") & " mask name ") != 0)"
+		      " (((" vname ") & " mask original_name ") != 0)"
+		print "#define TARGET_EXPLICIT_" name "_P(opts)" \
+		      " ((opts->x_" vname "_explicit & " mask original_name ") != 0)"
+		print "#define SET_TARGET_" name "(opts) opts->x_" vname " |= " mask original_name
 	}
 }
 for (i = 0; i < n_extra_masks; i++) {


More information about the Gcc-cvs mailing list