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: Richard Henderson <rth at redhat dot com>
- To: Evgeny Stupachenko <evstupac at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 28 Apr 2014 10:32:10 -0700
- Subject: Re: [PATCH 1/2, x86] Add palignr support for AVX2.
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xx3-VpgN8YDxJBPvzzNGNykUPoLdU6xThW_QBN7byy5rw at mail dot gmail dot com>
On 04/28/2014 09:48 AM, Evgeny Stupachenko wrote:
> - /* Even with AVX, palignr only operates on 128-bit vectors. */
> - if (!TARGET_SSSE3 || GET_MODE_SIZE (d->vmode) != 16)
> + /* PALIGNR of 2 256-bits registers on AVX2 costs only 2 instructions:
> + PERM and PALIGNR. It is more profitable than 2 PSHUFB and PERM.
> + PALIGNR of 2 128-bits registers takes only 1 instrucion. */
> + if (!TARGET_SSSE3 || (GET_MODE_SIZE (d->vmode) != 16 &&
> + GET_MODE_SIZE (d->vmode) != 32))
> + return false;
> + /* Only AVX2 or higher support PALIGNR on 256-bits registers. */
> + if (!TARGET_AVX2 && (GET_MODE_SIZE (d->vmode) == 32))
> return false;
This is confusingly written.
How about
if (GET_MODE_SIZE (d->vmode) == 16)
{
if (!TARGET_SSSE3)
return false;
}
else if (GET_MODE_SIZE (d->vmode) == 32)
{
if (!TARGET_AVX2)
return false;
}
else
return false;
With the comments added into the right places.
r~