Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
On Mon, 2 Oct 2023, Kito Cheng wrote: > Thanks for reporting this issue, I just realized multidimensional > arrays are gawk extensions, could you try the attached patch to see if > it can resolve the issue? Yes, with that patch applied the build proceeds far beyond that point (still running). Thanks for the quick fix! Gerald
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
On Mon, 2023-10-02 10:55:25 +0800, Kito Cheng wrote: > Hi Gerald: > > Thanks for reporting this issue, I just realized multidimensional > arrays are gawk extensions, could you try the attached patch to see if > it can resolve the issue? With your new patch, it works for me again using `mawk` (cf. http://toolchain.lug-owl.de/laminar/jobs/gcc-local/75), but please also keep using TABs in opt-read.awk ("if (target_var)"). MfG, JBG -- signature.asc Description: PGP signature
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
Hi Gerald: Thanks for reporting this issue, I just realized multidimensional arrays are gawk extensions, could you try the attached patch to see if it can resolve the issue? On Mon, Oct 2, 2023 at 4:56 AM Gerald Pfeifer wrote: > > On Sun, 1 Oct 2023, Kito Cheng wrote: > > Committed to trunk, thanks Feng :) > > Hmm, my nightly FreeBSD 12 tester now fails as follows: > > nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk \ >< optionlist > tmp-options.h > nawk: syntax error at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > context is > >>>other_masks[var_index][ > <<< n_other_mask[var_index]++] = name > nawk: illegal statement at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ >-f /scratch/tmp/gerald/GCC-HEAD/gcc/optc-save-gen.awk \ >-v header_name="config.h system.h coretypes.h tm.h" < optionlist \ >> options-save.cc > nawk: syntax error at source line 386 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk > nawk: syntax error at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > context is > >>>other_masks[var_index][ > <<< n_other_mask[var_index]++] = name > nawk: illegal statement at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > gmake[3]: *** [Makefile:2477: s-options-h] Error 2 > > Gerald From a2a621ed6a3eaf136e917d10f4970a6bf7240d5a Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 2 Oct 2023 10:50:42 +0800 Subject: [PATCH] options: Prevent multidimensional arrays Multidimensional arrary is gawk extension, and we accidentally introduced that in recent commit[1]. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e4a4b8e983bac865eb435b11798e38d633b98942 gcc/ChangeLog: * opt-read.awk: Drop multidimensional arrays. * opth-gen.awk: Ditto. --- gcc/opt-read.awk | 2 +- gcc/opth-gen.awk | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index fcf92853957..b6b4c01888d 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -131,7 +131,7 @@ BEGIN { { target_vars[n_target_vars++] = target_var } - other_masks[var_index][n_other_mask[var_index]++] = name + other_masks[var_index "," n_other_mask[var_index]++] = name } else { diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 70ca3d37719..c4398be2f3a 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -412,9 +412,9 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define MASK_" other_masks[i][j] " (1U << " other_masknum[i][""]++ ")" + print "#define MASK_" other_masks[i "," j] " (1U << " other_masknum[i]++ ")" } - if (other_masknum[i][""] > 32) + if (other_masknum[i] > 32) print "#error too many target masks for" extra_target_vars[i] } @@ -437,8 +437,8 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define TARGET_" other_masks[i][j] \ - " ((" target_vars[i] " & MASK_" other_masks[i][j] ") != 0)" + print "#define TARGET_" other_masks[i "," j] \ + " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)" } } print "" -- 2.40.1
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
On Sun, 1 Oct 2023, Kito Cheng wrote: > Committed to trunk, thanks Feng :) Hmm, my nightly FreeBSD 12 tester now fails as follows: nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ -f /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk \ < optionlist > tmp-options.h nawk: syntax error at source line 67 source file /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk context is >>>other_masks[var_index][ <<< n_other_mask[var_index]++] = name nawk: illegal statement at source line 67 source file /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ -f /scratch/tmp/gerald/GCC-HEAD/gcc/optc-save-gen.awk \ -v header_name="config.h system.h coretypes.h tm.h" < optionlist \ > options-save.cc nawk: syntax error at source line 386 source file /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk nawk: syntax error at source line 67 source file /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk context is >>>other_masks[var_index][ <<< n_other_mask[var_index]++] = name nawk: illegal statement at source line 67 source file /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk gmake[3]: *** [Makefile:2477: s-options-h] Error 2 Gerald
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
Committed to trunk, thanks Feng :) On Sat, Sep 30, 2023 at 3:34 AM Jeff Law wrote: > > > > On 9/12/23 03:18, Feng Wang wrote: > > New patch add some comments and update docs for this new usage. > > --- > > Accoring to Kito's advice, using "MASK(name) Var(other_flag_name)" > > to generate MASK and TARGET MACRO automatically. > > This patch improve the MACRO generation of MASK_* and TARGET_*. > > Due to the more and more riscv extensions are added, the default target_flag > > is full. > > Before this patch,if you want to add new MACRO,you should define the > > MACRO in the riscv-opts.h manually. > > After this patch, you just need two steps: > > 1.Define the new TargetVariable. > > 2.Define "MASK(name) Var(new_target_flag). > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-opts.h (MASK_ZICSR): > > (MASK_ZIFENCEI): Delete; > > (MASK_ZIHINTNTL):Ditto; > > (MASK_ZIHINTPAUSE): Ditto; > > (TARGET_ZICSR): Ditto; > > (TARGET_ZIFENCEI): Ditto; > > (TARGET_ZIHINTNTL): Ditto; > > (TARGET_ZIHINTPAUSE):Ditto; > > (MASK_ZAWRS):Ditto; > > (TARGET_ZAWRS): Ditto; > > (MASK_ZBA): Ditto; > > (MASK_ZBB): Ditto; > > (MASK_ZBC): Ditto; > > (MASK_ZBS): Ditto; > > (TARGET_ZBA):Ditto; > > (TARGET_ZBB):Ditto; > > (TARGET_ZBC):Ditto; > > (TARGET_ZBS):Ditto; > > (MASK_ZFINX):Ditto; > > (MASK_ZDINX):Ditto; > > (MASK_ZHINX):Ditto; > > (MASK_ZHINXMIN): Ditto; > > (TARGET_ZFINX): Ditto; > > (TARGET_ZDINX): Ditto; > > (TARGET_ZHINX): Ditto; > > (TARGET_ZHINXMIN): Ditto; > > (MASK_ZBKB): Ditto; > > (MASK_ZBKC): Ditto; > > (MASK_ZBKX): Ditto; > > (MASK_ZKNE): Ditto; > > (MASK_ZKND): Ditto; > > (MASK_ZKNH): Ditto; > > (MASK_ZKR): Ditto; > > (MASK_ZKSED):Ditto; > > (MASK_ZKSH): Ditto; > > (MASK_ZKT): Ditto; > > (TARGET_ZBKB): Ditto; > > (TARGET_ZBKC): Ditto; > > (TARGET_ZBKX): Ditto; > > (TARGET_ZKNE): Ditto; > > (TARGET_ZKND): Ditto; > > (TARGET_ZKNH): Ditto; > > (TARGET_ZKR):Ditto; > > (TARGET_ZKSED): Ditto; > > (TARGET_ZKSH): Ditto; > > (TARGET_ZKT):Ditto; > > (MASK_ZTSO): Ditto; > > (TARGET_ZTSO): Ditto; > > (MASK_VECTOR_ELEN_32): Ditto; > > (MASK_VECTOR_ELEN_64): Ditto; > > (MASK_VECTOR_ELEN_FP_32):Ditto; > > (MASK_VECTOR_ELEN_FP_64):Ditto; > > (MASK_VECTOR_ELEN_FP_16):Ditto; > > (TARGET_VECTOR_ELEN_32): Ditto; > > (TARGET_VECTOR_ELEN_64): Ditto; > > (TARGET_VECTOR_ELEN_FP_32):Ditto; > > (TARGET_VECTOR_ELEN_FP_64):Ditto; > > (TARGET_VECTOR_ELEN_FP_16):Ditto; > > (MASK_ZVBB): Ditto; > > (MASK_ZVBC): Ditto; > > (TARGET_ZVBB): Ditto; > > (TARGET_ZVBC): Ditto; > > (MASK_ZVKG): Ditto; > > (MASK_ZVKNED): Ditto; > > (MASK_ZVKNHA): Ditto; > > (MASK_ZVKNHB): Ditto; > > (MASK_ZVKSED): Ditto; > > (MASK_ZVKSH): Ditto; > > (MASK_ZVKN): Ditto; > > (MASK_ZVKNC): Ditto; > > (MASK_ZVKNG): Ditto; > > (MASK_ZVKS): Ditto; > > (MASK_ZVKSC): Ditto; > > (MASK_ZVKSG): Ditto; > > (MASK_ZVKT): Ditto; > > (TARGET_ZVKG): Ditto; > > (TARGET_ZVKNED): Ditto; > > (TARGET_ZVKNHA): Ditto; > > (TARGET_ZVKNHB): Ditto; > > (TARGET_ZVKSED): Ditto; > > (TARGET_ZVKSH):Ditto; > > (TARGET_ZVKN): Ditto; > > (TARGET_ZVKNC):Ditto; > > (TARGET_ZVKNG):Ditto; > > (TARGET_ZVKS): Ditto; > > (TARGET_ZVKSC):Ditto; > > (TARGET_ZVKSG):Ditto; > > (TARGET_ZVKT): Ditto; > > (MASK_ZVL32B): Ditto; > > (MASK_ZVL64B): Ditto; > > (MASK_ZVL128B):Ditto; > > (MASK_ZVL256B):Ditto; > > (MASK_ZVL512B):Ditto; > > (MASK_ZVL1024B): Ditto; > > (MASK_ZVL2048B): Ditto; > > (MASK_ZVL4096B): Ditto; > > (MASK_ZVL8192B): Ditto; > > (MASK_ZVL16384B): Ditto; > > (MASK_ZVL32768B): Ditto; > > (MASK_ZVL65536B):
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
On 9/12/23 03:18, Feng Wang wrote: New patch add some comments and update docs for this new usage. --- Accoring to Kito's advice, using "MASK(name) Var(other_flag_name)" to generate MASK and TARGET MACRO automatically. This patch improve the MACRO generation of MASK_* and TARGET_*. Due to the more and more riscv extensions are added, the default target_flag is full. Before this patch,if you want to add new MACRO,you should define the MACRO in the riscv-opts.h manually. After this patch, you just need two steps: 1.Define the new TargetVariable. 2.Define "MASK(name) Var(new_target_flag). gcc/ChangeLog: * config/riscv/riscv-opts.h (MASK_ZICSR): (MASK_ZIFENCEI): Delete; (MASK_ZIHINTNTL):Ditto; (MASK_ZIHINTPAUSE): Ditto; (TARGET_ZICSR): Ditto; (TARGET_ZIFENCEI): Ditto; (TARGET_ZIHINTNTL): Ditto; (TARGET_ZIHINTPAUSE):Ditto; (MASK_ZAWRS):Ditto; (TARGET_ZAWRS): Ditto; (MASK_ZBA): Ditto; (MASK_ZBB): Ditto; (MASK_ZBC): Ditto; (MASK_ZBS): Ditto; (TARGET_ZBA):Ditto; (TARGET_ZBB):Ditto; (TARGET_ZBC):Ditto; (TARGET_ZBS):Ditto; (MASK_ZFINX):Ditto; (MASK_ZDINX):Ditto; (MASK_ZHINX):Ditto; (MASK_ZHINXMIN): Ditto; (TARGET_ZFINX): Ditto; (TARGET_ZDINX): Ditto; (TARGET_ZHINX): Ditto; (TARGET_ZHINXMIN): Ditto; (MASK_ZBKB): Ditto; (MASK_ZBKC): Ditto; (MASK_ZBKX): Ditto; (MASK_ZKNE): Ditto; (MASK_ZKND): Ditto; (MASK_ZKNH): Ditto; (MASK_ZKR): Ditto; (MASK_ZKSED):Ditto; (MASK_ZKSH): Ditto; (MASK_ZKT): Ditto; (TARGET_ZBKB): Ditto; (TARGET_ZBKC): Ditto; (TARGET_ZBKX): Ditto; (TARGET_ZKNE): Ditto; (TARGET_ZKND): Ditto; (TARGET_ZKNH): Ditto; (TARGET_ZKR):Ditto; (TARGET_ZKSED): Ditto; (TARGET_ZKSH): Ditto; (TARGET_ZKT):Ditto; (MASK_ZTSO): Ditto; (TARGET_ZTSO): Ditto; (MASK_VECTOR_ELEN_32): Ditto; (MASK_VECTOR_ELEN_64): Ditto; (MASK_VECTOR_ELEN_FP_32):Ditto; (MASK_VECTOR_ELEN_FP_64):Ditto; (MASK_VECTOR_ELEN_FP_16):Ditto; (TARGET_VECTOR_ELEN_32): Ditto; (TARGET_VECTOR_ELEN_64): Ditto; (TARGET_VECTOR_ELEN_FP_32):Ditto; (TARGET_VECTOR_ELEN_FP_64):Ditto; (TARGET_VECTOR_ELEN_FP_16):Ditto; (MASK_ZVBB): Ditto; (MASK_ZVBC): Ditto; (TARGET_ZVBB): Ditto; (TARGET_ZVBC): Ditto; (MASK_ZVKG): Ditto; (MASK_ZVKNED): Ditto; (MASK_ZVKNHA): Ditto; (MASK_ZVKNHB): Ditto; (MASK_ZVKSED): Ditto; (MASK_ZVKSH): Ditto; (MASK_ZVKN): Ditto; (MASK_ZVKNC): Ditto; (MASK_ZVKNG): Ditto; (MASK_ZVKS): Ditto; (MASK_ZVKSC): Ditto; (MASK_ZVKSG): Ditto; (MASK_ZVKT): Ditto; (TARGET_ZVKG): Ditto; (TARGET_ZVKNED): Ditto; (TARGET_ZVKNHA): Ditto; (TARGET_ZVKNHB): Ditto; (TARGET_ZVKSED): Ditto; (TARGET_ZVKSH):Ditto; (TARGET_ZVKN): Ditto; (TARGET_ZVKNC):Ditto; (TARGET_ZVKNG):Ditto; (TARGET_ZVKS): Ditto; (TARGET_ZVKSC):Ditto; (TARGET_ZVKSG):Ditto; (TARGET_ZVKT): Ditto; (MASK_ZVL32B): Ditto; (MASK_ZVL64B): Ditto; (MASK_ZVL128B):Ditto; (MASK_ZVL256B):Ditto; (MASK_ZVL512B):Ditto; (MASK_ZVL1024B): Ditto; (MASK_ZVL2048B): Ditto; (MASK_ZVL4096B): Ditto; (MASK_ZVL8192B): Ditto; (MASK_ZVL16384B): Ditto; (MASK_ZVL32768B): Ditto; (MASK_ZVL65536B): Ditto; (TARGET_ZVL32B): Ditto; (TARGET_ZVL64B): Ditto; (TARGET_ZVL128B): Ditto; (TARGET_ZVL256B): Ditto; (TARGET_ZVL512B): Ditto; (TARGET_ZVL1024B): Ditto; (TARGET_ZVL2048B): Ditto; (TARGET_ZVL4096B): Ditto; (TARGET_ZVL8192B): Ditto; (TARGET_ZVL16384B):Ditto; (TARGET_ZVL32768B):Ditto; (TARGET_ZVL65536B):Ditto; (MASK_ZICBOZ): Ditto; (MASK_ZICBOM):
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
On 9/29/23 12:05, Kito Cheng wrote: Hi Jeff: Could you take a look for this? RISC-V part is ok to me. Thanks :) Yea, I've got two things on my list to review from a doc standpoint. This is one of 'em. jeff
Re: [PATCH v6] RISC-V:Optimize the MASK opt generation
Hi Jeff: Could you take a look for this? RISC-V part is ok to me. Thanks :) Feng Wang 於 2023年9月12日 週二 17:18 寫道: > New patch add some comments and update docs for this new usage. > --- > Accoring to Kito's advice, using "MASK(name) Var(other_flag_name)" > to generate MASK and TARGET MACRO automatically. > This patch improve the MACRO generation of MASK_* and TARGET_*. > Due to the more and more riscv extensions are added, the default > target_flag > is full. > Before this patch,if you want to add new MACRO,you should define the > MACRO in the riscv-opts.h manually. > After this patch, you just need two steps: > 1.Define the new TargetVariable. > 2.Define "MASK(name) Var(new_target_flag). > > gcc/ChangeLog: > > * config/riscv/riscv-opts.h (MASK_ZICSR): > (MASK_ZIFENCEI): Delete; > (MASK_ZIHINTNTL):Ditto; > (MASK_ZIHINTPAUSE): Ditto; > (TARGET_ZICSR): Ditto; > (TARGET_ZIFENCEI): Ditto; > (TARGET_ZIHINTNTL): Ditto; > (TARGET_ZIHINTPAUSE):Ditto; > (MASK_ZAWRS):Ditto; > (TARGET_ZAWRS): Ditto; > (MASK_ZBA): Ditto; > (MASK_ZBB): Ditto; > (MASK_ZBC): Ditto; > (MASK_ZBS): Ditto; > (TARGET_ZBA):Ditto; > (TARGET_ZBB):Ditto; > (TARGET_ZBC):Ditto; > (TARGET_ZBS):Ditto; > (MASK_ZFINX):Ditto; > (MASK_ZDINX):Ditto; > (MASK_ZHINX):Ditto; > (MASK_ZHINXMIN): Ditto; > (TARGET_ZFINX): Ditto; > (TARGET_ZDINX): Ditto; > (TARGET_ZHINX): Ditto; > (TARGET_ZHINXMIN): Ditto; > (MASK_ZBKB): Ditto; > (MASK_ZBKC): Ditto; > (MASK_ZBKX): Ditto; > (MASK_ZKNE): Ditto; > (MASK_ZKND): Ditto; > (MASK_ZKNH): Ditto; > (MASK_ZKR): Ditto; > (MASK_ZKSED):Ditto; > (MASK_ZKSH): Ditto; > (MASK_ZKT): Ditto; > (TARGET_ZBKB): Ditto; > (TARGET_ZBKC): Ditto; > (TARGET_ZBKX): Ditto; > (TARGET_ZKNE): Ditto; > (TARGET_ZKND): Ditto; > (TARGET_ZKNH): Ditto; > (TARGET_ZKR):Ditto; > (TARGET_ZKSED): Ditto; > (TARGET_ZKSH): Ditto; > (TARGET_ZKT):Ditto; > (MASK_ZTSO): Ditto; > (TARGET_ZTSO): Ditto; > (MASK_VECTOR_ELEN_32): Ditto; > (MASK_VECTOR_ELEN_64): Ditto; > (MASK_VECTOR_ELEN_FP_32):Ditto; > (MASK_VECTOR_ELEN_FP_64):Ditto; > (MASK_VECTOR_ELEN_FP_16):Ditto; > (TARGET_VECTOR_ELEN_32): Ditto; > (TARGET_VECTOR_ELEN_64): Ditto; > (TARGET_VECTOR_ELEN_FP_32):Ditto; > (TARGET_VECTOR_ELEN_FP_64):Ditto; > (TARGET_VECTOR_ELEN_FP_16):Ditto; > (MASK_ZVBB): Ditto; > (MASK_ZVBC): Ditto; > (TARGET_ZVBB): Ditto; > (TARGET_ZVBC): Ditto; > (MASK_ZVKG): Ditto; > (MASK_ZVKNED): Ditto; > (MASK_ZVKNHA): Ditto; > (MASK_ZVKNHB): Ditto; > (MASK_ZVKSED): Ditto; > (MASK_ZVKSH): Ditto; > (MASK_ZVKN): Ditto; > (MASK_ZVKNC): Ditto; > (MASK_ZVKNG): Ditto; > (MASK_ZVKS): Ditto; > (MASK_ZVKSC): Ditto; > (MASK_ZVKSG): Ditto; > (MASK_ZVKT): Ditto; > (TARGET_ZVKG): Ditto; > (TARGET_ZVKNED): Ditto; > (TARGET_ZVKNHA): Ditto; > (TARGET_ZVKNHB): Ditto; > (TARGET_ZVKSED): Ditto; > (TARGET_ZVKSH):Ditto; > (TARGET_ZVKN): Ditto; > (TARGET_ZVKNC):Ditto; > (TARGET_ZVKNG):Ditto; > (TARGET_ZVKS): Ditto; > (TARGET_ZVKSC):Ditto; > (TARGET_ZVKSG):Ditto; > (TARGET_ZVKT): Ditto; > (MASK_ZVL32B): Ditto; > (MASK_ZVL64B): Ditto; > (MASK_ZVL128B):Ditto; > (MASK_ZVL256B):Ditto; > (MASK_ZVL512B):Ditto; > (MASK_ZVL1024B): Ditto; > (MASK_ZVL2048B): Ditto; > (MASK_ZVL4096B): Ditto; > (MASK_ZVL8192B): Ditto; > (MASK_ZVL16384B): Ditto; > (MASK_ZVL32768B): Ditto; > (MASK_ZVL65536B): Ditto; > (TARGET_ZVL32B): Ditto; > (TARGET_ZVL64B): Ditto; > (TARGET_ZVL128B): Ditto; > (TARGET_ZVL256B): Ditto; > (TARGET_ZVL512B): Ditto; > (TARGET_ZVL1024B): Ditto; > (TARGET_ZVL2048B): Ditto; > (TARGET_ZVL4096B): Ditto; >
[PATCH v6] RISC-V:Optimize the MASK opt generation
New patch add some comments and update docs for this new usage. --- Accoring to Kito's advice, using "MASK(name) Var(other_flag_name)" to generate MASK and TARGET MACRO automatically. This patch improve the MACRO generation of MASK_* and TARGET_*. Due to the more and more riscv extensions are added, the default target_flag is full. Before this patch,if you want to add new MACRO,you should define the MACRO in the riscv-opts.h manually. After this patch, you just need two steps: 1.Define the new TargetVariable. 2.Define "MASK(name) Var(new_target_flag). gcc/ChangeLog: * config/riscv/riscv-opts.h (MASK_ZICSR): (MASK_ZIFENCEI): Delete; (MASK_ZIHINTNTL):Ditto; (MASK_ZIHINTPAUSE): Ditto; (TARGET_ZICSR): Ditto; (TARGET_ZIFENCEI): Ditto; (TARGET_ZIHINTNTL): Ditto; (TARGET_ZIHINTPAUSE):Ditto; (MASK_ZAWRS):Ditto; (TARGET_ZAWRS): Ditto; (MASK_ZBA): Ditto; (MASK_ZBB): Ditto; (MASK_ZBC): Ditto; (MASK_ZBS): Ditto; (TARGET_ZBA):Ditto; (TARGET_ZBB):Ditto; (TARGET_ZBC):Ditto; (TARGET_ZBS):Ditto; (MASK_ZFINX):Ditto; (MASK_ZDINX):Ditto; (MASK_ZHINX):Ditto; (MASK_ZHINXMIN): Ditto; (TARGET_ZFINX): Ditto; (TARGET_ZDINX): Ditto; (TARGET_ZHINX): Ditto; (TARGET_ZHINXMIN): Ditto; (MASK_ZBKB): Ditto; (MASK_ZBKC): Ditto; (MASK_ZBKX): Ditto; (MASK_ZKNE): Ditto; (MASK_ZKND): Ditto; (MASK_ZKNH): Ditto; (MASK_ZKR): Ditto; (MASK_ZKSED):Ditto; (MASK_ZKSH): Ditto; (MASK_ZKT): Ditto; (TARGET_ZBKB): Ditto; (TARGET_ZBKC): Ditto; (TARGET_ZBKX): Ditto; (TARGET_ZKNE): Ditto; (TARGET_ZKND): Ditto; (TARGET_ZKNH): Ditto; (TARGET_ZKR):Ditto; (TARGET_ZKSED): Ditto; (TARGET_ZKSH): Ditto; (TARGET_ZKT):Ditto; (MASK_ZTSO): Ditto; (TARGET_ZTSO): Ditto; (MASK_VECTOR_ELEN_32): Ditto; (MASK_VECTOR_ELEN_64): Ditto; (MASK_VECTOR_ELEN_FP_32):Ditto; (MASK_VECTOR_ELEN_FP_64):Ditto; (MASK_VECTOR_ELEN_FP_16):Ditto; (TARGET_VECTOR_ELEN_32): Ditto; (TARGET_VECTOR_ELEN_64): Ditto; (TARGET_VECTOR_ELEN_FP_32):Ditto; (TARGET_VECTOR_ELEN_FP_64):Ditto; (TARGET_VECTOR_ELEN_FP_16):Ditto; (MASK_ZVBB): Ditto; (MASK_ZVBC): Ditto; (TARGET_ZVBB): Ditto; (TARGET_ZVBC): Ditto; (MASK_ZVKG): Ditto; (MASK_ZVKNED): Ditto; (MASK_ZVKNHA): Ditto; (MASK_ZVKNHB): Ditto; (MASK_ZVKSED): Ditto; (MASK_ZVKSH): Ditto; (MASK_ZVKN): Ditto; (MASK_ZVKNC): Ditto; (MASK_ZVKNG): Ditto; (MASK_ZVKS): Ditto; (MASK_ZVKSC): Ditto; (MASK_ZVKSG): Ditto; (MASK_ZVKT): Ditto; (TARGET_ZVKG): Ditto; (TARGET_ZVKNED): Ditto; (TARGET_ZVKNHA): Ditto; (TARGET_ZVKNHB): Ditto; (TARGET_ZVKSED): Ditto; (TARGET_ZVKSH):Ditto; (TARGET_ZVKN): Ditto; (TARGET_ZVKNC):Ditto; (TARGET_ZVKNG):Ditto; (TARGET_ZVKS): Ditto; (TARGET_ZVKSC):Ditto; (TARGET_ZVKSG):Ditto; (TARGET_ZVKT): Ditto; (MASK_ZVL32B): Ditto; (MASK_ZVL64B): Ditto; (MASK_ZVL128B):Ditto; (MASK_ZVL256B):Ditto; (MASK_ZVL512B):Ditto; (MASK_ZVL1024B): Ditto; (MASK_ZVL2048B): Ditto; (MASK_ZVL4096B): Ditto; (MASK_ZVL8192B): Ditto; (MASK_ZVL16384B): Ditto; (MASK_ZVL32768B): Ditto; (MASK_ZVL65536B): Ditto; (TARGET_ZVL32B): Ditto; (TARGET_ZVL64B): Ditto; (TARGET_ZVL128B): Ditto; (TARGET_ZVL256B): Ditto; (TARGET_ZVL512B): Ditto; (TARGET_ZVL1024B): Ditto; (TARGET_ZVL2048B): Ditto; (TARGET_ZVL4096B): Ditto; (TARGET_ZVL8192B): Ditto; (TARGET_ZVL16384B):Ditto; (TARGET_ZVL32768B):Ditto; (TARGET_ZVL65536B):Ditto; (MASK_ZICBOZ): Ditto; (MASK_ZICBOM): Ditto; (MASK_ZICBOP): Ditto; (TARGET_ZICBOZ): Ditto; (TARGET_ZICBOM): Ditto; (TARGET_ZICBOP):