public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113993] ICE: in get_no_error_domain, at tree-call-cdce.cc:815 with __builtin_exp2f32x() at -O1 and above
Date: Tue, 20 Feb 2024 00:05:30 +0000	[thread overview]
Message-ID: <bug-113993-4-Nu9mKwhdZj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113993-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Following is much shorter:
--- gcc/tree-call-cdce.cc.jj    2024-01-03 11:51:37.654646209 +0100
+++ gcc/tree-call-cdce.cc       2024-02-20 01:04:42.896987568 +0100
@@ -677,14 +677,14 @@ gen_conditions_for_pow (gcall *pow_call,
    Since IEEE only sets minimum requirements for long double format,
    different long double formats exist under different implementations
    (e.g, 64 bit double precision (DF), 80 bit double-extended
-   precision (XF), and 128 bit quad precision (QF) ).  For simplicity,
+   precision (XF), and 128 bit quad precision (TF) ).  For simplicity,
    in this implementation, the computed bounds for long double assume
-   64 bit format (DF), and are therefore conservative.  Another
-   assumption is that single precision float type is always SF mode,
-   and double type is DF mode.  This function is quite
-   implementation specific, so it may not be suitable to be part of
-   builtins.cc.  This needs to be revisited later to see if it can
-   be leveraged in x87 assembly expansion.  */
+   64 bit format (DF) except when it is IEEE quad or extended with the same
+   emax, and are therefore sometimes conservative.  Another assumption is
+   that single precision float type is always SF mode, and double type is DF
+   mode.  This function is quite implementation specific, so it may not be
+   suitable to be part of builtins.cc.  This needs to be revisited later
+   to see if it can be leveraged in x87 assembly expansion.  */

 static inp_domain
 get_no_error_domain (enum built_in_function fnc)
@@ -723,10 +723,10 @@ get_no_error_domain (enum built_in_funct
                          89, true, false);
     case BUILT_IN_COSH:
     case BUILT_IN_SINH:
-    case BUILT_IN_COSHL:
-    case BUILT_IN_SINHL:
     case BUILT_IN_COSHF64:
     case BUILT_IN_SINHF64:
+    case BUILT_IN_COSHF32X:
+    case BUILT_IN_SINHF32X:
       /* cosh: (-710, +710)  */
       return get_domain (-710, true, false,
                          710, true, false);
@@ -735,6 +735,16 @@ get_no_error_domain (enum built_in_funct
       /* coshf128: (-11357, +11357)  */
       return get_domain (-11357, true, false,
                         11357, true, false);
+    case BUILT_IN_COSHL:
+    case BUILT_IN_SINHL:
+      if (REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_COSHF128);
+      return get_no_error_domain (BUILT_IN_COSH);
+    case BUILT_IN_COSHF64X:
+    case BUILT_IN_SINHF64X:
+      if (REAL_MODE_FORMAT (TYPE_MODE (float64x_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_COSHF128);
+      return get_no_error_domain (BUILT_IN_COSH);
     /* Log functions: (0, +inf)  */
     CASE_FLT_FN (BUILT_IN_LOG):
     CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
@@ -763,10 +773,10 @@ get_no_error_domain (enum built_in_funct
                          88, true, false);
     case BUILT_IN_EXP:
     case BUILT_IN_EXPM1:
-    case BUILT_IN_EXPL:
-    case BUILT_IN_EXPM1L:
     case BUILT_IN_EXPF64:
     case BUILT_IN_EXPM1F64:
+    case BUILT_IN_EXPF32X:
+    case BUILT_IN_EXPM1F32X:
       /* exp: (-inf, 709)  */
       return get_domain (-1, false, false,
                          709, true, false);
@@ -775,6 +785,16 @@ get_no_error_domain (enum built_in_funct
       /* expf128: (-inf, 11356)  */
       return get_domain (-1, false, false,
                         11356, true, false);
+    case BUILT_IN_EXPL:
+    case BUILT_IN_EXPM1L:
+      if (REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_EXPF128);
+      return get_no_error_domain (BUILT_IN_EXP);
+    case BUILT_IN_EXPF64X:
+    case BUILT_IN_EXPM1F64X:
+      if (REAL_MODE_FORMAT (TYPE_MODE (float64x_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_EXPF128);
+      return get_no_error_domain (BUILT_IN_EXP);
     case BUILT_IN_EXP2F16:
       /* exp2f16: (-inf, 16)  */
       return get_domain (-1, false, false,
@@ -785,8 +805,8 @@ get_no_error_domain (enum built_in_funct
       return get_domain (-1, false, false,
                          128, true, false);
     case BUILT_IN_EXP2:
-    case BUILT_IN_EXP2L:
     case BUILT_IN_EXP2F64:
+    case BUILT_IN_EXP2F32X:
       /* exp2: (-inf, 1024)  */
       return get_domain (-1, false, false,
                          1024, true, false);
@@ -794,6 +814,14 @@ get_no_error_domain (enum built_in_funct
       /* exp2f128: (-inf, 16384)  */
       return get_domain (-1, false, false,
                         16384, true, false);
+    case BUILT_IN_EXP2L:
+      if (REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_EXP2F128);
+      return get_no_error_domain (BUILT_IN_EXP2);
+    case BUILT_IN_EXP2F64X:
+      if (REAL_MODE_FORMAT (TYPE_MODE (float64x_type_node))->emax == 16384)
+       return get_no_error_domain (BUILT_IN_EXP2F128);
+      return get_no_error_domain (BUILT_IN_EXP2);
     case BUILT_IN_EXP10F:
     case BUILT_IN_POW10F:
       /* exp10f: (-inf, 38)  */
@@ -801,11 +829,16 @@ get_no_error_domain (enum built_in_funct
                          38, true, false);
     case BUILT_IN_EXP10:
     case BUILT_IN_POW10:
-    case BUILT_IN_EXP10L:
-    case BUILT_IN_POW10L:
       /* exp10: (-inf, 308)  */
       return get_domain (-1, false, false,
                          308, true, false);
+    case BUILT_IN_EXP10L:
+    case BUILT_IN_POW10L:
+      if (REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384)
+       /* exp10l: (-inf, 4932)  */
+       return get_domain (-1, false, false,
+                          4932, true, false);
+      return get_no_error_domain (BUILT_IN_EXP10);
     /* sqrt: [0, +inf)  */
     CASE_FLT_FN (BUILT_IN_SQRT):
     CASE_FLT_FN_FLOATN_NX (BUILT_IN_SQRT):

  parent reply	other threads:[~2024-02-20  0:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 14:08 [Bug tree-optimization/113993] New: " zsojka at seznam dot cz
2024-02-19 22:07 ` [Bug tree-optimization/113993] " pinskia at gcc dot gnu.org
2024-02-19 23:28 ` jakub at gcc dot gnu.org
2024-02-19 23:31 ` jakub at gcc dot gnu.org
2024-02-19 23:36 ` pinskia at gcc dot gnu.org
2024-02-19 23:49 ` jakub at gcc dot gnu.org
2024-02-20  0:05 ` jakub at gcc dot gnu.org [this message]
2024-02-20  9:06 ` jakub at gcc dot gnu.org
2024-02-22  9:20 ` cvs-commit at gcc dot gnu.org
2024-02-22  9:20 ` jakub at gcc dot gnu.org
2024-03-02  0:39 ` cvs-commit at gcc dot gnu.org
2024-03-04 12:12 ` jakub 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-113993-4-Nu9mKwhdZj@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).