Skip to content

Commit

Permalink
MATCH: Fix zero_one_valued_p's convert pattern
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
apinski-quic committed Dec 4, 2023
1 parent b544ec6 commit 886f256
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gcc/match.pd
Expand Up @@ -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 }. */
Expand Down

0 comments on commit 886f256

Please sign in to comment.