From patchwork Thu May 16 20:14:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 244410 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 89DDB2C00A5 for ; Fri, 17 May 2013 06:14:42 +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 :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=DPgjtKQWoXxFxhblls1qS1+EEwOQ4Mc2GWQc+XPnMeA sTBG0BvTq79j3xSG2KgTS7rQYjvsceRqIfh3TcOg0I+X4d0oOpOL7msQXt8fW9sV ybtEKLv2yzlYXyid6n0xuiEOAkKS+mnWBVtHQNiTKoTWCoupxox0PXDKfamStLWc = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=MlN9xEjqB1ASh9HaDbSk1si2mCE=; b=asv1LV75/hAeLGxBf 0CWBmG5ZnbNlXuUqRgSduwcH9gOgd/2K0Q+RFEAscMjIxciOkAG7ApmswHub3aZl rID/5Dv2n2r7LBsykW6ppmx9v2WzEYWAOBEJ3wGZd8Uj04qaWo7VEja4HxN7p9TV 1Hik0sTYtCCfzWlWP22Fnwoq8k= Received: (qmail 23452 invoked by alias); 16 May 2013 20:14:31 -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 23409 invoked by uid 89); 16 May 2013 20:14:30 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_ZJ autolearn=ham version=3.3.1 Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 16 May 2013 20:14:29 +0000 Received: by mail-pa0-f47.google.com with SMTP id kl13so2865710pab.34 for ; Thu, 16 May 2013 13:14:28 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.68.213.101 with SMTP id nr5mr44503244pbc.22.1368735268137; Thu, 16 May 2013 13:14:28 -0700 (PDT) Received: by 10.70.10.34 with HTTP; Thu, 16 May 2013 13:14:28 -0700 (PDT) Date: Thu, 16 May 2013 22:14:28 +0200 Message-ID: Subject: [PATCH, i386]: Handle VIA/Centaur processors with -march=native From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" Cc: Dzianis Kahanovich X-Virus-Found: No Hello! Attached patch introduces handling of VIA/Centaur processors with -march=native compile directive. Comparing to original patch in PR45359, attached patch handles detection of "unknown" processors via default detection procedure. I also choose to use generic tuning for all detected processors. 2013-05-16 Uros Bizjak Dzianis Kahanovich PR target/45359 PR target/46396 * config/i386/driver-i386.c (host_detect_local_cpu): Detect VIA/Centaur processors and determine their cache parameters using detect_caches_amd. The patch was (compile) tested on x86_64-pc-linux-gnu and committed to mainline SVN. According to the PR45359, some other fix regressed the detection of VIA/Centaur processors in 4.5, so I plan to backport the patch to release branches. Uros. Index: driver-i386.c =================================================================== --- driver-i386.c (revision 198977) +++ driver-i386.c (working copy) @@ -517,7 +517,8 @@ const char *host_detect_local_cpu (int argc, const if (!arch) { - if (vendor == signature_AMD_ebx) + if (vendor == signature_AMD_ebx + || vendor == signature_CENTAUR_ebx) cache = detect_caches_amd (ext_level); else if (vendor == signature_INTEL_ebx) { @@ -560,6 +561,32 @@ const char *host_detect_local_cpu (int argc, const else processor = PROCESSOR_PENTIUM; } + else if (vendor == signature_CENTAUR_ebx) + { + if (arch) + { + if (family == 6) + { + if (model > 9) + /* Use the default detection procedure. */ + processor = PROCESSOR_GENERIC32; + else if (model == 9) + cpu = "c3-2"; + else if (model >= 6) + cpu = "c3"; + else + /* We have no idea. */ + processor = PROCESSOR_GENERIC32; + } + else if (has_3dnow) + cpu = "winchip2"; + else if (has_mmx) + cpu = "winchip2-c6"; + else + /* We have no idea. */ + processor = PROCESSOR_GENERIC32; + } + } else { switch (family)