public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop
@ 2024-05-02 12:18 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2024-05-02 12:18 UTC (permalink / raw)
  To: gcc-patches

The vectorizer handles a _Float16 to __bf16 conversion through
vectorizable_assignment, thinking it's a noop.  The following
fixes this by making the same-size check stricter, requiring
the same vector component mode.

Posted again for the arm CI

	PR tree-optimization/114921
	* tree-vect-stmts.cc (vectorizable_assignment): Require
	same vector component modes for input and output.
---
 gcc/tree-vect-stmts.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f8d8636b139..adb6ef53254 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5961,8 +5961,8 @@ vectorizable_assignment (vec_info *vinfo,
        || code == VIEW_CONVERT_EXPR)
       && (!vectype_in
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype_in), nunits)
-	  || maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
-		       GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
+	  || (TYPE_MODE (TREE_TYPE (vectype))
+	      != TYPE_MODE (TREE_TYPE (vectype_in)))))
     return false;
 
   if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))
-- 
2.35.3

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

* Re: [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop
@ 2024-05-02 12:13 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2024-05-02 12:13 UTC (permalink / raw)
  To: gcc-patches

On Thu, 2 May 2024, Richard Biener wrote:

> The vectorizer handles a _Float16 to __bf16 conversion through
> vectorizable_assignment, thinking it's a noop.  The following
> fixes this by making the same-size check stricter, requiring
> the same vector component mode.
> 
> Bootstrap & regtest running on x86_64-unknown-linux-gnu.  I couldn't
> manage to produce a meaningful (runtime) testcase.
> 
> 	PR tree-optimization/114921
> 	* tree-vect-stmts.cc (vectorizable_assignment): Require
> 	same vector component modes for input and output.
> ---
>  gcc/tree-vect-stmts.cc | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
> index f8d8636b139..5ec053755a2 100644
> --- a/gcc/tree-vect-stmts.cc
> +++ b/gcc/tree-vect-stmts.cc
> @@ -5961,8 +5961,7 @@ vectorizable_assignment (vec_info *vinfo,
>         || code == VIEW_CONVERT_EXPR)
>        && (!vectype_in
>  	  || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype_in), nunits)
> -	  || maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
> -		       GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
> +	  || TYPE_MODE (vectype) != TYPE_MODE (vectype_in)))

-         || maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
-                      GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
+         || (TYPE_MODE (TREE_TYPE (vectype))
+             != TYPE_MODE (TREE_TYPE (vectype_in)))))

actually so it matches the comment in the commit message.  ISTR
we have v4si and v2six2 modes on some archs that we possibly want
to inter-operate with through vectorizable_assignment.

Richard.

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

* [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop
@ 2024-05-02 11:59 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2024-05-02 11:59 UTC (permalink / raw)
  To: gcc-patches

The vectorizer handles a _Float16 to __bf16 conversion through
vectorizable_assignment, thinking it's a noop.  The following
fixes this by making the same-size check stricter, requiring
the same vector component mode.

Bootstrap & regtest running on x86_64-unknown-linux-gnu.  I couldn't
manage to produce a meaningful (runtime) testcase.

	PR tree-optimization/114921
	* tree-vect-stmts.cc (vectorizable_assignment): Require
	same vector component modes for input and output.
---
 gcc/tree-vect-stmts.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f8d8636b139..5ec053755a2 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5961,8 +5961,7 @@ vectorizable_assignment (vec_info *vinfo,
        || code == VIEW_CONVERT_EXPR)
       && (!vectype_in
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype_in), nunits)
-	  || maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
-		       GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
+	  || TYPE_MODE (vectype) != TYPE_MODE (vectype_in)))
     return false;
 
   if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))
-- 
2.35.3

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

end of thread, other threads:[~2024-05-02 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02 12:18 [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2024-05-02 12:13 Richard Biener
2024-05-02 11:59 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).