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: [PATCH] Add Shift operation for vector types


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.
>


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