summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index fa59624d66b..e3bb7c9ae4c 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5789,10 +5789,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(cmp (bit_and:c@2 @0 cst@1) integer_zerop)
(with { tree csts = bitmask_inv_cst_vector_p (@1); }
(if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2)))
- (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
- (icmp @0 { csts; })
- (with { tree utype = unsigned_type_for (TREE_TYPE (@1)); }
- (icmp (view_convert:utype @0) { csts; }))))))))
+ (with { auto optab = VECTOR_TYPE_P (TREE_TYPE (@1))
+ ? optab_vector : optab_default;
+ tree utype = unsigned_type_for (TREE_TYPE (@1)); }
+ (if (target_supports_op_p (utype, icmp, optab)
+ || (optimize_vectors_before_lowering_p ()
+ && (!target_supports_op_p (type, cmp, optab)
+ || !target_supports_op_p (type, BIT_AND_EXPR, optab))))
+ (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
+ (icmp @0 { csts; })
+ (icmp (view_convert:utype @0) { csts; })))))))))
/* When one argument is a constant, overflow detection can be simplified.
Currently restricted to single use so as not to interfere too much with