From patchwork Wed Jun 12 06:35:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 250674 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3BF682C008A for ; Wed, 12 Jun 2013 16:36:17 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=eLXPDN73vPupRGdpi PNAJL+vhkMViWRiR6o9yIS2BIG8lWo019eMsE8fBt3fVKQ65Ak9iIxGtlp5/HiOT TQWBak2gLGwTBfAgQCuEkLAv3YQd3uykAUv6rroMJrwuAgT/vt442+lKUto47CL7 Q7X+xrG4ycmezW37Q0HJDPun90= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=QdQfKAaSVQvrqSOjYJ97H6l zvDc=; b=xMjAPcUdru6H5Ydi270foCIoLCkvByJHqENG/WvTVBai4/u7QrH69Ax ynMaSZ4nops365hNfgxPdLzONPEil6xUDBytnxOtWO6nwCosyKpcj8ghXvM9ktYN NFLL//+Bll8sZ1yUIZKtr9nMMXaYu7jCPxbbCDBtLQzijud/ZyIc= Received: (qmail 2415 invoked by alias); 12 Jun 2013 06:36:10 -0000 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 Received: (qmail 2405 invoked by uid 89); 12 Jun 2013 06:36:10 -0000 X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, URIBL_BLACK autolearn=no version=3.3.1 Received: from mail-pb0-f43.google.com (HELO mail-pb0-f43.google.com) (209.85.160.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 12 Jun 2013 06:35:39 +0000 Received: by mail-pb0-f43.google.com with SMTP id md12so8294700pbc.2 for ; Tue, 11 Jun 2013 23:35:38 -0700 (PDT) X-Received: by 10.66.167.202 with SMTP id zq10mr22028175pab.61.1371018937891; Tue, 11 Jun 2013 23:35:37 -0700 (PDT) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id iq6sm12546836pbc.1.2013.06.11.23.35.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 23:35:36 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 0D054EA009D; Wed, 12 Jun 2013 16:05:31 +0930 (CST) Date: Wed, 12 Jun 2013 16:05:31 +0930 From: Alan Modra To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org Subject: Re: lower-subreg and IBM long double Message-ID: <20130612063531.GZ6878@bubble.grove.modra.org> Mail-Followup-To: "Joseph S. Myers" , gcc-patches@gcc.gnu.org References: <20130611002611.GS6878@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) On Tue, Jun 11, 2013 at 04:58:07PM +0000, Joseph S. Myers wrote: > It's preferred to put the hook documentation in the doc string in > target.def, so tm.texi.in then only contains the @hook line indicating > where the documentation will go in tm.texi. Ah, thanks. Revised patch with testcase. gcc/ * rs6000.c (TARGET_INIT_LOWER_SUBREG): Define. (rs6000_init_lower_subreg): New function. * lower-subreg.c (init_lower_subreg): Call targetm.init_lower_subreg. * target.def (init_lower_subreg): New. * doc/tm.texi.in (TARGET_INIT_LOWER_SUBREG): Document. * doc/tm.texi: Regenerate. gcc/testsuite/ * gcc.target/powerpc/fabsl.c: New test. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 199975) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -59,6 +59,7 @@ #include "opts.h" #include "tree-vectorizer.h" #include "dumpfile.h" +#include "lower-subreg.h" #if TARGET_XCOFF #include "xcoffout.h" /* get declarations of xcoff_*_section_name */ #endif @@ -1357,6 +1358,8 @@ static const struct attribute_spec rs6000_attribut #define TARGET_RTX_COSTS rs6000_rtx_costs #undef TARGET_ADDRESS_COST #define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0 +#undef TARGET_INIT_LOWER_SUBREG +#define TARGET_INIT_LOWER_SUBREG rs6000_init_lower_subreg #undef TARGET_DWARF_REGISTER_SPAN #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span @@ -27430,6 +27523,20 @@ rs6000_memory_move_cost (enum machine_mode mode, r return ret; } +static void +rs6000_init_lower_subreg (void *data) +{ + if (!TARGET_IEEEQUAD + && TARGET_HARD_FLOAT + && (TARGET_FPRS || TARGET_E500_DOUBLE) + && TARGET_LONG_DOUBLE_128) + { + struct target_lower_subreg *info = (struct target_lower_subreg *) data; + info->x_choices[0].move_modes_to_split[TFmode] = false; + info->x_choices[1].move_modes_to_split[TFmode] = false; + } +} + /* Returns a code for a target-specific builtin that implements reciprocal of the function, or NULL_TREE if not available. */ Index: gcc/lower-subreg.c =================================================================== --- gcc/lower-subreg.c (revision 199975) +++ gcc/lower-subreg.c (working copy) @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "df.h" #include "lower-subreg.h" +#include "target.h" #ifdef STACK_GROWS_DOWNWARD # undef STACK_GROWS_DOWNWARD @@ -287,6 +288,9 @@ init_lower_subreg (void) if (LOG_COSTS) fprintf (stderr, "\nSpeed costs\n===========\n\n"); compute_costs (true, &rtxes); + + if (targetm.init_lower_subreg) + targetm.init_lower_subreg (this_target_lower_subreg); } static bool Index: gcc/target.def =================================================================== --- gcc/target.def (revision 199975) +++ gcc/target.def (working copy) @@ -2926,6 +2926,14 @@ DEFHOOK void, (int *code, rtx *op0, rtx *op1, bool op0_preserve_value), default_canonicalize_comparison) +/* Allow modification of subreg choices. */ +DEFHOOK +(init_lower_subreg, + "This hook allows modification of the choices the lower_subreg pass \ +will make for particular subreg modes. @var{data} is a pointer to a \ +@code{struct target_lower_subreg}.", + void, (void *data), NULL) + DEFHOOKPOD (atomic_test_and_set_trueval, "This value should be set if the result written by\ Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in (revision 199975) +++ gcc/doc/tm.texi.in (working copy) @@ -6384,6 +6384,8 @@ should probably only be given to addresses with di registers on machines with lots of registers. @end deftypefn +@hook TARGET_INIT_LOWER_SUBREG + @node Scheduling @section Adjusting the Instruction Scheduler Index: gcc/testsuite/gcc.target/powerpc/fabsl.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/fabsl.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/fabsl.c (revision 0) @@ -0,0 +1,10 @@ +/* { dg-do compile { target { powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* powerpc*-*-linux* } } } */ +/* { dg-options "-O2 -mlong-double-128" } */ +/* { dg-final { scan-assembler-not "lwz" } } */ +/* { dg-final { scan-assembler-not "ld" } } */ + +long double +_fabsl (long double x) +{ + return __builtin_fabsl (x); +}