https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66144

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I suspect a == b is all equals and not element by element equals.

I am wrong.

>From the manual:
Vector comparison is supported with standard comparison operators: ==, !=, <,
<=, >, >=. Comparison operands can be vector expressions of integer-type or
real-type. Comparison between integer-type vectors and real-type vectors are
not supported. The result of the comparison is a vector of the same width and
number of elements as the comparison operands with a signed integral element
type.

Vectors are compared element-wise producing 0 when comparison is false and -1
(constant of the appropriate type where all bits are set) otherwise. Consider
the following example.

     typedef int v4si __attribute__ ((vector_size (16)));

     v4si a = {1,2,3,4};
     v4si b = {3,2,1,4};
     v4si c;

     c = a >  b;     /* The result would be {0, 0,-1, 0}  */
     c = a == b;     /* The result would be {0,-1, 0,-1}  */

Reply via email to