public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* vectorization issue
@ 2010-05-26 15:09 roy rosen
  2010-05-26 15:36 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: roy rosen @ 2010-05-26 15:09 UTC (permalink / raw)
  To: gcc

Hi,

I have tried vectorization and encountered a problem which I can see
is common to some ports (I tried ia64 and bfin).

For this function:

#define ts unsigned short
void f(ts* __restrict__ a, ts* __restrict__ b, ts* __restrict__ x)
{
    int i;
    for (i=0;i<1024;i++)
        x[i] = a[i] + b[i];
}

the loop is vectorized.
But if I define ts as follows: #define ts short
then the loop is not vectorized. The message I get is:

./a.c:21: note: no optab.
./a.c:21: note: not vectorized: relevant stmt not supported: D.1279_12
= (short unsigned int) D.1278_11;

I have tried to look a bit in the vectorizer code and it seems that
for this stmt I get to vectorizable_operation with code==NOP_EXPR
which is not handled.

Does anyone knows anything about this problem?

Thanks, Roy.

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

* Re: vectorization issue
  2010-05-26 15:09 vectorization issue roy rosen
@ 2010-05-26 15:36 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2010-05-26 15:36 UTC (permalink / raw)
  To: roy rosen; +Cc: gcc

On Wed, May 26, 2010 at 4:27 PM, roy rosen <roy.1rosen@gmail.com> wrote:
> Hi,
>
> I have tried vectorization and encountered a problem which I can see
> is common to some ports (I tried ia64 and bfin).
>
> For this function:
>
> #define ts unsigned short
> void f(ts* __restrict__ a, ts* __restrict__ b, ts* __restrict__ x)
> {
>    int i;
>    for (i=0;i<1024;i++)
>        x[i] = a[i] + b[i];
> }
>
> the loop is vectorized.
> But if I define ts as follows: #define ts short
> then the loop is not vectorized. The message I get is:
>
> ./a.c:21: note: no optab.
> ./a.c:21: note: not vectorized: relevant stmt not supported: D.1279_12
> = (short unsigned int) D.1278_11;
>
> I have tried to look a bit in the vectorizer code and it seems that
> for this stmt I get to vectorizable_operation with code==NOP_EXPR
> which is not handled.
>
> Does anyone knows anything about this problem?

The addition is done in type int (according to promotion rules),
but we fold it to an unsigned short addition.  You probably
lack a vector unsigned short -> vector short conversion
operation (which the middle-end should handle transparently).

Please file a bugreport.

Richard.

>
> Thanks, Roy.
>

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

end of thread, other threads:[~2010-05-26 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-26 15:09 vectorization issue roy rosen
2010-05-26 15:36 ` 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).