public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-8261] i386: Fix up ICE with -mveclibabi={acml, svml} [PR105367]
Date: Tue, 26 Apr 2022 07:40:38 +0000 (GMT)	[thread overview]
Message-ID: <20220426074038.54E933858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:5face32b7f439bba283e2eeb2a50f192d605bf57

commit r12-8261-g5face32b7f439bba283e2eeb2a50f192d605bf57
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 26 09:40:03 2022 +0200

    i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]
    
    The following testcase ICEs, because conversion between scalar float types
    which have the same mode are useless in GIMPLE, but for mathfn_built_in the
    exact type matters (it treats say double and _Float64 or float and _Float32
    differently, using different suffixes and for the _Float* sometimes
    returning NULL when float/double do have a builtin).
    
    In ix86_veclibabi_{svml,acml} we are using mathfn_built_in just so that
    we don't have to translate the combined_fn and SFmode vs. DFmode into
    strings ourselfs, and we already earlier punt on anything but SFmode and
    DFmode.  So, this patch just uses the double or float types depending
    on the modes, rather than the types we actually got and which might be
    _Float64 or _Float32 etc.
    
    2022-04-26  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/105367
            * config/i386/i386.cc (ix86_veclibabi_svml, ix86_veclibabi_acml): Pass
            el_mode == DFmode ? double_type_node : float_type_node instead of
            TREE_TYPE (type_in) as first arguments to mathfn_built_in.
    
            * gcc.target/i386/pr105367.c: New test.

Diff:
---
 gcc/config/i386/i386.cc                  |  6 ++++--
 gcc/testsuite/gcc.target/i386/pr105367.c | 12 ++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 8d8b094889f..52040da8c47 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -18807,7 +18807,8 @@ ix86_veclibabi_svml (combined_fn fn, tree type_out, tree type_in)
       return NULL_TREE;
     }
 
-  tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn);
+  tree fndecl = mathfn_built_in (el_mode == DFmode
+				 ? double_type_node : float_type_node, fn);
   bname = IDENTIFIER_POINTER (DECL_NAME (fndecl));
 
   if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LOGF)
@@ -18899,7 +18900,8 @@ ix86_veclibabi_acml (combined_fn fn, tree type_out, tree type_in)
       return NULL_TREE;
     }
 
-  tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn);
+  tree fndecl = mathfn_built_in (el_mode == DFmode
+				 ? double_type_node : float_type_node, fn);
   bname = IDENTIFIER_POINTER (DECL_NAME (fndecl));
   sprintf (name + 7, "%s", bname+10);
 
diff --git a/gcc/testsuite/gcc.target/i386/pr105367.c b/gcc/testsuite/gcc.target/i386/pr105367.c
new file mode 100644
index 00000000000..558e3e58e4e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr105367.c
@@ -0,0 +1,12 @@
+/* PR target/105367 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -mveclibabi=acml" } */
+
+_Float64 g;
+
+void
+foo (void)
+{
+  _Float64 f = __builtin_sin (g);
+  g = __builtin_fmax (__builtin_sin (f), f);
+}


                 reply	other threads:[~2022-04-26  7:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220426074038.54E933858D1E@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@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).