From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 494DC385E018; Fri, 6 Aug 2021 00:33:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 494DC385E018 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/53100] Optimize __int128 with range information Date: Fri, 06 Aug 2021 00:33:27 +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: 4.8.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component bug_status cf_reconfirmed_on keywords everconfirmed 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:33:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53100 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |tree-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2021-08-06 Keywords| |missed-optimization Ever confirmed|0 |1 --- Comment #4 from Andrew Pinski --- So in the #if 0 case we get: x_13 =3D (long int) a_12(D); y_15 =3D (long int) b_14(D); z_17 =3D (long int) c_16(D); t_19 =3D (long int) d_18(D); u_21 =3D (long int) e_20(D); v_23 =3D (long int) f_22(D); _1 =3D z_17 - x_13; _3 =3D v_23 - y_15; _5 =3D _1 w* _3; Notice the w* While with the original case we get: x_9 =3D (__int128) a_8(D); y_11 =3D (__int128) b_10(D); z_13 =3D (__int128) c_12(D); t_15 =3D (__int128) d_14(D); u_17 =3D (__int128) e_16(D); v_19 =3D (__int128) f_18(D); _1 =3D z_13 - x_9; _2 =3D v_19 - y_11; _3 =3D _1 * _2; If we had simplified/shortened: ((__int128) c_12(D)) - ((__int128) a_8(D)) to (__int128)(long)((unsigned long) c_12(D)) - ((unsigned long) a_8(D)) We might have optimized this. There might be another bug about having some PLUS_EXPR which has WRAPPING effects rather than undefined OVERFLOW which will help the casting issue.=