diff options
author | Artjoms Sinkarovs <artyom.shinkaroff@gmail.com> | 2011-09-29 11:29:03 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-09-29 11:29:03 +0000 |
commit | d246ab4f578b2e3369963386bafd66b26de8e63d (patch) | |
tree | 288524066a797ac20c1839c796218ffa83932145 /gcc/expr.c | |
parent | 7c99ecef0b605466c522f4c170811761339dac16 (diff) | |
download | gcc-d246ab4f578b2e3369963386bafd66b26de8e63d.zip gcc-d246ab4f578b2e3369963386bafd66b26de8e63d.tar.gz gcc-d246ab4f578b2e3369963386bafd66b26de8e63d.tar.bz2 |
expr.c (do_store_flag): Expand vector comparison by building an appropriate VEC_COND_EXPR.
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.
From-SVN: r179342
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 |