public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math
@ 2013-03-06 1:03 olegendo at gcc dot gnu.org
2013-05-16 21:45 ` [Bug tree-optimization/56547] " olegendo at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-03-06 1:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
Bug #: 56547
Summary: [SH] missed opportunity for fmac with -ffast-math
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: olegendo@gcc.gnu.org
Target: sh*-*-*
This one was mentioned in PR 55295:
float test (float a, float b)
{
return a * b + a;
}
compiled with -m4-single -O2 -ffast-math results in:
fldi1 fr0 ! 7 movsf_ie/4 [length = 2]
fadd fr5,fr0 ! 8 addsf3_i [length = 2]
rts ! 27 *return_i [length = 2]
fmul fr4,fr0 ! 9 mulsf3_i [length = 2]
At least on SH using fmac in this case would be better than transforming
'a * b + a' into '(1 + b) * a'. Not sure yet whether this is actually target
specific.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
@ 2013-05-16 21:45 ` olegendo at gcc dot gnu.org
2013-05-20 16:25 ` olegendo at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-05-16 21:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-05-16
Component|target |tree-optimization
Ever confirmed|0 |1
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
This looks like a tree optimization issue.
In tree-ssa-math-ops.c, the function 'convert_mult_to_fma' bails out in the
first for-each at:
if (!is_gimple_assign (use_stmt))
return false;
Apart from that, it still might be a good idea to put the SH fmac combine
patterns back, which I removed when adding support for the FMA patterns.
The following should do.
Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md (revision 198802)
+++ gcc/config/sh/sh.md (working copy)
@@ -12285,6 +12285,29 @@
"fmac.s %1, %2, %0"
[(set_attr "type" "fparith_media")])
+;; For some cases such as 'a * b + a' the FMA pattern is not generated by
+;; previous transformations. If FMA is generally allowed, let the combine
+;; pass utilize it.
+(define_insn "*fmasf4"
+ [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f")
+ (plus:SF (mult:SF (match_operand:SF 1 "fp_arith_reg_operand" "%w")
+ (match_operand:SF 2 "fp_arith_reg_operand" "f"))
+ (match_operand:SF 3 "arith_reg_operand" "0")))
+ (use (match_operand:PSI 4 "fpscr_operand" "c"))]
+ "TARGET_SH2E && flag_fp_contract_mode != FP_CONTRACT_OFF"
+ "fmac %1,%2,%0"
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
+
+(define_insn "*fmasf4_media"
+ [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f")
+ (plus:SF (mult:SF (match_operand:SF 1 "fp_arith_reg_operand" "%f")
+ (match_operand:SF 2 "fp_arith_reg_operand" "f"))
+ (match_operand:SF 3 "fp_arith_reg_operand" "0")))]
+ "TARGET_SHMEDIA_FPU && flag_fp_contract_mode != FP_CONTRACT_OFF"
+ "fmac.s %1, %2, %0"
+ [(set_attr "type" "fparith_media")])
+
(define_expand "divsf3"
[(set (match_operand:SF 0 "arith_reg_operand" "")
(div:SF (match_operand:SF 1 "arith_reg_operand" "")
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
2013-05-16 21:45 ` [Bug tree-optimization/56547] " olegendo at gcc dot gnu.org
@ 2013-05-20 16:25 ` olegendo at gcc dot gnu.org
2013-06-09 22:03 ` olegendo at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-05-20 16:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Fixed for SH on 4.9:
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=199110
gcc/ChangeLog:
PR target/56547
* config/sh/sh.md (fmasf4): Remove empty constraints strings.
(*fmasf4, *fmasf4_media): New insns.
gcc/testsuite/ChangeLog:
PR target/56547
* gcc.target/sh/pr56547-1.c: New.
* gcc.target/sh/pr56547-2.c: New.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
2013-05-16 21:45 ` [Bug tree-optimization/56547] " olegendo at gcc dot gnu.org
2013-05-20 16:25 ` olegendo at gcc dot gnu.org
@ 2013-06-09 22:03 ` olegendo at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-06-09 22:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Fixed for SH on 4.8:
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=199874
PR target/56547
* config/sh/sh.md (fmasf4): Remove empty constraints strings.
(*fmasf4, *fmasf4_media): New insns.
gcc/testsuite/ChangeLog:
PR target/56547
* gcc.target/sh/pr56547-1.c: New.
* gcc.target/sh/pr56547-2.c: New.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
` (2 preceding siblings ...)
2013-06-09 22:03 ` olegendo at gcc dot gnu.org
@ 2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asd0025 at gmail dot com
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86999 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
` (3 preceding siblings ...)
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
@ 2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chtz at informatik dot uni-bremen.
| |de
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 98429 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
` (4 preceding siblings ...)
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
@ 2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:38 ` [Bug tree-optimization/56547] missed opportunity for FMA " pinskia at gcc dot gnu.org
2021-09-07 6:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mkretz at gcc dot gnu.org
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102219 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] missed opportunity for FMA with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
` (5 preceding siblings ...)
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
@ 2021-09-06 18:38 ` pinskia at gcc dot gnu.org
2021-09-07 6:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 18:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>Not sure yet whether this is actually target specific.
It is not.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/56547] missed opportunity for FMA with -ffast-math
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
` (6 preceding siblings ...)
2021-09-06 18:38 ` [Bug tree-optimization/56547] missed opportunity for FMA " pinskia at gcc dot gnu.org
@ 2021-09-07 6:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-07 6:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56547
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's fold_plusminus_mult_expr doing this on GENERIC already. I suppose FMA
detection might want to consider undoing this. It's also questionable whether
transforming a * b + a this way is profitable but I guess the idea is to
catch followup opportunities.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-09-07 6:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06 1:03 [Bug target/56547] New: [SH] missed opportunity for fmac with -ffast-math olegendo at gcc dot gnu.org
2013-05-16 21:45 ` [Bug tree-optimization/56547] " olegendo at gcc dot gnu.org
2013-05-20 16:25 ` olegendo at gcc dot gnu.org
2013-06-09 22:03 ` olegendo at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:37 ` pinskia at gcc dot gnu.org
2021-09-06 18:38 ` [Bug tree-optimization/56547] missed opportunity for FMA " pinskia at gcc dot gnu.org
2021-09-07 6:43 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).