diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-03-05 09:44:21 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-03-05 09:44:21 +0100 |
commit | ea5212b741b5cc751d0d8271a9666c4ad0b4e799 (patch) | |
tree | 9cd2d36ebc4d1b17e4ad39f8fc141105320ca083 /gcc/match.pd | |
parent | d6f7829a1fa2577bac1bd8815acd31730affcb92 (diff) | |
download | gcc-ea5212b741b5cc751d0d8271a9666c4ad0b4e799.zip gcc-ea5212b741b5cc751d0d8271a9666c4ad0b4e799.tar.gz gcc-ea5212b741b5cc751d0d8271a9666c4ad0b4e799.tar.bz2 |
re PR tree-optimization/89570 (ICE in prepare_cmp_insn, at optabs.c:4001)
PR tree-optimization/89570
* match.pd (vec_cond into cond_op simplification): Guard with
vectorized_internal_fn_supported_p test and #if GIMPLE.
* gcc.dg/pr89570.c: New test.
From-SVN: r269385
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index c9af2e5..8bf6535 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -5177,17 +5177,24 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) if the target can do it in one go. This makes the operation conditional on c, so could drop potentially-trapping arithmetic, but that's a valid simplification if the result of the operation isn't needed. */ +#if GIMPLE (for uncond_op (UNCOND_BINARY) cond_op (COND_BINARY) (simplify (vec_cond @0 (view_convert? (uncond_op@4 @1 @2)) @3) - (with { tree op_type = TREE_TYPE (@4); } - (if (element_precision (type) == element_precision (op_type)) + (with { tree op_type = TREE_TYPE (@4); + internal_fn cond_fn = get_conditional_internal_fn (uncond_op); } + (if (cond_fn != IFN_LAST + && vectorized_internal_fn_supported_p (cond_fn, op_type) + && element_precision (type) == element_precision (op_type)) (view_convert (cond_op @0 @1 @2 (view_convert:op_type @3)))))) (simplify (vec_cond @0 @1 (view_convert? (uncond_op@4 @2 @3))) - (with { tree op_type = TREE_TYPE (@4); } - (if (element_precision (type) == element_precision (op_type)) + (with { tree op_type = TREE_TYPE (@4); + internal_fn cond_fn = get_conditional_internal_fn (uncond_op); } + (if (cond_fn != IFN_LAST + && vectorized_internal_fn_supported_p (cond_fn, op_type) + && element_precision (type) == element_precision (op_type)) (view_convert (cond_op (bit_not @0) @2 @3 (view_convert:op_type @1))))))) /* Same for ternary operations. */ @@ -5195,15 +5202,24 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) cond_op (COND_TERNARY) (simplify (vec_cond @0 (view_convert? (uncond_op@5 @1 @2 @3)) @4) - (with { tree op_type = TREE_TYPE (@5); } - (if (element_precision (type) == element_precision (op_type)) + (with { tree op_type = TREE_TYPE (@5); + internal_fn cond_fn + = get_conditional_internal_fn (as_internal_fn (uncond_op)); } + (if (cond_fn != IFN_LAST + && vectorized_internal_fn_supported_p (cond_fn, op_type) + && element_precision (type) == element_precision (op_type)) (view_convert (cond_op @0 @1 @2 @3 (view_convert:op_type @4)))))) (simplify (vec_cond @0 @1 (view_convert? (uncond_op@5 @2 @3 @4))) - (with { tree op_type = TREE_TYPE (@5); } - (if (element_precision (type) == element_precision (op_type)) + (with { tree op_type = TREE_TYPE (@5); + internal_fn cond_fn + = get_conditional_internal_fn (as_internal_fn (uncond_op)); } + (if (cond_fn != IFN_LAST + && vectorized_internal_fn_supported_p (cond_fn, op_type) + && element_precision (type) == element_precision (op_type)) (view_convert (cond_op (bit_not @0) @2 @3 @4 (view_convert:op_type @1))))))) +#endif /* Detect cases in which a VEC_COND_EXPR effectively replaces the "else" value of an IFN_COND_*. */ |