From patchwork Mon Jul 9 13:20:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 941267 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-481219-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="iCB2TDYq"; 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 41PQvW0lxyz9s00 for ; Mon, 9 Jul 2018 23:21:10 +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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ENS1dvskxxzeJTWh/7QxTeI0GRHnhnyxV/7m6LdeYPdS57RMfK 7P9L7QJaITAGo7oWUvCr5iXiMGi1GnOO0CJpfQQm1/e9kaHpJKw8KFotymc2ySaH T9RRB//vCuD6MDElETIcWLrXCbbpg9CfT2EJWNeAuH2aZqyKoEHL32ohg= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=R+kXYEWHehq26oqraO9n9Av4wjw=; b=iCB2TDYq2um2E54JwCd4 Wqi7TpPBWC2T2b/TjbNa8Idn9dNw4KMp8ikyw4ycSDjZr8GRjgJKJ68rSt2x61WP MMC0zt//L8cHBB4yocyRARtVkR5HpVUN5BJXh7mwU3iZveXtXDIRRrc9pXVO4o6x xKJVrROjueu/crR2Q7gnIPs= Received: (qmail 15187 invoked by alias); 9 Jul 2018 13:21:00 -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 14806 invoked by uid 89); 9 Jul 2018 13:20:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, SPF_PASS autolearn=ham version=3.3.2 spammy=assemble, Statistical, H*UA:38.0, H*u:38.0 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jul 2018 13:20:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2274FED1; Mon, 9 Jul 2018 06:20:56 -0700 (PDT) Received: from [10.2.207.62] (e107157-lin.cambridge.arm.com [10.2.207.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7C5CA3F5AD; Mon, 9 Jul 2018 06:20:55 -0700 (PDT) To: GCC Patches Cc: James Greenhalgh , Richard Earnshaw From: "Andre Vieira (lists)" Subject: [PATCH, GCC, AARCH64] Add support for +profile extension Message-ID: <5B436135.1090401@arm.com> Date: Mon, 9 Jul 2018 14:20:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, This patch adds support for the Statistical Profiling Extension (SPE) on AArch64. Even though the compiler will not generate code any differently given this extension, it will need to pass it on to the assembler in order to let it correctly assemble inline asm containing accesses to the extension's system registers. The same applies when using the preprocessor on an assembly file as this first must pass through cc1. I left the hwcaps string for SPE empty as the kernel does not define a feature string for this extension. The current effect of this is that driver will disable profile feature bit in GCC. This is OK though because we don't, nor do we ever, enable this feature bit, as codegen is not affect by the SPE support and more importantly the driver will still pass the extension down to the assembler regardless. Boostrapped aarch64-none-linux-gnu and ran regression tests. Is it OK for trunk? gcc/ChangeLog: 2018-07-09 Andre Vieira * config/aarch64/aarch64-option-extensions.def: New entry for profile extension. * config/aarch64/aarch64.h (AARCH64_FL_PROFILE): New. * doc/invoke.texi (aarch64-feature-modifiers): New entry for profile extension. gcc/testsuite/ChangeLog: 2018-07-09 Andre Vieira * gcc.target/aarch64/profile.c: New test. diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def index 5fe5e3f7dddf622a48a5b9458ef30449a886f395..69ab796a4e1a959b89ebb55b599919c442cfb088 100644 --- a/gcc/config/aarch64/aarch64-option-extensions.def +++ b/gcc/config/aarch64/aarch64-option-extensions.def @@ -105,4 +105,7 @@ AARCH64_OPT_EXTENSION("fp16fml", AARCH64_FL_F16FML, AARCH64_FL_FP | AARCH64_FL_F Disabling "sve" just disables "sve". */ AARCH64_OPT_EXTENSION("sve", AARCH64_FL_SVE, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_F16, 0, "sve") +/* Enabling/Disabling "profile" does not enable/disable any other feature. */ +AARCH64_OPT_EXTENSION("profile", AARCH64_FL_PROFILE, 0, 0, "") + #undef AARCH64_OPT_EXTENSION diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index f284e74bfb8c9bab2aa22cc6c5a67750cbbba3c2..c1218503bab19323eee1cca8b7e4bea8fbfcf573 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -158,6 +158,9 @@ extern unsigned aarch64_architecture_version; #define AARCH64_FL_SHA3 (1 << 18) /* Has ARMv8.4-a SHA3 and SHA512. */ #define AARCH64_FL_F16FML (1 << 19) /* Has ARMv8.4-a FP16 extensions. */ +/* Statistical Profiling extensions. */ +#define AARCH64_FL_PROFILE (1 << 20) + /* Has FP and SIMD. */ #define AARCH64_FL_FPSIMD (AARCH64_FL_FP | AARCH64_FL_SIMD) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 56cd122b0d7b420e2b16ceb02907860879d3b9d7..4ca68a563297482afc75abed4a31c106af38caf7 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -14813,6 +14813,8 @@ instructions. Use of this option with architectures prior to Armv8.2-A is not su @item sm4 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. Use of this option with architectures prior to Armv8.2-A is not supported. +@item profile +Enable the Statistical Profiling extension. @end table diff --git a/gcc/testsuite/gcc.target/aarch64/profile.c b/gcc/testsuite/gcc.target/aarch64/profile.c new file mode 100644 index 0000000000000000000000000000000000000000..db51b4746dd60009d784bc0b37ea99b2f120d856 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/profile.c @@ -0,0 +1,9 @@ +/* { dg-do assemble } */ +/* { dg-options "-std=gnu99 -march=armv8.2-a+profile" } */ + +int foo (void) +{ + int ret; + asm ("mrs %0, pmblimitr_el1" : "=r" (ret)); + return ret; +}