C/C++ operator meaning is different between gcc generic vector type and altivec type

Hi, all.

I find the meaning of C/C++ language operator ‘<=’ is different between different vector kind type. For example, a legal clang code as following. But it’s ill-formed in GCC.

typedef int v4 __attribute((vector_size(16)));

int main(){
  v4 va;
  v4 vb;
  vector int a;
  vector int b;

  **int** c = a**<=**b;
  **v4** vc = va**<=**vb;

g++ a.C
a.C: In function 'int main()':
a.C:9:14: error: cannot convert '__vector(4) int' to 'int' in initialization
   int c = a<=b;

The return type of '<=' operator of Altivec kind vector is not same as generic gcc kind vector. One is int, the other one is vector. But in GCC, it’s same return type and meaning, which is described at https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html

So my question is what it is we would like relational and equality operators to do with vectors? We make the meaning of two kind vectors consistent or separate? Or which document is standard rule to implement the semantic meaning?


Zixuan Wu (Zeson)

XL C/C++ Compiler Developer
IBM Systems, z System
E-mail: wuzish@cn.ibm.com
Tel: 86-21-60928420

Compiler : The Art of Lowering