From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3429 invoked by alias); 24 Apr 2012 07:08:08 -0000 Received: (qmail 3417 invoked by uid 22791); 24 Apr 2012 07:08:07 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Apr 2012 07:07:54 +0000 From: "marc.glisse at normalesup dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/53100] New: Optimize __int128 with range information Date: Tue, 24 Apr 2012 07:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: marc.glisse at normalesup dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg02080.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53100 Bug #: 53100 Summary: Optimize __int128 with range information Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: marc.glisse@normalesup.org (not sure about the "component" field) In the following program, on x86_64, the first version generates two imulq, while the second generates 4 imulq and 2 mulq. It would be convenient if I could just write the whole code with __int128 and let the compiler do the optimization by tracking the range of numbers. int f(int a,int b,int c,int d,int e,int f){ #if 0 long x=a; long y=b; long z=c; long t=d; long u=e; long v=f; return (z-x)*(__int128)(v-y) < (u-x)*(__int128)(t-y); #else __int128 x=a; __int128 y=b; __int128 z=c; __int128 t=d; __int128 u=e; __int128 v=f; return (z-x)*(v-y) < (u-x)*(t-y); #endif }