From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12496 invoked by alias); 6 Mar 2015 12:05:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 12439 invoked by uid 89); 6 Mar 2015 12:05:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ob0-f174.google.com Received: from mail-ob0-f174.google.com (HELO mail-ob0-f174.google.com) (209.85.214.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 06 Mar 2015 12:05:33 +0000 Received: by obbgq1 with SMTP id gq1so20174318obb.2 for ; Fri, 06 Mar 2015 04:05:31 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.98.132 with SMTP id ei4mr10606080oeb.81.1425643531884; Fri, 06 Mar 2015 04:05:31 -0800 (PST) Received: by 10.76.98.137 with HTTP; Fri, 6 Mar 2015 04:05:31 -0800 (PST) In-Reply-To: <20150305200638.GA3059@ibm-tiger.the-meissners.org> References: <20150305200638.GA3059@ibm-tiger.the-meissners.org> Date: Fri, 06 Mar 2015 12:05:00 -0000 Message-ID: Subject: Re: [PATCH] PR target/65240, Fix Power{7,8} insn constraint issue with -O3 -ffast-math From: Richard Biener To: Michael Meissner , GCC Patches , David Edelsohn Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00355.txt.bz2 On Thu, Mar 5, 2015 at 9:06 PM, Michael Meissner wrote: > This patch fixes PR 65240, which was a latent bug that was introduced when I > added the -mupper-regs support to the PowerPC compiler. In the PowerPC > compiler, if you use -ffast-math, the compiler allows floating point constants > in move RTLs until register allocation time, in order to allow the > optimizations that replace division by a constant with multiplication by the > reciprocal. Don't we perform this optimization on the GIMPLE/tree level already? Richard. > If the register being loaded up is a traditional Altivec register, > the load will fail, since there is no D-FORM (register+offset) addressing mode > for the traditional altivec registers. > > I had had a define_split to try and handle this situation, but it didn't work > all of the time. I rewrote the insns, so there is an UNSPEC in it to prevent > over optimization. > > I have done bootstrap builds and make check's on both a big endian power7 > system, and a little endian power8 system with no regressions in the tests. I > have also built both power7 and power8 spec 2006 (v5) versions, and Spec > built. I have run the Spec floating point tests on a power7 box, and all of > the tests performed about at the same speed as before the bug fix was done, > with the exception of gromacs, which is 4% faster with the fix. > > Looking at the static instruction counts, the big change is to fold the addi > instruction into the load of the constant if it is loading the value to a > traditional floating point register (previously, it would load up the constant > with addis/addi and then do an indirect load). I do see other instructions > change, including a few more floating point loads, but with the exception of > gromacs, most of the changes are in the noise level. > > Is this ok to install into the trunk? At present, it is not needed for GCC > 4.9, since that branch does not have the -mupper-regs support. > > [gcc] > 2015-03-05 Michael Meissner > > PR target/65240 > * config/rs6000/rs6000.md (UNSPEC_FUSION_FP_CONSTANT): New unspec. > (Vsx_load): New mode attribute to give appropriate VSX load > instruction. > (move floating point constant define_split): Use an UNSPEC to make > sure that the load of the constant is kept as a memory address, > instead of being converted back into a move of the constant. > (load__constant): Likewise. > > [gcc/testsuite] > 2015-03-05 Michael Meissner > > PR target/65240 > * gcc.target/powerpc/pr65240.c: New test. > > -- > Michael Meissner, IBM > IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA > email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797