From patchwork Mon Sep 5 01:24:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 113302 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 6FFE5B6F70 for ; Mon, 5 Sep 2011 11:25:49 +1000 (EST) Received: (qmail 506 invoked by alias); 5 Sep 2011 01:25:46 -0000 Received: (qmail 466 invoked by uid 22791); 5 Sep 2011 01:25:44 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from shards.monkeyblade.net (HELO shards.monkeyblade.net) (198.137.202.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Sep 2011 01:25:28 +0000 Received: from localhost (cpe-66-65-57-86.nyc.res.rr.com [66.65.57.86]) (authenticated bits=0) by shards.monkeyblade.net (8.14.4/8.14.4) with ESMTP id p851OtBF012943 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 4 Sep 2011 18:24:57 -0700 Date: Sun, 04 Sep 2011 21:24:48 -0400 (EDT) Message-Id: <20110904.212448.1952992983929823827.davem@davemloft.net> To: gcc-patches@gcc.gnu.org CC: ebotcazou@adacore.com, ro@CeBiTec.Uni-Bielefeld.DE Subject: [PATCH] Support -m{cpu,tune}=native on Linux/Sparc From: David Miller Mime-Version: 1.0 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 gcc/ 2011-09-04 David S. Miller * config.host: Add driver-sparc.o and sparc/x-sparc on native sparc*-*-linux* builds. * config/sparc/driver-sparc.c: Correct Linux strings. * gcc/config/sparc/linux.h: Add DRIVER_SELF_SPECS. * gcc/config/sparc/linux64.h: Likewise. * gcc/doc/invoke.texi: Document that Linux also supports -mcpu=native and -mtune=native on sparc. diff --git a/gcc/config.host b/gcc/config.host index 61a00b5..df8ba8f 100644 --- a/gcc/config.host +++ b/gcc/config.host @@ -165,6 +165,14 @@ case ${host} in ;; esac ;; + sparc*-*-linux*) + case ${target} in + sparc*-*-linux*) + host_extra_gcc_objs="driver-sparc.o" + host_xmake_file="${host_xmake_file} sparc/x-sparc" + ;; + esac + ;; esac # Machine-specific settings. diff --git a/gcc/config/sparc/driver-sparc.c b/gcc/config/sparc/driver-sparc.c index e5b91bc..f6a4e7c 100644 --- a/gcc/config/sparc/driver-sparc.c +++ b/gcc/config/sparc/driver-sparc.c @@ -58,7 +58,21 @@ static const struct cpu_names { { "SPARC-T3", "niagara2" }, { "SPARC-T4", "niagara2" }, #else - /* FIXME: Provide Linux/SPARC values. */ + { "SuperSPARC", "supersparc" }, + { "HyperSparc", "hypersparc" }, + { "SpitFire", "ultrasparc" }, + { "BlackBird", "ultrasparc" }, + { "Sabre", "ultrasparc" }, + { "Hummingbird", "ultrasparc" }, + { "Cheetah", "ultrasparc3" }, + { "Jalapeno", "ultrasparc3" }, + { "Jaguar", "ultrasparc3" }, + { "Panther", "ultrasparc3" }, + { "Serrano", "ultrasparc3" }, + { "UltraSparc T1", "niagara" }, + { "UltraSparc T2", "niagara2" }, + { "UltraSparc T3", "niagara2" }, + { "UltraSparc T4", "niagara2" }, #endif { NULL, NULL } }; @@ -137,7 +151,7 @@ host_detect_local_cpu (int argc, const char **argv) return NULL; while (fgets (buf, sizeof (buf), f) != NULL) - if (strncmp (buf, "cpu model", sizeof ("cpu model") - 1) == 0) + if (strncmp (buf, "cpu\t\t:", sizeof ("cpu\t\t:") - 1) == 0) { for (i = 0; cpu_names [i].name; i++) if (strstr (buf, cpu_names [i].name) != NULL) diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index a9b630e..0ad4b34 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -39,6 +39,22 @@ along with GCC; see the file COPYING3. If not see "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" +/* -mcpu=native handling only makes sense with compiler running on + a SPARC chip. */ +#if defined(__sparc__) +extern const char *host_detect_local_cpu (int argc, const char **argv); +# define EXTRA_SPEC_FUNCTIONS \ + { "local_cpu_detect", host_detect_local_cpu }, + +# define MCPU_MTUNE_NATIVE_SPECS \ + " %{mcpu=native:%