aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-06-02 08:44:37 +0200
committerMartin Liska <mliska@suse.cz>2021-10-01 11:09:10 +0200
commit6de9f0c13b27c34336587da19d03200f8cc6bcd5 (patch)
tree3823c11c2c1796289a7516f9a94976ee601b2bb8 /gcc/c-family/c-common.c
parent97909f80fde6c4ce2a2fa1e11b325a80c4741b8c (diff)
downloadgcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.zip
gcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.tar.gz
gcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.tar.bz2
Append target/optimize attr to the current cmdline.
gcc/c-family/ChangeLog: * c-common.c (parse_optimize_options): Combine optimize options with what was provided on the command line. gcc/ChangeLog: * toplev.c (toplev::main): Save decoded optimization options. * toplev.h (save_opt_decoded_options): New. * doc/extend.texi: Be more clear about optimize and target attributes. gcc/testsuite/ChangeLog: * gcc.target/i386/avx512er-vrsqrt28ps-3.c: Disable fast math. * gcc.target/i386/avx512er-vrsqrt28ps-5.c: Likewise. * gcc.target/i386/attr-optimize.c: New test.
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r--gcc/c-family/c-common.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index c6757f0..7b99a55 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5904,9 +5904,22 @@ parse_optimize_options (tree args, bool attr_p)
j++;
}
decoded_options_count = j;
- /* And apply them. */
+
+ /* Merge the decoded options with save_decoded_options. */
+ unsigned save_opt_count = save_opt_decoded_options.length ();
+ unsigned merged_decoded_options_count
+ = save_opt_count + decoded_options_count;
+ cl_decoded_option *merged_decoded_options
+ = XNEWVEC (cl_decoded_option, merged_decoded_options_count);
+
+ for (unsigned i = 0; i < save_opt_count; ++i)
+ merged_decoded_options[i] = save_opt_decoded_options[i];
+ for (unsigned i = 0; i < decoded_options_count; ++i)
+ merged_decoded_options[save_opt_count + i] = decoded_options[i];
+
+ /* And apply them. */
decode_options (&global_options, &global_options_set,
- decoded_options, decoded_options_count,
+ merged_decoded_options, merged_decoded_options_count,
input_location, global_dc, NULL);
free (decoded_options);