From patchwork Fri Sep 28 08:47:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 976088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486607-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vN+MjCKl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42M51Z2Zt5z9s3x for ; Fri, 28 Sep 2018 18:48:32 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=cSS2kHsUHqsIEOmF qbackfcyqjtEjheWauVy3ttjrGX6YP9SKlftGppA16cMcPDnwUNtievp+H8LWlmT 43w0bs1Oi954xn4pX8VZPVia2LfINCZG4nKI8dM7BxNwnugdBUNC1+nn/v0L54bS 7S41KRtmN0TPw7Nfsg2JBbyugxg= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=Eb6//VM/nCG1fSWDuLVzob VC+gs=; b=vN+MjCKlfut4T/0ESUgoQ8WZNLR+Bmj+EWHUpkGEvzDQa9ziX4OVYg tDjQwXOnRpl9HCAYN/zqUmHxYP/gJqhNd6TDEq2PYxqPI4HmHsOSXoXGUTMH2wR1 g63IzmcCyHrgQNQmUXCBj7LUTHa+XXF/mhK38qXfZ9hO1mGhQW2XI= Received: (qmail 24918 invoked by alias); 28 Sep 2018 08:48:16 -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 23517 invoked by uid 89); 28 Sep 2018 08:48:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=chip, supplement, gate, botcazou X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Sep 2018 08:47:58 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D943B8150F for ; Fri, 28 Sep 2018 10:47:55 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uemQ9ZQce0-g for ; Fri, 28 Sep 2018 10:47:55 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 900A1814FA for ; Fri, 28 Sep 2018 10:47:55 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Small fixes and cleanup Date: Fri, 28 Sep 2018 10:47:53 +0200 Message-ID: <6151077.RF03MCevhd@polaris> MIME-Version: 1.0 This patch rewrites the implementation of BRANCH_COST to use a table and take into account the couple of parameters. It also fixes out-of-range issues for the Compare-and-Branch-on-Condition instructions on Niagara-4 and later, and cleans up the handling of MASK_FSMULD. Bootstrapped/regtested on SPARC/Solaris, applied on the mainline. 2018-09-28 Eric Botcazou * config/sparc/sparc-protos.h (sparc_branch_cost): Declare. * config/sparc/sparc.h (BRANCH_COST): Call sparc_branch_cost. * config/sparc/sparc.c (struct processor_costs): Add branch_cost field. (cypress_costs): Set it. (supersparc_costs): Likewise. (hypersparc_costs): Likewise. (leon_cost): Likewise. (leon3_costs): Likewise. (sparclet_costs): Likewise. (ultrasparc_costs): Likewise. (ultrasparc_costs): Likewise. (niagara_costs): Likewise. (niagara2_costs): Likewise. (niagara3_costs): Likewise. (niagara4_costs): Likewise. (niagara7_costs): Likewise. (m8_costs): Likewise. (TARGET_CAN_FOLLOW_JUMP): Define. (pass_work_around_errata::gate): Minor tweak. (sparc_option_override): Remove MASK_FSMULD mask for V7 processors. Do not set both MASK_VIS4 and MASK_VIS4B for M8 processor. Automaitcally clear MASK_FSMULD mask for V7 processors. (sparc_can_follow_jump): New static function. (output_ubranch): Deal with CROSSING_JUMP_P. (sparc_use_sched_lookahead): Rewrite using switch statement. (sparc_issue_rate): Reorder. (sparc_branch_cost): New function. testsuite/ * gcc.target/sparc/20160229-1.c: Minor tweak. * gcc.target/sparc/cbcond-2.c: Likewise. * gcc.target/sparc/movcc-1.c: Add -mcpu=v9 option. * gcc.target/sparc/movcc-2.c: Minor tweak. * gcc.target/sparc/overflow-3.c: Likewise. * gcc.target/sparc/overflow-4.c: Add -mno-vis4 option. * gcc.target/sparc/overflow-5.c: Minor tweak. * gcc.target/sparc/setcc-4.c: Add -mno-vis4 option. Index: gcc.target/sparc/20160229-1.c =================================================================== --- gcc.target/sparc/20160229-1.c (revision 264525) +++ gcc.target/sparc/20160229-1.c (working copy) @@ -2,8 +2,8 @@ /* Reported by John Paul Adrian Glaubitz */ /* { dg-do run } */ -/* { dg-options "-std=gnu99" } /* { dg-require-effective-target lp64 } */ +/* { dg-options "-std=gnu99" } */ extern void abort (void); Index: gcc.target/sparc/cbcond-2.c =================================================================== --- gcc.target/sparc/cbcond-2.c (revision 264525) +++ gcc.target/sparc/cbcond-2.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -mcbcond" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-options "-O -mcbcond" } */ extern void foo (void); extern void bar (void); Index: gcc.target/sparc/movcc-1.c =================================================================== --- gcc.target/sparc/movcc-1.c (revision 264525) +++ gcc.target/sparc/movcc-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mcpu=v9" } */ int foo1 (int a) { Index: gcc.target/sparc/movcc-2.c =================================================================== --- gcc.target/sparc/movcc-2.c (revision 264525) +++ gcc.target/sparc/movcc-2.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2" } */ long foo1 (long a) { Index: gcc.target/sparc/overflow-3.c =================================================================== --- gcc.target/sparc/overflow-3.c (revision 264525) +++ gcc.target/sparc/overflow-3.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-options "-O" } */ #include #include Index: gcc.target/sparc/overflow-4.c =================================================================== --- gcc.target/sparc/overflow-4.c (revision 264525) +++ gcc.target/sparc/overflow-4.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -mno-vis3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-options "-O -mno-vis3 -mno-vis4" } */ #include #include Index: gcc.target/sparc/overflow-5.c =================================================================== --- gcc.target/sparc/overflow-5.c (revision 264525) +++ gcc.target/sparc/overflow-5.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -mvis3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-options "-O -mvis3" } */ #include #include Index: gcc.target/sparc/setcc-4.c =================================================================== --- gcc.target/sparc/setcc-4.c (revision 264525) +++ gcc.target/sparc/setcc-4.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target lp64 } */ -/* { dg-options "-O1 -mno-vis3" } */ +/* { dg-options "-O1 -mno-vis3 -mno-vis4" } */ long neq (long a, long b) {