From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31382 invoked by alias); 1 Feb 2015 07:33:34 -0000 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 Received: (qmail 30885 invoked by uid 48); 1 Feb 2015 07:33:29 -0000 From: "segher at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/15596] [4.8/4.9/5 Regression] Missed optimization with bitfields with return value Date: Sun, 01 Feb 2015 07:33:00 -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.0.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: minor X-Bugzilla-Who: segher at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00010.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15596 Segher Boessenkool changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |segher at gcc dot gnu.org --- Comment #25 from Segher Boessenkool --- If you initialise the return value to all zeroes, the good code comes out again. The problem is that currently GCC preserves all padding bits. The same is true for normal stores (instead of return value via hidden pointer as in the example code). For this case, for PowerPC, writing 0 to all padding bits is optimal. That is because we write to field "d" which is adjacent to the padding bits, and we do the access as a 32-bit word anyway. For other cases (and other targets, and other ABIs) things will be different.