This is the mail archive of the gcc-patches@gcc.gnu.org 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] Add comparison operators for vector types


Hi,
  The C/C++ Language extension for the Cell defines the comparison
operators for vectors.  The result of these operators is a single
boolean value representing the bitwise AND of all pairwise
comparisons.  This patch adds support for these operators and a
testcase to test them for both C and C++.

This patch was originally written by Trevor and updated by me for the
tuplifications of tree-vect-generic.c.

OK? Bootstrapped and tested on i686-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

* doc/extend.texi (Vector Extensions): Document the comparison operators.
* optabs.c (get_rtx_code): Rename to ...
(get_rtx_compare_code): this and export.
(vector_compare_rtx): Update usage of get_rtx_code to get_rtx_compare_code.
* optabs.h (get_rtx_compare_code): New prototype.
* fold-const.c (fold_truth_not_expr): Don't fold NOT expressions of
vector compares.
* c-typeck.c (build_binary_op): Allow EQ_EXPR, NE_EXPR, LE_EXPR,
LT_EXPR, GE_EXPR, GT_EXPR for vector types.
* tree-vect-generic.c (do_relop): New function.
(expand_vector_comparison): New function.
(expand_vector_operation): Handle comparison class.
(computed_type): New function extracted from expand_vector_operations_1.
(expand_vector_operations_1): Handle GIMPLE_COND and use computed_type.

cp/ChangeLog:
* typeck.c (cp_build_binary_op): Allow EQ_EXPR, NE_EXPR, LE_EXPR,
LT_EXPR, GE_EXPR, GT_EXPR for vector types.

testsuite/ChangeLog:
* gcc.c-torture/execute/vecop-rel.c: New test.
* g++.dg/torture/vecop-rel.c: New test.

Attachment: compareops.diff.txt
Description: Text document


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