public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/102464] Miss optimization for (_Float16) sqrtf ((float) f16)
Date: Tue, 19 Oct 2021 03:28:57 +0000	[thread overview]
Message-ID: <bug-102464-4-X5CMZQZLh5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102464-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102464

--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> There's related optimizations in convert () which should ideally move to
> match.pd

When i try to mov convert stuffs to match.pd, i find some "mismatch", there's 3
cases
1. math functions are transformed under condition "optimize"
2. math functions are transformed under condition "optimize &&
flag_unsafe_math_optimizations"
3. math functions are transformed under condition "optimize &&
flag_unsafe_math_optimizations flag_errno_maths"

And for logb, it's case 1, which means it can be transformed w/o
!flag_errno_maths, but according to DEF_C99_BUILTIN        (BUILT_IN_LOGB,
"logb", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO), !flag_errno_maths
is needed and the transformation will be prevented by
gimple-match-head.c:maybe_push_res_to_seq

          /* We can't and should not emit calls to non-const functions.  */
          if (!(flags_from_decl_or_type (decl) & ECF_CONST))
            return NULL;


/* fabsl (extend(x)) -> extend(fabsf(x)), etc., if x is a float.  */
(for froms (BUILT_IN_FABS BUILT_IN_FABSL
            BUILT_IN_LOGB BUILT_IN_LOGBL)
     tos (BUILT_IN_FABSF BUILT_IN_FABSF
          BUILT_IN_LOGBF BUILT_IN_LOGBF)
(simplify
  (froms (convert float_value_p@0))
    (if (optimize && canonicalize_math_p ()
         && mathfn_built_in (TREE_TYPE (@0), froms))
      (convert (tos @0)))))

  parent reply	other threads:[~2021-10-19  3:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23  5:55 [Bug middle-end/102464] New: " crazylht at gmail dot com
2021-09-23  5:59 ` [Bug middle-end/102464] " crazylht at gmail dot com
2021-09-23  6:01 ` pinskia at gcc dot gnu.org
2021-09-23  6:53 ` rguenth at gcc dot gnu.org
2021-09-23 20:19 ` joseph at codesourcery dot com
2021-09-24  9:45 ` crazylht at gmail dot com
2021-09-24 10:06 ` crazylht at gmail dot com
2021-10-08  2:10 ` cvs-commit at gcc dot gnu.org
2021-10-19  3:28 ` crazylht at gmail dot com [this message]
2021-10-25  8:54 ` cvs-commit at gcc dot gnu.org
2021-10-29  1:46 ` cvs-commit at gcc dot gnu.org
2021-11-04  8:10 ` cvs-commit at gcc dot gnu.org
2021-11-08  1:31 ` cvs-commit at gcc dot gnu.org
2021-11-08  1:38 ` cvs-commit at gcc dot gnu.org
2021-11-10  6:31 ` cvs-commit at gcc dot gnu.org
2022-02-15  6:44 ` crazylht at gmail dot com
2022-06-27 12:39 ` jbeulich at suse dot com
2022-06-27 13:35 ` jbeulich at suse dot com

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-102464-4-X5CMZQZLh5@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).