From patchwork Tue Jul 24 20:22:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 948822 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-482231-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cavium.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="U6tB55/d"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=CAVIUMNETWORKS.onmicrosoft.com header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b="bohowMp+"; 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 41ZqXf4Y1sz9ryt for ; Wed, 25 Jul 2018 06:22:24 +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 :message-id:subject:from:reply-to:to:cc:date:content-type :mime-version:content-transfer-encoding; q=dns; s=default; b=FHN 89a5LEO6U5ZAx1UJrrtT6gOCIY3ylL0cejjRaybyaTpo6mujzIw6QKJU/bbnltGg 95NVU29XKewxm2bPz9txO0F5mUTlWbgdG7HSiGKYNRglYKnxV8y6AuCurXJlUkeO 7eRTbfshCqEFxghVUjyOUHBk31uaNTbnKFmJCzU0= 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 :message-id:subject:from:reply-to:to:cc:date:content-type :mime-version:content-transfer-encoding; s=default; bh=g6t+hGR1k F4Vs8fa20iiP33XfIQ=; b=U6tB55/de0w4vgNaojeJw501+He8X1lLEv7MZBUcZ /7qngCWE1b9abis2PnBsll9cVW0r58Fojo+9oEDmkIS1TjWnqUgVrNCsOnDyAjR7 HhFXx80PAZw3q300bMiCyF7A1OKveP8gCwIXULfCDVA7Yd2N9Hwmk/QFWnxNiemK f8= Received: (qmail 97447 invoked by alias); 24 Jul 2018 20:22:17 -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 97433 invoked by uid 89); 24 Jul 2018 20:22:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=1549 X-HELO: NAM04-CO1-obe.outbound.protection.outlook.com Received: from mail-eopbgr690084.outbound.protection.outlook.com (HELO NAM04-CO1-obe.outbound.protection.outlook.com) (40.107.69.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jul 2018 20:22:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x6uZg71cbjVgznTeibvyla2X9HNnOaY4tZXFNyVeLj4=; b=bohowMp+6cA288e1fGfPmZ637gBCRzZg6+/tg3j7ts9BZXJnQ2l7BR5M07svGAa6kNnwmjuW8uwKSx0o1eKVv3b0lqgLIKZ6Oy8hASIQ10RNJ/e/vcTrIr6YpyPaP4Bbb8IxaF0wWiDSghsPgG/TQjAee5OKISrojqbNi+bRPik= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Steve.Ellcey@cavium.com; Received: from sellcey-dt.caveonetworks.com (50.233.148.155) by BL0PR07MB5028.namprd07.prod.outlook.com (2603:10b6:208:49::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Tue, 24 Jul 2018 20:22:06 +0000 Message-ID: <1532463722.15609.40.camel@cavium.com> Subject: [Patch] [Aarch64] PR 86538 - Define __ARM_FEATURE_LSE if LSE is available From: Steve Ellcey Reply-To: sellcey@cavium.com To: gcc-patches Cc: "richard.earnshaw" , "james.greenhalgh" , Marcus Shawcroft Date: Tue, 24 Jul 2018 13:22:02 -0700 Mime-Version: 1.0 Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) This is a patch for PR 86538, to define an __ARM_FEATURE_LSE macro when LSE is available.  Richard Earnshaw closed PR 86538 as WONTFIX because the ACLE (Arm C Language Extension) does not require this macro and because he is concerned that it might encourage people to use inline assembly instead of the __sync and atomic intrinsics. (See actual comments in the defect report.) While I agree that we want people to use the intrinsics I still think there are use cases where people may want to know if LSE is available or not and there is currrently no (simple) way to determine if this feature is available since it can be turned or and off independently of the architecture used.  Also, as a general principle, I  think any feature that can be toggled on or off by the compiler should provide a way for users to determine what its state is. So what do other ARM maintainers and users think?  Is this a useful feature to have in GCC? Steve Ellcey sellcey@cavium.com 2018-07-24  Steve Ellcey   PR target/86538 * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add define of __ARM_FEATURE_LSE. diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c index 40c738c..e057ba9 100644 --- a/gcc/config/aarch64/aarch64-c.c +++ b/gcc/config/aarch64/aarch64-c.c @@ -154,6 +154,9 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)    aarch64_def_or_undef (TARGET_SM4, "__ARM_FEATURE_SM4", pfile);    aarch64_def_or_undef (TARGET_F16FML, "__ARM_FEATURE_FP16_FML", pfile);   +  /* This is not required by ACLE, but it is useful.  */ +  aarch64_def_or_undef (TARGET_LSE, "__ARM_FEATURE_LSE", pfile); +    /* Not for ACLE, but required to keep "float.h" correct if we switch       target between implementations that do or do not support ARMv8.2-A       16-bit floating-point extensions.  */