This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add Shift operation for vector types
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Andrew Pinski <Andrew_Pinski at playstation dot sony dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Trevor_Smigiel <Trevor_Smigiel at playstation dot sony dot com>
- Date: Tue, 7 Jul 2009 10:58:10 +0200
- Subject: Re: [PATCH] Add Shift operation for vector types
- References: <de8d50360907061645t2d8e71bu33faaf2a80901b42@mail.gmail.com>
On Tue, Jul 7, 2009 at 1:45 AM, Andrew
Pinski<Andrew_Pinski@playstation.sony.com> wrote:
> Hi,
> ?The Cell C/C++ Language extension document includes a shift
> operations for vector types. ?These operators take an integer vector
> type and does an element by element shift, just like what is done for
> addition and subtraction.
>
> This patch was originally done by Trevor Smigiel with some changes and
> the documentation and the testcases written by me.
>
> OK? Bootstrapped and tested on i386-darwin.
I cannot approve it, but the patch itself looks reasonable. I would
amend the documentation with an example, like
"The expression { a, b, c, d } << { e, f, g, h } computes
{a << e, b << f, b << g, d << h}." for clarification.
How do the shifts get expanded if the hardware does not support
the operation? Thus, does tree-vect-generic handle this kind
of shifts properly?
Thanks,
Richard.
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * doc/extend.texi (Vector Extensions): Document shifts work now.
> * c-typeck.c (build_binary_op): Allow vector types for RSHIFT_EXPR and
> LSHIFT_EXPR.
>
> testsuite/ChangeLog:
> * gcc.c-torture/execute/vector-shift.c: New test.
> * g++.dg/torture/vector-shift.C: New test.
>
> cp/ChangeLog:
> * typeck.c (cp_build_binary_op): Allow vector types for RSHIFT_EXPR
> and LSHIFT_EXPR.
>