public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]
@ 2022-04-26  6:53 Jakub Jelinek
  2022-04-26  7:08 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2022-04-26  6:53 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

Hi!

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.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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.

--- gcc/config/i386/i386.cc.jj	2022-04-22 13:36:42.558150777 +0200
+++ gcc/config/i386/i386.cc	2022-04-25 12:30:09.862736906 +0200
@@ -18807,7 +18807,8 @@ ix86_veclibabi_svml (combined_fn fn, tre
       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, tre
       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);
 
--- gcc/testsuite/gcc.target/i386/pr105367.c.jj	2022-04-25 12:25:16.724809778 +0200
+++ gcc/testsuite/gcc.target/i386/pr105367.c	2022-04-25 12:24:34.004403339 +0200
@@ -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);
+}

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]
  2022-04-26  6:53 [PATCH] i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367] Jakub Jelinek
@ 2022-04-26  7:08 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-04-26  7:08 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Uros Bizjak, GCC Patches

On Tue, Apr 26, 2022 at 8:54 AM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> 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.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Richard.

> 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.
>
> --- gcc/config/i386/i386.cc.jj  2022-04-22 13:36:42.558150777 +0200
> +++ gcc/config/i386/i386.cc     2022-04-25 12:30:09.862736906 +0200
> @@ -18807,7 +18807,8 @@ ix86_veclibabi_svml (combined_fn fn, tre
>        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, tre
>        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);
>
> --- gcc/testsuite/gcc.target/i386/pr105367.c.jj 2022-04-25 12:25:16.724809778 +0200
> +++ gcc/testsuite/gcc.target/i386/pr105367.c    2022-04-25 12:24:34.004403339 +0200
> @@ -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);
> +}
>
>         Jakub
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-26  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  6:53 [PATCH] i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367] Jakub Jelinek
2022-04-26  7:08 ` Richard Biener

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