public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/56547] [SH] missed opportunity for fmac with -ffast-math
Date: Thu, 16 May 2013 21:45:00 -0000	[thread overview]
Message-ID: <bug-56547-4-bm5qyveHMu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56547-4@http.gcc.gnu.org/bugzilla/>

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" "")


  reply	other threads:[~2013-05-16 21:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  1:03 [Bug target/56547] New: " olegendo at gcc dot gnu.org
2013-05-16 21:45 ` olegendo at gcc dot gnu.org [this message]
2013-05-20 16:25 ` [Bug tree-optimization/56547] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56547-4-bm5qyveHMu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).