From patchwork Sat Feb 4 05:46:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 139530 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 C4A41104792 for ; Sat, 4 Feb 2012 16:47:22 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328939244; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition: User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=OWiYxQM fCaMBdPrFBoPlgJrxeiA=; b=E2F+1ImHagKY9SfRgiKWAJ2Qfzp7SK2drZ2n/fq fBU6YMKt4NJMbXVflrn0ZWWT1moesd//zCg0WInk6Dmam5TaHiPmvd4M0uy2Be0E XmG4bElHpzVjWQnUwjAOCyeErM/pCFB8FFVDw/NvRqMDT5U4wQBcqFxpCgMzIY1r iJT4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=SIv8vOMtcCyOQCZfgWXLwXcLgX/32NGvrJg6m1ATOUWAQV1X3p2ZRGYROjeSJN XUwUC28JED80CWykyxocowTxeEPj9Mnghe5WAb5laZhD36xbyi+ZkriCyYMNmA/q snspUIxFe9LVAd8vABZ9SHxhdHUt352GxUsutm8KNTwWE=; Received: (qmail 1643 invoked by alias); 4 Feb 2012 05:47:18 -0000 Received: (qmail 1632 invoked by uid 22791); 4 Feb 2012 05:47:16 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Feb 2012 05:47:00 +0000 Received: by pbbb4 with SMTP id b4so3438437pbb.20 for ; Fri, 03 Feb 2012 21:47:00 -0800 (PST) Received: by 10.68.218.231 with SMTP id pj7mr24344234pbc.63.1328334418847; Fri, 03 Feb 2012 21:46:58 -0800 (PST) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id o7sm18515977pbq.8.2012.02.03.21.46.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Feb 2012 21:46:58 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id A9C6F170C2EA; Sat, 4 Feb 2012 16:16:52 +1030 (CST) Date: Sat, 4 Feb 2012 16:16:52 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: [RS6000] Fix PR52107, TFmode constant load. Message-ID: <20120204054652.GC4832@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01835.html changed the code I'm tweaking here to use DFmode subregs when loading a TFmode constant into regs for e500. This just extends that change to all rs6000 targets, the simplest fix I found for PR52107, a problem I discovered when looking at powerpc64-linux libgcc. If we leave these constant loads as DImode, here's what happens at various stages of rtl optimisation: .expand (insn 7 6 8 (set (reg:DI 35 3) (mem/u/c:DI (unspec:DI [ (symbol_ref/u:DI ("*.LC1") [flags 0x2]) (reg:DI 2 2) ] UNSPEC_TOCREL) [5 S8 A8])) /src/tmp/floatconst.c:10 -1 (nil)) .cse1 (insn 7 6 8 2 (set (reg:DI 35 3) (const_int 4318952042648305664 [0x3bf0000000000000])) /src/tmp/floatconst.c:10 401 {*movdi_internal64} (nil)) .split1 (insn 21 3 22 2 (set (reg:DI 35 3) (mem/u/c:DI (unspec:DI [ (symbol_ref/u:DI ("*.LC3") [flags 0x2]) (reg:DI 2 2) ] UNSPEC_TOCREL) [5 S8 A8])) /src/tmp/floatconst.c:10 -1 (expr_list:REG_EQUAL (const_int 1005584384 [0x3bf00000]) (nil))) (insn 22 21 8 2 (set (reg:DI 35 3) (ashift:DI (reg:DI 35 3) (const_int 32 [0x20]))) /src/tmp/floatconst.c:10 -1 (expr_list:REG_EQUAL (const_int 4318952042648305664 [0x3bf0000000000000]) (nil))) It would also be possible to fix this in the rs6000.md movdi splitter dealing with large constants, at least for this testcase when we know we are dealing with a hard float reg. However, I think it's better not to generate DImode fp values in the first place. Bootstrapped and regression tested powerpc64-linux. OK to apply everywhere? Note that the comment I remove is no longer true. PR target/52107 * config/rs6000/rs6000.c (rs6000_emit_move): Don't create DImode subregs of TFmode. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 183781) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -7006,17 +7006,14 @@ rs6000_emit_move (rtx dest, rtx source, if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128 && mode == TFmode && GET_CODE (operands[1]) == CONST_DOUBLE) { - /* DImode is used, not DFmode, because simplify_gen_subreg doesn't - know how to get a DFmode SUBREG of a TFmode. */ - enum machine_mode imode = (TARGET_E500_DOUBLE ? DFmode : DImode); - rs6000_emit_move (simplify_gen_subreg (imode, operands[0], mode, 0), - simplify_gen_subreg (imode, operands[1], mode, 0), - imode); - rs6000_emit_move (simplify_gen_subreg (imode, operands[0], mode, - GET_MODE_SIZE (imode)), - simplify_gen_subreg (imode, operands[1], mode, - GET_MODE_SIZE (imode)), - imode); + rs6000_emit_move (simplify_gen_subreg (DFmode, operands[0], mode, 0), + simplify_gen_subreg (DFmode, operands[1], mode, 0), + DFmode); + rs6000_emit_move (simplify_gen_subreg (DFmode, operands[0], mode, + GET_MODE_SIZE (DFmode)), + simplify_gen_subreg (DFmode, operands[1], mode, + GET_MODE_SIZE (DFmode)), + DFmode); return; }