public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Matthew Wahab <matthew.wahab@foss.arm.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [Aarch64][1/3] Use atomic compare-and-swap instructions when available.
Date: Wed, 12 Aug 2015 10:12:00 -0000	[thread overview]
Message-ID: <55CB1C0D.6070405@foss.arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

ARMv8.1 adds instructions for atomic compare-and-swap with optional
memory ordering specifiers. This patch series adds the instructions to
GCC, making them available with -march=armv8.1-a or with
-march=armv8-a+lse, and using them to implement the __sync and __atomic
builtins.

This patch adds an internal TARGET_LSE macro, to check target support
for the atomic instructions.

Subsequent patches
- add and use atomic compare-and-swap instructions;
- add tests for the compare-and-swap;

Tested the series for aarch64-none-linux-gnu with native bootstrap and make
check and for aarch64-none-elf with cross-compiled check-gcc. Also tested
aarch64-none-elf with cross-compiled check-gcc on an emulator that supports
ARMv8.1.

Ok for trunk?
Matthew

2015-08-12  Matthew Wahab  <matthew.wahab@arm.com>

	* config/aarch64/aarch64.h (AARCH64_ISA_LSE): New.
	(TARGET_LSE): New.

[-- Attachment #2: 0001-Add-LSE-flag-testing-macro.patch --]
[-- Type: text/x-patch, Size: 1434 bytes --]

From 50a71e7572de7eb47c7913ae3d0984cd61f8d425 Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
Date: Mon, 20 Jul 2015 12:42:52 +0100
Subject: [PATCH 1/3] Add LSE flag testing macro.

Change-Id: I4bfeb5ec617f13026fb7dcd28a9b5c7efa4c1719
---
 gcc/config/aarch64/aarch64.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 721927f..d6c7a74 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -156,6 +156,7 @@ extern unsigned aarch64_architecture_version;
 #define AARCH64_ISA_CRYPTO         (aarch64_isa_flags & AARCH64_FL_CRYPTO)
 #define AARCH64_ISA_FP             (aarch64_isa_flags & AARCH64_FL_FP)
 #define AARCH64_ISA_SIMD           (aarch64_isa_flags & AARCH64_FL_SIMD)
+#define AARCH64_ISA_LSE		   (aarch64_isa_flags & AARCH64_FL_LSE)
 
 /* Crypto is an optional extension to AdvSIMD.  */
 #define TARGET_CRYPTO (TARGET_SIMD && AARCH64_ISA_CRYPTO)
@@ -163,6 +164,9 @@ extern unsigned aarch64_architecture_version;
 /* CRC instructions that can be enabled through +crc arch extension.  */
 #define TARGET_CRC32 (AARCH64_ISA_CRC)
 
+/* Atomic instructions that can be enabled through the +lse extension.  */
+#define TARGET_LSE (AARCH64_ISA_LSE)
+
 /* Make sure this is always defined so we don't have to check for ifdefs
    but rather use normal ifs.  */
 #ifndef TARGET_FIX_ERR_A53_835769_DEFAULT
-- 
1.9.1


             reply	other threads:[~2015-08-12 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 10:12 Matthew Wahab [this message]
2015-08-12 10:15 ` [Aarch64][2/3] Use the " Matthew Wahab
2015-08-12 11:18   ` James Greenhalgh
2015-08-12 10:16 ` [Aarch64][3/3] Add tests for atomic compare-and-swap instructions Matthew Wahab
2015-08-12 10:51   ` Andrew Pinski
2015-08-12 11:13     ` Matthew Wahab
2015-08-12 11:26   ` James Greenhalgh
2015-08-12 10:42 ` [Aarch64][1/3] Use atomic compare-and-swap instructions when available James Greenhalgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55CB1C0D.6070405@foss.arm.com \
    --to=matthew.wahab@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).