From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 954533858C39; Wed, 19 Jul 2023 07:39:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 954533858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689752355; bh=+lGufEYki6O7ZyR1ZxAdvacO5kWpWhrYijhD+EJYi9Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fcUs47UYWXKORSjYyDyy5EZX74M1qJawuB+HhYX3eNkV2jYa5xY4wk9YK2bqmt+u5 TUF/OQH4tN3yRh0sUpZoP7+GfVp7NE5mvgZ3sHkKYChPzAjgcl6Si9K25GvBD7HRHi 2+YULbSzE9qW4Nss85nTvwOI+KGh3PW1phaY7yk0= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110731] [11/12/13/14 Regression] Wrong-code because of wide-int division since r5-424 Date: Wed, 19 Jul 2023 07:39:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110731 --- Comment #1 from Andrew Pinski --- This should have done the negative (in the original patch): 1796 /* The quotient is neg if exactly one of the divisor or dividend= is 1797 neg. */ 1798 if (dividend_neg !=3D divisor_neg) 1799 quotient_len =3D wi::sub_large (quotient, zeros, 1, quotient, 1800 quotient_len, dividend_prec, 1801 UNSIGNED, 0); That is you do -((332306998946228968225951765070086143wb + 1)/2)=