https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119672
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, 2025-04-08 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/119672 * simplify-rtx.cc (simplify_context::simplify_relational_operation_1): For POPCOUNT == 0 or != 0 optimizations use CONST0_RTX (GET_MODE (XEXP (op0, 0))) rather than const0_rtx. --- gcc/simplify-rtx.cc.jj 2025-04-07 11:54:49.216910340 +0200 +++ gcc/simplify-rtx.cc 2025-04-08 11:14:53.826293652 +0200 @@ -6465,14 +6465,16 @@ simplify_context::simplify_relational_op case LEU: /* (eq (popcount x) (const_int 0)) -> (eq x (const_int 0)). */ return simplify_gen_relational (EQ, mode, GET_MODE (XEXP (op0, 0)), - XEXP (op0, 0), const0_rtx); + XEXP (op0, 0), + CONST0_RTX (GET_MODE (XEXP (op0, 0)))); case NE: case GT: case GTU: /* (ne (popcount x) (const_int 0)) -> (ne x (const_int 0)). */ return simplify_gen_relational (NE, mode, GET_MODE (XEXP (op0, 0)), - XEXP (op0, 0), const0_rtx); + XEXP (op0, 0), + CONST0_RTX (GET_MODE (XEXP (op0, 0)))); default: break; should fix this.