* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
@ 2011-11-28 23:30 ` kkojima at gcc dot gnu.org
2011-12-19 1:30 ` oleg.endo@t-online.de
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-11-28 23:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-11-28 23:09:32 UTC ---
(In reply to comment #0)
> Is there any particular reason why this should not be enabled by
> default for SH targets that support the FMAC insn?
PR29100?
BTW, if SH fmac satisfies the semantics for fused multiplication and
add operation, the fmaf4 instruction pattern would be better now.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
2011-11-28 23:30 ` [Bug target/51340] " kkojima at gcc dot gnu.org
@ 2011-12-19 1:30 ` oleg.endo@t-online.de
2011-12-28 22:32 ` kkojima at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: oleg.endo@t-online.de @ 2011-12-19 1:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
--- Comment #2 from Oleg Endo <oleg.endo@t-online.de> 2011-12-19 01:29:12 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> > Is there any particular reason why this should not be enabled by
> > default for SH targets that support the FMAC insn?
>
> PR29100?
Uhm, yes...
The title should have been "Enable -mfused-madd by -ffast-math"
>
> BTW, if SH fmac satisfies the semantics for fused multiplication and
> add operation, the fmaf4 instruction pattern would be better now.
I don't know the exact semantics for the new patterns. All I know is that
rounding is supposed to be done only once after the two operations. This is
the case for the SH fmac insn. Not sure whether this is enough though.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
2011-11-28 23:30 ` [Bug target/51340] " kkojima at gcc dot gnu.org
2011-12-19 1:30 ` oleg.endo@t-online.de
@ 2011-12-28 22:32 ` kkojima at gcc dot gnu.org
2011-12-29 0:22 ` oleg.endo@t-online.de
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-12-28 22:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
--- Comment #3 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-12-28 22:31:27 UTC ---
(In reply to comment #2)
> Uhm, yes...
> The title should have been "Enable -mfused-madd by -ffast-math"
Do you mean something like this?
--- ORIG/trunk/gcc/config/sh/sh.c 2011-12-03 10:03:41.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2011-12-27 08:33:23.000000000 +0900
@@ -838,6 +838,11 @@ sh_option_override (void)
align_functions = min_align;
}
+ /* Default to use fmac insn when -ffast-math. See PR target/29100. */
+ if (global_options_set.x_TARGET_FMAC == 0
+ && fast_math_flags_set_p (&global_options)
+ TARGET_FMAC = 1;
+
if (sh_fixed_range_str)
sh_fix_range (sh_fixed_range_str);
> I don't know the exact semantics for the new patterns. All I know is that
> rounding is supposed to be done only once after the two operations. This is
> the case for the SH fmac insn. Not sure whether this is enough though.
It seems that we can use the fma pattern, though it would be an another issue.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
` (2 preceding siblings ...)
2011-12-28 22:32 ` kkojima at gcc dot gnu.org
@ 2011-12-29 0:22 ` oleg.endo@t-online.de
2012-05-28 22:33 ` olegendo at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: oleg.endo@t-online.de @ 2011-12-29 0:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
--- Comment #4 from Oleg Endo <oleg.endo@t-online.de> 2011-12-29 00:02:40 UTC ---
(In reply to comment #3)
> (In reply to comment #2)
> > Uhm, yes...
> > The title should have been "Enable -mfused-madd by -ffast-math"
>
> Do you mean something like this?
>
> --- ORIG/trunk/gcc/config/sh/sh.c 2011-12-03 10:03:41.000000000 +0900
> +++ trunk/gcc/config/sh/sh.c 2011-12-27 08:33:23.000000000 +0900
> @@ -838,6 +838,11 @@ sh_option_override (void)
> align_functions = min_align;
> }
>
> + /* Default to use fmac insn when -ffast-math. See PR target/29100. */
> + if (global_options_set.x_TARGET_FMAC == 0
> + && fast_math_flags_set_p (&global_options)
> + TARGET_FMAC = 1;
> +
> if (sh_fixed_range_str)
> sh_fix_range (sh_fixed_range_str);
>
Yes, something like that. Or maybe check flag_unsafe_math_optimizations, as it
is done for FSCA and FSRRA insns in sh.md.
> > I don't know the exact semantics for the new patterns. All I know is that
> > rounding is supposed to be done only once after the two operations. This is
> > the case for the SH fmac insn. Not sure whether this is enough though.
>
> It seems that we can use the fma pattern, though it would be an another issue.
Maybe when trunk is back to stage 1.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
` (3 preceding siblings ...)
2011-12-29 0:22 ` oleg.endo@t-online.de
@ 2012-05-28 22:33 ` olegendo at gcc dot gnu.org
2012-05-29 20:58 ` olegendo at gcc dot gnu.org
2012-05-29 21:15 ` olegendo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-05-28 22:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |olegendo at gcc dot gnu.org
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-05-28 22:11:31 UTC ---
(In reply to comment #4)
> >
> > It seems that we can use the fma pattern, though it would be an another issue.
>
> Maybe when trunk is back to stage 1.
Created PR 53511 for this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
` (4 preceding siblings ...)
2012-05-28 22:33 ` olegendo at gcc dot gnu.org
@ 2012-05-29 20:58 ` olegendo at gcc dot gnu.org
2012-05-29 21:15 ` olegendo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-05-29 20:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
--- Comment #6 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-05-29 20:56:02 UTC ---
Author: olegendo
Date: Tue May 29 20:55:58 2012
New Revision: 187988
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187988
Log:
PR target/51340
* config/sh/sh.c (sh_option_override): Set TARGET_FMAC if
flag_unsafe_math_optimizations is set.
* doc/invoke.texi (SH Options): Add -mno-fused-madd description.
Update description of -mfused-madd.
PR target/51340
* gcc.target/sh/pr51340-1.c: New.
* gcc.target/sh/pr51340-2.c: New.
* gcc.target/sh/pr51340-3.c: New.
Added:
trunk/gcc/testsuite/gcc.target/sh/pr51340-1.c
trunk/gcc/testsuite/gcc.target/sh/pr51340-2.c
trunk/gcc/testsuite/gcc.target/sh/pr51340-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/sh/sh.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51340] SH Target: Make -mfused-madd enabled by default
2011-11-28 22:46 [Bug target/51340] New: SH Target: Make -mfused-madd enabled by default oleg.endo@t-online.de
` (5 preceding siblings ...)
2012-05-29 20:58 ` olegendo at gcc dot gnu.org
@ 2012-05-29 21:15 ` olegendo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-05-29 21:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51340
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-05-29 21:01:30 UTC ---
-mfused-madd option is now automatically enabled when
-funsafe-math-optimizations is enabled.
^ permalink raw reply [flat|nested] 8+ messages in thread