public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix vectorizable_conversion with widening conversion needing cvt_type (PR tree-optimization/51914)
@ 2012-01-20 17:11 Jakub Jelinek
  2012-01-20 22:03 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2012-01-20 17:11 UTC (permalink / raw)
  To: Ira Rosen, Richard Guenther; +Cc: gcc-patches

Hi!

Unlike narrowing conversion that needs cvt_type, when widening conversion
needs cvt_type, we want to actually convert stuff (possibly using multiple
steps) to cvt_type and only at the end convert to the vectype_out type.
Without this patch we'd attempt on the vect testcases mentioned in the PR
on arm first converted V?HI mode to V?SF using an integer unpacking, and
then finally do a FLOAT_EXPR conversion from V?SF mode to V?SI.
For narrowing conversions the code did the right thing, there
cvt_type conversion is done first to vec_dest temporary and then possibly
multistep demotion using vec_dest vector.

Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
regtested on x86_64-linux with -mavx and -msse4 and tested on the few
testcases with cross to arm.  Ok for trunk?

2012-01-20  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/51914
	* tree-vect-stmts.c (vectorizable_conversion): For
	cvt_type && modifier == WIDEN, put temporary with cvt_type
	at the beginning of vec_dsts and set vec_dest to temporary
	with vectype_out.

--- gcc/tree-vect-stmts.c.jj	2011-12-27 11:39:49.000000000 +0100
+++ gcc/tree-vect-stmts.c	2012-01-20 12:27:00.932766457 +0100
@@ -2420,7 +2420,9 @@ vectorizable_conversion (gimple stmt, gi
      from supportable_*_operation, and store them in the correct order
      for future use in vect_create_vectorized_*_stmts ().  */
   vec_dsts = VEC_alloc (tree, heap, multi_step_cvt + 1);
-  vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
+  vec_dest = vect_create_destination_var (scalar_dest,
+					  (cvt_type && modifier == WIDEN)
+					  ? cvt_type : vectype_out);
   VEC_quick_push (tree, vec_dsts, vec_dest);
 
   if (multi_step_cvt)
@@ -2435,7 +2437,9 @@ vectorizable_conversion (gimple stmt, gi
     }
 
   if (cvt_type)
-    vec_dest = vect_create_destination_var (scalar_dest, cvt_type);
+    vec_dest = vect_create_destination_var (scalar_dest,
+					    modifier == WIDEN
+					    ? vectype_out : cvt_type);
 
   if (!slp_node)
     {

	Jakub

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

* Re: [PATCH] Fix vectorizable_conversion with widening conversion needing cvt_type (PR tree-optimization/51914)
  2012-01-20 17:11 [PATCH] Fix vectorizable_conversion with widening conversion needing cvt_type (PR tree-optimization/51914) Jakub Jelinek
@ 2012-01-20 22:03 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2012-01-20 22:03 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ira Rosen, gcc-patches

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2379 bytes --]

On Fri, 20 Jan 2012, Jakub Jelinek wrote:

> Hi!
> 
> Unlike narrowing conversion that needs cvt_type, when widening conversion
> needs cvt_type, we want to actually convert stuff (possibly using multiple
> steps) to cvt_type and only at the end convert to the vectype_out type.
> Without this patch we'd attempt on the vect testcases mentioned in the PR
> on arm first converted V?HI mode to V?SF using an integer unpacking, and
> then finally do a FLOAT_EXPR conversion from V?SF mode to V?SI.
> For narrowing conversions the code did the right thing, there
> cvt_type conversion is done first to vec_dest temporary and then possibly
> multistep demotion using vec_dest vector.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
> regtested on x86_64-linux with -mavx and -msse4 and tested on the few
> testcases with cross to arm.  Ok for trunk?

Ok.

Thanks,
Richard.

> 2012-01-20  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/51914
> 	* tree-vect-stmts.c (vectorizable_conversion): For
> 	cvt_type && modifier == WIDEN, put temporary with cvt_type
> 	at the beginning of vec_dsts and set vec_dest to temporary
> 	with vectype_out.
> 
> --- gcc/tree-vect-stmts.c.jj	2011-12-27 11:39:49.000000000 +0100
> +++ gcc/tree-vect-stmts.c	2012-01-20 12:27:00.932766457 +0100
> @@ -2420,7 +2420,9 @@ vectorizable_conversion (gimple stmt, gi
>       from supportable_*_operation, and store them in the correct order
>       for future use in vect_create_vectorized_*_stmts ().  */
>    vec_dsts = VEC_alloc (tree, heap, multi_step_cvt + 1);
> -  vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
> +  vec_dest = vect_create_destination_var (scalar_dest,
> +					  (cvt_type && modifier == WIDEN)
> +					  ? cvt_type : vectype_out);
>    VEC_quick_push (tree, vec_dsts, vec_dest);
>  
>    if (multi_step_cvt)
> @@ -2435,7 +2437,9 @@ vectorizable_conversion (gimple stmt, gi
>      }
>  
>    if (cvt_type)
> -    vec_dest = vect_create_destination_var (scalar_dest, cvt_type);
> +    vec_dest = vect_create_destination_var (scalar_dest,
> +					    modifier == WIDEN
> +					    ? vectype_out : cvt_type);
>  
>    if (!slp_node)
>      {
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

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

end of thread, other threads:[~2012-01-20 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20 17:11 [PATCH] Fix vectorizable_conversion with widening conversion needing cvt_type (PR tree-optimization/51914) Jakub Jelinek
2012-01-20 22:03 ` Richard Guenther

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