From patchwork Fri Nov 5 22:46:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 70306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 75F961007D2 for ; Sat, 6 Nov 2010 09:46:57 +1100 (EST) Received: (qmail 28487 invoked by alias); 5 Nov 2010 22:46:54 -0000 Received: (qmail 28448 invoked by uid 22791); 5 Nov 2010 22:46:53 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e5.ny.us.ibm.com (HELO e5.ny.us.ibm.com) (32.97.182.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Nov 2010 22:46:49 +0000 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oA5MPKT7020428 for ; Fri, 5 Nov 2010 18:25:20 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oA5MkXNI2294012 for ; Fri, 5 Nov 2010 18:46:33 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oA5MkXGi021663 for ; Fri, 5 Nov 2010 20:46:33 -0200 Received: from hungry-tiger.westford.ibm.com (dyn9033037049.westford.ibm.com [9.33.37.49]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oA5MkWG3021657; Fri, 5 Nov 2010 20:46:32 -0200 Received: by hungry-tiger.westford.ibm.com (Postfix, from userid 500) id 606C7F7C89; Fri, 5 Nov 2010 18:46:32 -0400 (EDT) Date: Fri, 5 Nov 2010 18:46:32 -0400 From: Michael Meissner To: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, dominiq@lps.ens.fr Subject: [PATCH] Fix PR 45585, darwin did not like the last fp optimization patches on powerpc Message-ID: <20101105224632.GA10680@hungry-tiger.westford.ibm.com> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, dominiq@lps.ens.fr MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch fixes the problem in bug 45585 that only shows up on Darwin-powerpc. What is happening is before my patches were checked in on August 23rd, if you were loading up a static 64-bit integer variable to convert it to floating point, the compiler would first load the variable into a GPR, then store it on the stack, and then load the value from the stack to the FPR. My optimization allowed the fp convert to take memory operands so it didn't have to go through the GPR registers. However, since Darwin has its own patterns for load/store for LO_SUM address, it didn't go through the normal move patterns, and was overlooked. I have bootstrapped a powerpc64-linux compiler with the changes, and did a unit test to verify that the problem has been fixed. However, I don't currently have a working Darwin system, so I can't determine if there were uninteded consquences to the patch. Is it ok to apply? 2010-11-05 Michael Meissner PR target/45585 * config/rs6000/darwin.md (movdi_low): Allow DImode values to be in FPR registers. (movdi_low_st): Ditto. Index: gcc/config/rs6000/darwin.md =================================================================== --- gcc/config/rs6000/darwin.md (revision 166360) +++ gcc/config/rs6000/darwin.md (working copy) @@ -141,11 +141,13 @@ (define_insn "movsf_low_st_di" ;; 64-bit MachO load/store support (define_insn "movdi_low" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b") + [(set (match_operand:DI 0 "gpc_reg_operand" "=r,*!d") + (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b") (match_operand 2 "" ""))))] "TARGET_MACHO && TARGET_64BIT" - "{l|ld} %0,lo16(%2)(%1)" + "@ + {l|ld} %0,lo16(%2)(%1) + lfd %0,lo16(%2)(%1)" [(set_attr "type" "load") (set_attr "length" "4")]) @@ -159,11 +161,13 @@ (define_insn "movsi_low_st" (set_attr "length" "4")]) (define_insn "movdi_low_st" - [(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b") + [(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b") (match_operand 2 "" ""))) - (match_operand:DI 0 "gpc_reg_operand" "r"))] + (match_operand:DI 0 "gpc_reg_operand" "r,*!d"))] "TARGET_MACHO && TARGET_64BIT" - "{st|std} %0,lo16(%2)(%1)" + "@ + {st|std} %0,lo16(%2)(%1) + stfd %0,lo16(%2)(%1)" [(set_attr "type" "store") (set_attr "length" "4")])