Re: [PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-11-21 Thread Evgeny Stupachenko
Hi, Please note that currently the test: int a[N]; short b[N*2]; for (int i = 0; i < N; ++i) a[i] = b[i*2]; Is compiled to (with -march=corei7 -O2 -ftree-vectorize): movdqa b(%rax), %xmm0 movdqa b-16(%rax), %xmm2 pand%xmm1, %xmm0 pand%xmm1, %xmm2

Re: [PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-06-25 Thread Cong Hou
On Tue, Jun 24, 2014 at 4:05 AM, Richard Biener wrote: > On Sat, May 3, 2014 at 2:39 AM, Cong Hou wrote: >> On Mon, Apr 28, 2014 at 4:04 AM, Richard Biener wrote: >>> On Thu, 24 Apr 2014, Cong Hou wrote: >>> Given the following loop: int a[N]; short b[N*2]; for (int

Re: [PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-06-24 Thread Richard Biener
On Sat, May 3, 2014 at 2:39 AM, Cong Hou wrote: > On Mon, Apr 28, 2014 at 4:04 AM, Richard Biener wrote: >> On Thu, 24 Apr 2014, Cong Hou wrote: >> >>> Given the following loop: >>> >>> int a[N]; >>> short b[N*2]; >>> >>> for (int i = 0; i < N; ++i) >>> a[i] = b[i*2]; >>> >>> >>> After being ve

Re: [PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-05-02 Thread Cong Hou
On Mon, Apr 28, 2014 at 4:04 AM, Richard Biener wrote: > On Thu, 24 Apr 2014, Cong Hou wrote: > >> Given the following loop: >> >> int a[N]; >> short b[N*2]; >> >> for (int i = 0; i < N; ++i) >> a[i] = b[i*2]; >> >> >> After being vectorized, the access to b[i*2] will be compiled into >> several

Re: [PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-04-28 Thread Richard Biener
On Thu, 24 Apr 2014, Cong Hou wrote: > Given the following loop: > > int a[N]; > short b[N*2]; > > for (int i = 0; i < N; ++i) > a[i] = b[i*2]; > > > After being vectorized, the access to b[i*2] will be compiled into > several packing statements, while the type promotion from short to int >

[PATCH] Detect a pack-unpack pattern in GCC vectorizer and optimize it.

2014-04-24 Thread Cong Hou
Given the following loop: int a[N]; short b[N*2]; for (int i = 0; i < N; ++i) a[i] = b[i*2]; After being vectorized, the access to b[i*2] will be compiled into several packing statements, while the type promotion from short to int will be compiled into several unpacking statements. With this