This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Vector shuffling


On Mon, Oct 3, 2011 at 6:12 PM, Richard Henderson <rth@redhat.com> wrote:
> On 10/03/2011 09:43 AM, Artem Shinkarov wrote:
>> Hi, Richard
>>
>> There is a problem with the testcases of the patch you have committed
>> for me. The code in every test-case is doubled. Could you please,
>> apply the following patch, otherwise it would fail all the tests from
>> the vector-shuffle-patch would fail.
>
> Huh. ?Dunno what happened there. ?Fixed.
>
>> Also, if it is possible, could you change my name from in the
>> ChangeLog from "Artem Shinkarov" to "Artjoms Sinkarovs". The last
>> version is the way I am spelled in the passport, and the name I use in
>> the ChangeLog.
>
> Fixed.
>
>
> r~
>

Richard, there was a problem causing segfault in ix86_expand_vshuffle
which I have fixed with the patch attached.

Another thing I cannot figure out is the following case:
#define vector(elcount, type)  \
__attribute__((vector_size((elcount)*sizeof(type)))) type

vector (8, short) __attribute__ ((noinline))
f (vector (8, short) x, vector (8, short) y, vector (8, short) mask) {
    return  __builtin_shuffle (x, y, mask);
}

int main (int argc, char *argv[]) {
    vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
    vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
    vector (8, short) mask0 = {0,2,3,1,4,5,6,7};
    vector (8, short) v2;
    int i;

    v2 = f (v0, v1,  mask0);
    /* v2 =  __builtin_shuffle (v0, v1, mask0); */
    for (i = 0; i < 8; i ++)
      __builtin_printf ("%i, ", v2[i]);

    return 0;
}

I am compiling with support of ssse3, in my case it is ./xgcc -B. b.c
-O3 -mtune=core2 -march=core2

And I get 1, 1, 1, 3, 4, 5, 1, 7, on the output, which is wrong.

But if I will call __builtin_shuffle directly, then the answer is correct.

Any ideas?


Thanks,
Artem.

Attachment: fix-segfault.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]