diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:29:03 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:29:03 +0000 |
commit | d7ad16c2a7cc38820691e984a77a2a3d76e195ca (patch) | |
tree | 288524066a797ac20c1839c796218ffa83932145 /gcc/expr.c | |
parent | 0a4bf03b6b1237b6f3974c8d1a39f6e7fb8b4306 (diff) | |
download | gcc-d7ad16c2a7cc38820691e984a77a2a3d76e195ca.tar.gz |
2011-09-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com>
* expr.c (do_store_flag): Expand vector comparison by
building an appropriate VEC_COND_EXPR.
* c-typeck.c (build_binary_op): Typecheck vector comparisons.
(c_objc_common_truthvalue_conversion): Adjust.
* tree-vect-generic.c (do_compare): Helper function.
(expand_vector_comparison): Check if hardware supports
vector comparison of the given type or expand vector
piecewise.
(expand_vector_operation): Treat comparison as binary
operation of vector type.
(expand_vector_operations_1): Adjust.
* gcc.c-torture/execute/vector-compare-1.c: New testcase.
* gcc.c-torture/execute/vector-compare-2.c: Likewise.
* gcc.dg/vector-compare-1.c: Likewise.
* gcc.dg/vector-compare-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179342 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 29bf68b6723..97edd460019 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -10309,6 +10309,17 @@ do_store_flag (sepops ops, rtx target, enum machine_mode mode) STRIP_NOPS (arg0); STRIP_NOPS (arg1); + /* For vector typed comparisons emit code to generate the desired + all-ones or all-zeros mask. Conveniently use the VEC_COND_EXPR + expander for this. */ + if (TREE_CODE (ops->type) == VECTOR_TYPE) + { + tree ifexp = build2 (ops->code, ops->type, arg0, arg1); + tree if_true = constant_boolean_node (true, ops->type); + tree if_false = constant_boolean_node (false, ops->type); + return expand_vec_cond_expr (ops->type, ifexp, if_true, if_false, target); + } + /* Get the rtx comparison code to use. We know that EXP is a comparison operation of some type. Some comparisons against 1 and -1 can be converted to comparisons with zero. Do so here so that the tests |