public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix vect_recog_widen_mult_pattern (PR tree-optimization/57537)
@ 2013-06-12  9:26 Jakub Jelinek
  2013-06-12  9:38 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-06-12  9:26 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

gcc.dg/vect/slp-widen-mult-half.c fails on ppc64, because
vect_recog_widen_mult_pattern creates with WIDEN_MULT_EXPR
with invalid argument types - it is a HIxHI->SI multiplication,
and rhs1 is properly HImode, but rhs2 is INTEGER_CST with SImode
(which vect_handle_widen_op_by_const verified it fits into HImode).
As the type is incompatible with what it should have been, when vectorizing
it we actually create a VIEW_CONVERT_EXPR of the SImode INTEGER_CST
to HImode, on little endian that magically works correctly, on big endian
we end up with a vector of zeros rather than vector of the desired
multipliers.  Fixed thusly, so far bootstrapped on i686-linux,
regtest there plus bootstraps/regtests on x86_64-linux, powerpc{,64}-linux
and s390{,x}-linux still pending, ok for trunk/4.8 if it succeeds?

2013-06-12  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/57537
	* tree-vect-patterns.c (vect_recog_widen_mult_pattern): If
	vect_handle_widen_op_by_const, convert oprnd1 to half_type1.

--- gcc/tree-vect-patterns.c.jj	2013-05-17 10:53:10.000000000 +0200
+++ gcc/tree-vect-patterns.c	2013-06-12 09:49:30.151854270 +0200
@@ -640,7 +640,10 @@ vect_recog_widen_mult_pattern (vec<gimpl
           && vect_handle_widen_op_by_const (last_stmt, MULT_EXPR, oprnd1,
 		                            &oprnd0, stmts, type,
 					    &half_type0, def_stmt0))
-        half_type1 = half_type0;
+	{
+	  half_type1 = half_type0;
+	  oprnd1 = fold_convert (half_type1, oprnd1);
+	}
       else
         return NULL;
     }

	Jakub

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

* Re: [PATCH] Fix vect_recog_widen_mult_pattern (PR tree-optimization/57537)
  2013-06-12  9:26 [PATCH] Fix vect_recog_widen_mult_pattern (PR tree-optimization/57537) Jakub Jelinek
@ 2013-06-12  9:38 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-06-12  9:38 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 12 Jun 2013, Jakub Jelinek wrote:

> Hi!
> 
> gcc.dg/vect/slp-widen-mult-half.c fails on ppc64, because
> vect_recog_widen_mult_pattern creates with WIDEN_MULT_EXPR
> with invalid argument types - it is a HIxHI->SI multiplication,
> and rhs1 is properly HImode, but rhs2 is INTEGER_CST with SImode
> (which vect_handle_widen_op_by_const verified it fits into HImode).
> As the type is incompatible with what it should have been, when vectorizing
> it we actually create a VIEW_CONVERT_EXPR of the SImode INTEGER_CST
> to HImode, on little endian that magically works correctly, on big endian
> we end up with a vector of zeros rather than vector of the desired
> multipliers.  Fixed thusly, so far bootstrapped on i686-linux,
> regtest there plus bootstraps/regtests on x86_64-linux, powerpc{,64}-linux
> and s390{,x}-linux still pending, ok for trunk/4.8 if it succeeds?

Ok.

Thanks,
Richard.

> 2013-06-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/57537
> 	* tree-vect-patterns.c (vect_recog_widen_mult_pattern): If
> 	vect_handle_widen_op_by_const, convert oprnd1 to half_type1.
> 
> --- gcc/tree-vect-patterns.c.jj	2013-05-17 10:53:10.000000000 +0200
> +++ gcc/tree-vect-patterns.c	2013-06-12 09:49:30.151854270 +0200
> @@ -640,7 +640,10 @@ vect_recog_widen_mult_pattern (vec<gimpl
>            && vect_handle_widen_op_by_const (last_stmt, MULT_EXPR, oprnd1,
>  		                            &oprnd0, stmts, type,
>  					    &half_type0, def_stmt0))
> -        half_type1 = half_type0;
> +	{
> +	  half_type1 = half_type0;
> +	  oprnd1 = fold_convert (half_type1, oprnd1);
> +	}
>        else
>          return NULL;
>      }
> 
> 	Jakub
> 
> 

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

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

end of thread, other threads:[~2013-06-12  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12  9:26 [PATCH] Fix vect_recog_widen_mult_pattern (PR tree-optimization/57537) Jakub Jelinek
2013-06-12  9:38 ` 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).