This is the mail archive of the 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]

patch: disable vector comparisons (PR/14219)

Hi Mark.

Sorry I took so long.  I just recently finished...blah blah excuses...blah blah.  Anywhoo....

We don't allow the rest of the relational operators (<, >, etc).  We
simply don't handle them, and call binary_op_error() after the switch.
However, for EQ_EXPR and NE_EXPR we pretend we handle them, only to
error out later.

The easiest thing is to treat == and != the same way we handle the
relational operators, ala:

	   a.c:5: error: invalid operands to binary ==

I looked into actually handling vector comparisons, but noticed that
their is no SIMD equivalent instruction acrost all architectures, most
require a combination of instructions to get the desired effect.

Since we don't handle relational operators, I suggest erroring out,
until all the relops are handled.

The patch below does this.  (The existing code below the switch will
error out appropriately).

If you think it is absolutely necessary to implement relational
operators for vectors for 3.4, then I could dedicate more time to
this, but I think this is best for now.

Ok for mainline and 3.4?


2004-03-25  Aldy Hernandez  <>

	PR 14219
	* c-typeck.c (build_binary_op): Do not allow comparisons of

Index: c-typeck.c
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.294
diff -u -p -r1.294 c-typeck.c
--- c-typeck.c	23 Mar 2004 23:47:35 -0000	1.294
+++ c-typeck.c	25 Mar 2004 21:35:10 -0000
@@ -6662,11 +6662,9 @@ build_binary_op (enum tree_code code, tr
 	 but don't convert the args to int!  */
       build_type = integer_type_node;
       if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
-	   || code0 == COMPLEX_TYPE
-	   || code0 == VECTOR_TYPE)
+	   || code0 == COMPLEX_TYPE)
 	  && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
-	      || code1 == COMPLEX_TYPE
-	      || code1 == VECTOR_TYPE))
+	      || code1 == COMPLEX_TYPE))
 	short_compare = 1;
       else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)

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