public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: scalar vector shift expansion problem on 64-bit
       [not found]   ` <20111028165049.GB27949@sunsite.ms.mff.cuni.cz>
@ 2011-10-28 18:50     ` Jakub Jelinek
  2011-10-28 19:05       ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2011-10-28 18:50 UTC (permalink / raw)
  To: David Miller; +Cc: Richard Henderson, gcc-patches

On Fri, Oct 28, 2011 at 06:50:49PM +0200, Jakub Jelinek wrote:
> On Fri, Oct 28, 2011 at 09:07:31AM -0700, Richard Henderson wrote:
> > I think this is the same problem as Jakub is attacking here:
> > 
> >   http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02503.html
> 
> It has been checked in already.  But my patch only deals
> with the vector << vector case, vector << scalar (including
> vector << scalar implemented using vector << vector) supposedly still
> needs fold_const somewhere if the type sizes disagree.

A wild guess, though untested, because I don't have a reproducer:

2011-10-28  Jakub Jelinek  <jakub@redhat.com>

	* tree-vect-stmts.c (vectorizable_shift): If op1 is vect_external_def
	and has different type from op0, cast it to op0's type before the
	loop first.

--- gcc/tree-vect-stmts.c.jj	2011-10-28 16:21:06.000000000 +0200
+++ gcc/tree-vect-stmts.c	2011-10-28 20:19:27.000000000 +0200
@@ -2483,6 +2483,13 @@ vectorizable_shift (gimple stmt, gimple_
                  dealing with vectors of short/char.  */
               if (dt[1] == vect_constant_def)
                 op1 = fold_convert (TREE_TYPE (vectype), op1);
+	      else if (!useless_type_conversion_p (TREE_TYPE (vectype),
+						   TREE_TYPE (op1)))
+		{
+		  op1 = fold_convert (TREE_TYPE (vectype), op1);
+		  op1 = vect_init_vector (stmt, op1, TREE_TYPE (vectype),
+					  NULL);
+		}
             }
         }
     }


	Jakub

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

* Re: scalar vector shift expansion problem on 64-bit
  2011-10-28 18:50     ` scalar vector shift expansion problem on 64-bit Jakub Jelinek
@ 2011-10-28 19:05       ` Richard Henderson
  2011-10-28 22:04         ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2011-10-28 19:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: David Miller, gcc-patches

On 10/28/2011 11:41 AM, Jakub Jelinek wrote:
> On Fri, Oct 28, 2011 at 06:50:49PM +0200, Jakub Jelinek wrote:
>> On Fri, Oct 28, 2011 at 09:07:31AM -0700, Richard Henderson wrote:
>>> I think this is the same problem as Jakub is attacking here:
>>>
>>>   http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02503.html
>>
>> It has been checked in already.  But my patch only deals
>> with the vector << vector case, vector << scalar (including
>> vector << scalar implemented using vector << vector) supposedly still
>> needs fold_const somewhere if the type sizes disagree.
> 
> A wild guess, though untested, because I don't have a reproducer:
> 
> 2011-10-28  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* tree-vect-stmts.c (vectorizable_shift): If op1 is vect_external_def
> 	and has different type from op0, cast it to op0's type before the
> 	loop first.

I suspect the problem is in optabs.c, not here.

I'll try to look at it later today.


r~

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

* Re: scalar vector shift expansion problem on 64-bit
  2011-10-28 19:05       ` Richard Henderson
@ 2011-10-28 22:04         ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2011-10-28 22:04 UTC (permalink / raw)
  To: Richard Henderson; +Cc: David Miller, gcc-patches

On Fri, Oct 28, 2011 at 11:44:17AM -0700, Richard Henderson wrote:
> > A wild guess, though untested, because I don't have a reproducer:
> > 
> > 2011-10-28  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	* tree-vect-stmts.c (vectorizable_shift): If op1 is vect_external_def
> > 	and has different type from op0, cast it to op0's type before the
> > 	loop first.
> 
> I suspect the problem is in optabs.c, not here.

Possible.  Though, if I disable all "ashl<mode>3", "lshr<mode>3" and
"ashr<mode>3" expanders in sse.md, I get without the above patch ICEs on
e.g.

long long d[64], e, j[64];

void
f4 (void)
{
  int i;
  for (i = 0; i < 64; i++)
    j[i] = d[i] << e;
}

with -O3 -mxop and -O3 -mavx2 and the patch fixes those.

	Jakub

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

end of thread, other threads:[~2011-10-28 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20111028.010554.926011603737119372.davem@davemloft.net>
     [not found] ` <4EAAD343.8070304@redhat.com>
     [not found]   ` <20111028165049.GB27949@sunsite.ms.mff.cuni.cz>
2011-10-28 18:50     ` scalar vector shift expansion problem on 64-bit Jakub Jelinek
2011-10-28 19:05       ` Richard Henderson
2011-10-28 22:04         ` Jakub Jelinek

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