From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6932 invoked by alias); 19 Feb 2005 16:50:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6917 invoked by uid 48); 19 Feb 2005 16:50:56 -0000 Date: Sat, 19 Feb 2005 22:54:00 -0000 From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20050219165055.20083.pinskia@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/20083] New: Missed optimization with conditional and basically || X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg02268.txt.bz2 List-Id: The following three functions should result in the same assembly (the last is the best, branchless and only does one compare): int f(int i, int j, int l) { int k = 0; if (i) k = 1; if (j) k = 1; if (l) k = 1; return k; } int f1(int i, int j, int l) { int k = 0; if (i) k = 1; else if (j) k = 1; else if (l) k = 1; return k; } int f2(int i, int j, int l) { return i||j||l; } Note I came up with this testcase after adding code like the above code to gcc and I was wondering how we optimizated it. -- Summary: Missed optimization with conditional and basically || Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20083