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 comparison operators for vector types


On Fri, May 29, 2009 at 9:17 PM, Chris Lattner <clattner@apple.com> wrote:
>
> On May 29, 2009, at 6:06 PM, Andrew Pinski wrote:
>
>> Hi,
>> ÂThe C/C++ Language extension for the Cell defines the comparison
>> operators for vectors. ÂThe result of these operators is a single
>> boolean value representing the bitwise AND of all pairwise
>> comparisons. ÂThis patch adds support for these operators and a
>> testcase to test them for both C and C++.
>>
>> This patch was originally written by Trevor and updated by me for the
>> tuplifications of tree-vect-generic.c.
>>
>> OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
>
> Is this something you want to do on the Cell alone, or for generic vectors
> in general?

generic vectors in general.

>ÂNote that OpenCL defines vector comparisons differently than
> this.

What does that language define them?  The main reason why it was
defined this way (it was defined before implemented in fact), is that
the C standard defines comparison operators returning an int (with a
value of 0 or 1) so we (Cell [Sony, IBM and Toshiba]) defined it to
returning an int rather than like valarrays of returning a valarray of
bool.

Right now GCC rejects a vector of bools and defining one seems a bit
weird as what size will be the bool, always one bit, one byte, 4
bytes?  How do you get from one type to another?

> ÂIf GCC aims to support it one day, it would useful to consider what
> it wants. ÂCell is a particularly useful target for OpenCL.

But isn't OpenCL a different language than C, or is it extensions to C/C++?

Thanks,
Andrew Pinski


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