From patchwork Wed Dec 1 19:32:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 73886 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 9BC18B6EED for ; Thu, 2 Dec 2010 06:33:07 +1100 (EST) Received: (qmail 6010 invoked by alias); 1 Dec 2010 19:33:04 -0000 Received: (qmail 5979 invoked by uid 22791); 1 Dec 2010 19:33:03 -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 e33.co.us.ibm.com (HELO e33.co.us.ibm.com) (32.97.110.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Dec 2010 19:32:58 +0000 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id oB1JR8Pm026659 for ; Wed, 1 Dec 2010 12:27:08 -0700 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB1JWfBi049766 for ; Wed, 1 Dec 2010 12:32:41 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB1JWeHC012033 for ; Wed, 1 Dec 2010 12:32:40 -0700 Received: from hungry-tiger.westford.ibm.com (dyn9033037049.westford.ibm.com [9.33.37.49]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oB1JWdk7011954; Wed, 1 Dec 2010 12:32:39 -0700 Received: by hungry-tiger.westford.ibm.com (Postfix, from userid 500) id B2D21F7C20; Wed, 1 Dec 2010 14:32:38 -0500 (EST) Date: Wed, 1 Dec 2010 14:32:38 -0500 From: Michael Meissner To: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com Cc: pthaugen@us.ibm.com, bergner@vnet.ibm.com Subject: [PATCH] rs6000.c cleanup Message-ID: <20101201193237.GA14237@hungry-tiger.westford.ibm.com> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, pthaugen@us.ibm.com, bergner@vnet.ibm.com 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 Pat Haugen pointed out to me on email/irc that you couldn't set the undocumented debug switches -mno-always-hint, -mno-sched-groups, -mno-align-branch-targets because I was tesitng > 0 instead of >= 0. I also remembered that we had not updated rs6000_rtx_costs to know about the new FMA operation, so I added the FMA case, and deleted all of the old rtl FMA support in the cost function. I bootstrapped a compiler with these changes, and verified via -mdebug=reg that the debug switches were set properly. I also verified a fma operation to make sure it had the appropriate cost. Are these ok to apply? 2010-12-01 Michael Meissner * config/rs6000/rs6000.c (rs6000_option_override_internal): Fix thinko regarding setting -mno- debug switches. (rs6000_rtx_costs): Add FMA. Delete old rtl based FMA costs. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 167338) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -3017,14 +3017,15 @@ rs6000_option_override_internal (bool gl || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64); - /* Allow debug switches to override the above settings. */ - if (TARGET_ALWAYS_HINT > 0) + /* Allow debug switches to override the above settings. These are set to -1 + in rs6000.opt to indicate the user hasn't directly set the switch. */ + if (TARGET_ALWAYS_HINT >= 0) rs6000_always_hint = TARGET_ALWAYS_HINT; - if (TARGET_SCHED_GROUPS > 0) + if (TARGET_SCHED_GROUPS >= 0) rs6000_sched_groups = TARGET_SCHED_GROUPS; - if (TARGET_ALIGN_BRANCH_TARGETS > 0) + if (TARGET_ALIGN_BRANCH_TARGETS >= 0) rs6000_align_branch_targets = TARGET_ALIGN_BRANCH_TARGETS; rs6000_sched_restricted_insns_priority @@ -26072,54 +26073,9 @@ rs6000_rtx_costs (rtx x, int code, int o return true; case PLUS: - if (mode == DFmode) - { - if (GET_CODE (XEXP (x, 0)) == MULT) - { - /* FNMA accounted in outer NEG. */ - if (outer_code == NEG) - *total = rs6000_cost->dmul - rs6000_cost->fp; - else - *total = rs6000_cost->dmul; - } - else - *total = rs6000_cost->fp; - } - else if (mode == SFmode) - { - /* FNMA accounted in outer NEG. */ - if (outer_code == NEG && GET_CODE (XEXP (x, 0)) == MULT) - *total = 0; - else - *total = rs6000_cost->fp; - } - else - *total = COSTS_N_INSNS (1); - return false; - case MINUS: - if (mode == DFmode) - { - if (GET_CODE (XEXP (x, 0)) == MULT - || GET_CODE (XEXP (x, 1)) == MULT) - { - /* FNMA accounted in outer NEG. */ - if (outer_code == NEG) - *total = rs6000_cost->dmul - rs6000_cost->fp; - else - *total = rs6000_cost->dmul; - } - else - *total = rs6000_cost->fp; - } - else if (mode == SFmode) - { - /* FNMA accounted in outer NEG. */ - if (outer_code == NEG && GET_CODE (XEXP (x, 0)) == MULT) - *total = 0; - else - *total = rs6000_cost->fp; - } + if (FLOAT_MODE_P (mode)) + *total = rs6000_cost->fp; else *total = COSTS_N_INSNS (1); return false; @@ -26134,20 +26090,23 @@ rs6000_rtx_costs (rtx x, int code, int o else *total = rs6000_cost->mulsi_const; } - /* FMA accounted in outer PLUS/MINUS. */ - else if ((mode == DFmode || mode == SFmode) - && (outer_code == PLUS || outer_code == MINUS)) - *total = 0; - else if (mode == DFmode) - *total = rs6000_cost->dmul; else if (mode == SFmode) *total = rs6000_cost->fp; + else if (FLOAT_MODE_P (mode)) + *total = rs6000_cost->dmul; else if (mode == DImode) *total = rs6000_cost->muldi; else *total = rs6000_cost->mulsi; return false; + case FMA: + if (mode == SFmode) + *total = rs6000_cost->fp; + else + *total = rs6000_cost->dmul; + break; + case DIV: case MOD: if (FLOAT_MODE_P (mode))