From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11254 invoked by alias); 1 Sep 2005 00:40:28 -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 11178 invoked by uid 48); 1 Sep 2005 00:40:15 -0000 Date: Thu, 01 Sep 2005 00:40:00 -0000 From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20050901004014.23664.pinskia@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/23664] New: fold does not change (a&C1)+(b&C2) to (a&C1)|(b&C2) iff (C1 & C2) == 0 X-Bugzilla-Reason: CC X-SW-Source: 2005-09/txt/msg00000.txt.bz2 List-Id: These two functions should produce the same asm: int f(int a, int b) { return (a&0xF)+(b&0xF0); } int f1(int a, int b) { return (a&0xF)|(b&0xF0); } For PPC, we get: _f: rlwinm r4,r4,0,24,27 rlwinm r3,r3,0,28,31 add r3,r3,r4 blr _f1: rlwinm r4,r4,0,24,27 rlwimi r3,r4,0,0,27 blr Which shows the | is more efficient than the + one. -- Summary: fold does not change (a&C1)+(b&C2) to (a&C1)|(b&C2) iff (C1 & C2) == 0 Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: middle-end 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 GCC target triplet: powerpc-*-* OtherBugsDependingO 19987 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23664