https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60669
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I ran into this same issue when I am writing a patch for PR55177 (attached
below) but with f8 rather than f7 from vrp65.c.
diff --git a/gcc/match.pd b/gcc/match.pd
index 363006e28fd..a31fe598a25 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1386,14 +1386,20 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (bitop != BIT_AND_EXPR || GIMPLE)
&& (/* That's a good idea if the conversion widens the operand, thus
after hoisting the conversion the operation will be narrower. */
- TYPE_PRECISION (TREE_TYPE (@0)) < TYPE_PRECISION (type)
+ TYPE_PRECISION (TREE_TYPE (@0)) <= TYPE_PRECISION (type)
/* It's also a good idea if the conversion is to a non-integer
mode. */
|| GET_MODE_CLASS (TYPE_MODE (type)) != MODE_INT
/* Or if the precision of TO is not the same as the precision
of its mode. */
|| !type_has_mode_precision_p (type)))
- (convert (bitop @0 (convert @1))))))
+ (convert (bitop @0 (convert @1)))))
+ (simplify
+ (convert (bitop:c (nop_convert @0) @1))
+ (if (GIMPLE
+ && tree_nop_conversion_p (type, TREE_TYPE (@1))
+ && types_match (type, TREE_TYPE (@0)))
+ (bitop @0 (convert @1)))))
(for bitop (bit_and bit_ior)
rbitop (bit_ior bit_and)