Yin_Ma1
October 21, 2011, 6:03pm
#1
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?
Thanks,
Yin
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
Yin_Ma1
October 24, 2011, 9:59pm
#3
Hi,
typedef float float4 __attribute__((ext_vector_type(4)));
typedef long long4 __attribute__((ext_vector_type(4)));
typedef int int4 __attribute__((ext_vector_type(4)));
int main()
{
float4 af, bf;
long4 al, bl;
int4 ret;
ret = (bf != af);
ret = (bl != al);
return 0;
};
k.c:13:7: error: assigning to 'int4' from incompatible type 'long4';
ret = (bl != al);
^ ~~~~~~~~~~
Clang is not supporting the GCC Vector Extension in this case.
Does anybody know if there is a plan to fix this?
Thanks,
Yin
I'm pretty sure that's intentional; the result of a vector equality
operation with integer operands has the same type as the operands.
-Eli