[cfe-dev] Clang doesn't support Logical Operator supported in GCC Vector Extension?

Eli Friedman eli.friedman at gmail.com
Fri Oct 21 11:45:19 PDT 2011


On Fri, Oct 21, 2011 at 11:03 AM, Yin Ma <yinma at codeaurora.org> wrote:
> Hi,
>
> Clang supports GCC Vector Extension.  However GCC Vector Extension supports
> Logical operator like <, >
>
> If I try to compile the code like
>  typedef float float4 __attribute__((ext_vector_type(4)));
>
>    float4 a;
>    float4 b;
>    float4 c;
>    a = b > c;
>
> the clang will
>    used type 'int  __attribute__((ext_vector_type(4)))' where arithmetic,
> pointer, or vector type is required.
>
> But if the code is
>   a = b * c;
>
> Everything works. Do you know why vector logical operator is not supported
> by this time?

The following works for me:
typedef float float4 __attribute__((ext_vector_type(4)));
typedef int int4 __attribute__((ext_vector_type(4)));
void f() {
   int4 a;
   float4 b;
   float4 c;
   a = b > c;
}

What version of clang are you using?

-Eli




More information about the cfe-dev mailing list