aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2021-09-02 13:05:54 +0800
committerliuhongt <hongtao.liu@intel.com>2021-09-16 16:35:29 +0800
commita26ff83ed07e33c4aa46f3314553c0d15ca21100 (patch)
tree5f6c5fa4a159fb95184b17896df2a1ada6e72059 /gcc/match.pd
parenta73d59089a9daca7316eeccece13166ad60dbf13 (diff)
downloadgcc-a26ff83ed07e33c4aa46f3314553c0d15ca21100.zip
gcc-a26ff83ed07e33c4aa46f3314553c0d15ca21100.tar.gz
gcc-a26ff83ed07e33c4aa46f3314553c0d15ca21100.tar.bz2
Check mask type when doing cond_op related gimple simplification.
gcc/ChangeLog: PR middle-end/102080 * match.pd: Check mask type when doing cond_op related gimple simplification. * tree.c (is_truth_type_for): New function. * tree.h (is_truth_type_for): New declaration. gcc/testsuite/ChangeLog: PR middle-end/102080 * gcc.target/i386/pr102080.c: New test.
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 008f775..41f9e6d 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -7020,13 +7020,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(vec_cond @0 (view_convert? (uncond_op@4 @1 @2)) @3)
(with { tree op_type = TREE_TYPE (@4); }
(if (vectorized_internal_fn_supported_p (as_internal_fn (cond_op), op_type)
- && element_precision (type) == element_precision (op_type))
+ && is_truth_type_for (op_type, TREE_TYPE (@0)))
(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 (vectorized_internal_fn_supported_p (as_internal_fn (cond_op), op_type)
- && element_precision (type) == element_precision (op_type))
+ && is_truth_type_for (op_type, TREE_TYPE (@0)))
(view_convert (cond_op (bit_not @0) @2 @3 (view_convert:op_type @1)))))))
/* Same for ternary operations. */
@@ -7036,13 +7036,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(vec_cond @0 (view_convert? (uncond_op@5 @1 @2 @3)) @4)
(with { tree op_type = TREE_TYPE (@5); }
(if (vectorized_internal_fn_supported_p (as_internal_fn (cond_op), op_type)
- && element_precision (type) == element_precision (op_type))
+ && is_truth_type_for (op_type, TREE_TYPE (@0)))
(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 (vectorized_internal_fn_supported_p (as_internal_fn (cond_op), op_type)
- && element_precision (type) == element_precision (op_type))
+ && is_truth_type_for (op_type, TREE_TYPE (@0)))
(view_convert (cond_op (bit_not @0) @2 @3 @4
(view_convert:op_type @1)))))))
#endif