diff options
author | Peter Bergner <bergner@linux.ibm.com> | 2019-11-25 16:57:04 +0000 |
---|---|---|
committer | Peter Bergner <bergner@linux.ibm.com> | 2019-11-25 16:57:04 +0000 |
commit | 710e6f3966c8738a8666a47cc9e8ff5e3fc1c1c4 (patch) | |
tree | 54c81df9c0f76ef350101038a92b2f4774af9207 /gcc/optabs.c | |
parent | b3875f87fbe002ad43f35ba5cc16efc80f809883 (diff) | |
parent | b370f9fa8c44e8f1e2e0cda6336030c3b06a3f7b (diff) |
Merge up to 278620.ibm/gcc-8-branch
* REVISION: Update subversion id.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-8-branch@278692 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index b31016c05eb..a74d7be0d09 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -5778,6 +5778,25 @@ expand_vec_cond_expr (tree vec_cond_type, tree op0, tree op1, tree op2, icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); if (icode == CODE_FOR_nothing) { + if (tcode == LT_EXPR + && op0a == op0 + && TREE_CODE (op0) == VECTOR_CST) + { + /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR + into a constant when only get_vcond_eq_icode is supported. + Verify < 0 and != 0 behave the same and change it to NE_EXPR. */ + unsigned HOST_WIDE_INT nelts; + if (!VECTOR_CST_NELTS (op0).is_constant (&nelts)) + { + if (VECTOR_CST_STEPPED_P (op0)) + return 0; + nelts = vector_cst_encoded_nelts (op0); + } + for (unsigned int i = 0; i < nelts; ++i) + if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1) + return 0; + tcode = NE_EXPR; + } if (tcode == EQ_EXPR || tcode == NE_EXPR) icode = get_vcond_eq_icode (mode, cmp_op_mode); if (icode == CODE_FOR_nothing) |