aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-09-03 10:53:00 +0200
committerMartin Liska <mliska@suse.cz>2021-09-27 16:58:37 +0200
commita64697d7a3e0bf9e5b0d79e253f2b7dc3eb2fb00 (patch)
tree93af7a8ed8a199673d1b446e7d23cba2623d270e /gcc/opts.c
parent3e6a511b94fd653d8d03491eae20307bd27b8f8e (diff)
downloadgcc-a64697d7a3e0bf9e5b0d79e253f2b7dc3eb2fb00.zip
gcc-a64697d7a3e0bf9e5b0d79e253f2b7dc3eb2fb00.tar.gz
gcc-a64697d7a3e0bf9e5b0d79e253f2b7dc3eb2fb00.tar.bz2
flag_complex_method: support optimize attribute
gcc/c-family/ChangeLog: * c-opts.c (c_common_init_options_struct): Set also x_flag_default_complex_method. gcc/ChangeLog: * common.opt: Add new variable flag_default_complex_method. * opts.c (finish_options): Handle flags related to x_flag_complex_method. * toplev.c (process_options): Remove option handling related to flag_complex_method. gcc/go/ChangeLog: * go-lang.c (go_langhook_init_options_struct): Set also x_flag_default_complex_method. gcc/lto/ChangeLog: * lto-lang.c (lto_init_options_struct): Set also x_flag_default_complex_method. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/attr-complex-method-2.c: New test. * gcc.c-torture/compile/attr-complex-method.c: New test.
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 1d2d22d..38b42db 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1331,6 +1331,18 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
= (opts->x_flag_unroll_loops
|| opts->x_flag_peel_loops
|| opts->x_optimize >= 3);
+
+ /* With -fcx-limited-range, we do cheap and quick complex arithmetic. */
+ if (opts->x_flag_cx_limited_range)
+ opts->x_flag_complex_method = 0;
+ else if (opts_set->x_flag_cx_limited_range)
+ opts->x_flag_complex_method = opts->x_flag_default_complex_method;
+
+ /* With -fcx-fortran-rules, we do something in-between cheap and C99. */
+ if (opts->x_flag_cx_fortran_rules)
+ opts->x_flag_complex_method = 1;
+ else if (opts_set->x_flag_cx_fortran_rules)
+ opts->x_flag_complex_method = opts->x_flag_default_complex_method;
}
#define LEFT_COLUMN 27