diff mbox

[GOOGLE] Prevent x_flag_complex_method to be set to 2 for C++.

Message ID CAK=A3=2JTtu2onnoRi-t1qC=SVw4TSiHpQmCKTa3sYKPn=5egg@mail.gmail.com
State New
Headers show

Commit Message

Cong Hou Feb. 12, 2014, 1:30 a.m. UTC
With this patch x_flag_complex_method won't be set to 2 for C++ so
that multiply/divide between std::complex objects won't be replaced by
expensive builtin function calls.

Bootstrapped and passed regression test.

OK for Google branch?


thanks,
Cong

Comments

Xinliang David Li Feb. 12, 2014, 1:35 a.m. UTC | #1
ok.

David

On Tue, Feb 11, 2014 at 5:30 PM, Cong Hou <congh@google.com> wrote:
> With this patch x_flag_complex_method won't be set to 2 for C++ so
> that multiply/divide between std::complex objects won't be replaced by
> expensive builtin function calls.
>
> Bootstrapped and passed regression test.
>
> OK for Google branch?
>
>
> thanks,
> Cong
>
>
>
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c (revision 207701)
> +++ gcc/c-family/c-opts.c (working copy)
> @@ -204,8 +204,10 @@ c_common_init_options_struct (struct gcc
>    opts->x_warn_write_strings = c_dialect_cxx ();
>    opts->x_flag_warn_unused_result = true;
>
> -  /* By default, C99-like requirements for complex multiply and divide.  */
> -  opts->x_flag_complex_method = 2;
> +  /* By default, C99-like requirements for complex multiply and divide.
> +     But for C++ this should not be required.  */
> +  if (c_language != clk_cxx)
> +    opts->x_flag_complex_method = 2;
>  }
>
>  /* Common initialization before calling option handlers.  */
diff mbox

Patch

Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c (revision 207701)
+++ gcc/c-family/c-opts.c (working copy)
@@ -204,8 +204,10 @@  c_common_init_options_struct (struct gcc
   opts->x_warn_write_strings = c_dialect_cxx ();
   opts->x_flag_warn_unused_result = true;

-  /* By default, C99-like requirements for complex multiply and divide.  */
-  opts->x_flag_complex_method = 2;
+  /* By default, C99-like requirements for complex multiply and divide.
+     But for C++ this should not be required.  */
+  if (c_language != clk_cxx)
+    opts->x_flag_complex_method = 2;
 }

 /* Common initialization before calling option handlers.  */