This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Evgeny Stupachenko <evstupac at gmail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Richard Henderson <rth at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Wed, 1 Oct 2014 16:21:51 +0200
- Subject: Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxiLsTCZSEHJ8DLdD7kRHRTHHSjZXWyNPu3H-6xnSfCsA at mail dot gmail dot com> <CAOvf_xyNC1mRGNrM1kU_nNz_tO6_M4T8wox75D+zndhY5=TVAQ at mail dot gmail dot com> <CAFULd4bfOLW2kOmSndwK=LdNbUwHR1Ogds+5_AZ7j=tH=zu12w at mail dot gmail dot com> <20141001103514 dot GO1986 at tucnak dot redhat dot com> <20141001113815 dot GQ1986 at tucnak dot redhat dot com> <CAFULd4b_T0XByAhGew-wL6D-udF6oPwuw=v6NPYdupAn9JtzXA at mail dot gmail dot com> <20141001121715 dot GR1986 at tucnak dot redhat dot com> <CAFULd4Yo0VVJ_Z6dkc1VMpFmO6BNkbaddieXgOX7uTQTrUL11A at mail dot gmail dot com> <20141001125618 dot GT1986 at tucnak dot redhat dot com> <CAFULd4YfZsZ_T1zPK_dYh4ytPRSxFJ4WkWPK-5J7BB5sZazo+Q at mail dot gmail dot com> <20141001141215 dot GU1986 at tucnak dot redhat dot com>
On Wed, Oct 1, 2014 at 4:12 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Oct 01, 2014 at 03:09:59PM +0200, Uros Bizjak wrote:
>> > 2014-10-01 Jakub Jelinek <jakub@redhat.com>
>> >
>> > * config/i386/i386.c (expand_vec_perm_palignr): Handle
>> > 256-bit vectors for TARGET_AVX2.
>>
>> Please mention PR 62128 and include the testcase from the PR. Also,
>> please add a version of gcc.target/i386/pr52252-atom.c, compiled with
>> -mavx2 (perhaps named pr52252-avx2.c)
>
> This patch doesn't fix PR62128, and it is already tested (even without
> GCC_RUN_EXPENSIVE_TESTS=1) in the vshuf*.c torture tests (several of them).
Ah, OK then.
> If you want coverage not just for the default flags, I'd say we should
> say for -O2 only just add gcc.target/i386/{avx,avx2,avx512}-vshuf-*.c
> tests that would include ../../gcc.dg/torture/vshuf-*.c and be compiled/run
> with -mavx/-mavx2/-mavx512 options instead of the default ones.
No, the above should be good for now. The failure was triggered by the
target that defaults to -mavx2, and for avx512f we can run this suite
in the way you suggest.
> For PR62128, IMHO the right fix is attached. Note, this is again covered
> in vshuf-*.c tests (test 22 in both vshuf-v32*.c and vshuf-v16*.c).
> With that attached patch, pr62128.c (aka test_22 in vshuf-v32qi.c), changes:
> - vpshufb .LC0(%rip), %ymm0, %ymm1
> - vpshufb .LC1(%rip), %ymm0, %ymm0
> - vpermq $78, %ymm1, %ymm1
> - vpor %ymm1, %ymm0, %ymm0
> + vpermq $78, %ymm0, %ymm1
> + vpalignr $1, %ymm0, %ymm1, %ymm0
> ret
>
>> > --- gcc/config/i386/i386.c.jj 2014-10-01 14:24:16.483138899 +0200
>> > +++ gcc/config/i386/i386.c 2014-10-01 14:27:53.577222011 +0200
>> > @@ -43297,44 +43297,75 @@ expand_vec_perm_palignr (struct expand_v
>> > rtx shift, target;
>> > struct expand_vec_perm_d dcopy;
>> >
>> > - /* Even with AVX, palignr only operates on 128-bit vectors. */
>> > - if (!TARGET_SSSE3 || GET_MODE_SIZE (d->vmode) != 16)
>> > + /* Even with AVX, palignr only operates on 128-bit vectors,
>> > + in AVX2 palignr operates on both 128-bit lanes. */
>> > + if ((!TARGET_SSSE3 || GET_MODE_SIZE (d->vmode) != 16)
>> > + && (!TARGET_AVX2 || GET_MODE_SIZE (d->vmode) != 32))
>>
>> Please simplify the above condition ...
>
> How? I don't see how that can be simplified, it can
> be transformed into
> if (!((TARGET_SSSE3 && GET_MODE_SIZE (d->vmode) == 16)
> || (TARGET_AVX2 && GET_MODE_SIZE (d->vmode) == 32)))
> but I don't find that simpler.
I was thinking of the above, but you are correct, the change doesn't
bring us anything.
So, the patch is OK as it was.
Thanks,
Uros.
- References:
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Re: [PATCH 1/2, x86] Add palignr support for AVX2.