aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2023-11-11 20:33:28 -0800
committerAndrew Pinski <quic_apinski@quicinc.com>2023-12-04 09:30:53 -0800
commit886f256ce3be4aa85f30af88558f0dfcb8003300 (patch)
treed36a298aa209cd6aa3c491595293c94f6b8b3f10
parentb544ec681bdc9c48587d2e014f9559674097738a (diff)
downloadgcc-886f256ce3be4aa85f30af88558f0dfcb8003300.zip
gcc-886f256ce3be4aa85f30af88558f0dfcb8003300.tar.gz
gcc-886f256ce3be4aa85f30af88558f0dfcb8003300.tar.bz2
MATCH: Fix zero_one_valued_p's convert pattern
While working on PR 111972, I was getting a regression due to zero_one_valued_p matching a signed 1 bit integer when it came to convert. This patch fixes that by checking the outer type too. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * match.pd (zero_one_valued_p): For convert make sure type is not a signed 1-bit integer. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
-rw-r--r--gcc/match.pd3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 26383e5..4d554ba 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2247,6 +2247,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
&& (TYPE_UNSIGNED (TREE_TYPE (@1))
|| TYPE_PRECISION (TREE_TYPE (@1)) > 1)
+ && INTEGRAL_TYPE_P (type)
+ && (TYPE_UNSIGNED (type)
+ || TYPE_PRECISION (type) > 1)
&& wi::leu_p (tree_nonzero_bits (@1), 1))))
/* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */