Enable ARMv8-M atomic and synchronization support for ARMv8-M Baseline
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Thu, 27 Oct 2016 10:19:27 +0000 (10:19 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Thu, 27 Oct 2016 10:19:27 +0000 (10:19 +0000)
2016-10-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * config/arm/arm.h (TARGET_HAVE_LDREX): Define for ARMv8-M Baseline.
    (TARGET_HAVE_LDREXBH): Likewise.
    (TARGET_HAVE_LDACQ): Likewise.

    gcc/testsuite/
    * gcc.target/arm/atomic-comp-swap-release-acquire-3.c: New test.
    * gcc.target/arm/atomic-op-acq_rel-3.c: Likewise.
    * gcc.target/arm/atomic-op-acquire-3.c: Likewise.
    * gcc.target/arm/atomic-op-char-3.c: Likewise.
    * gcc.target/arm/atomic-op-consume-3.c: Likewise.
    * gcc.target/arm/atomic-op-int-3.c: Likewise.
    * gcc.target/arm/atomic-op-relaxed-3.c: Likewise.
    * gcc.target/arm/atomic-op-release-3.c: Likewise.
    * gcc.target/arm/atomic-op-seq_cst-3.c: Likewise.
    * gcc.target/arm/atomic-op-short-3.c: Likewise.

From-SVN: r241615

13 files changed:
gcc/ChangeLog
gcc/config/arm/arm.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-acq_rel-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-acquire-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-char-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-consume-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-int-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-relaxed-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-release-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-seq_cst-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/atomic-op-short-3.c [new file with mode: 0644]

index d1d53deada11be16efc2d667bdd5c761d4b7ee43..c93a12e4f2a72c7d3f44c338be835b7fcce018c8 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * config/arm/arm.h (TARGET_HAVE_LDREX): Define for ARMv8-M Baseline.
+       (TARGET_HAVE_LDREXBH): Likewise.
+       (TARGET_HAVE_LDACQ): Likewise.
+
 2016-10-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/arm/arm.c (arm_split_atomic_op): Add function comment.  Add
index 8a076ba3d8eb66e237790d23dd7c2ecb4b6fd264..b2d8422d494b84003239a14eb5196c1b5967ce50 100644 (file)
@@ -252,21 +252,25 @@ extern void (*arm_lang_output_object_attributes_hook)(void);
 #define TARGET_HAVE_MEMORY_BARRIER (TARGET_HAVE_DMB || TARGET_HAVE_DMB_MCR)
 
 /* Nonzero if this chip supports ldrex and strex */
-#define TARGET_HAVE_LDREX        ((arm_arch6 && TARGET_ARM) || arm_arch7)
+#define TARGET_HAVE_LDREX        ((arm_arch6 && TARGET_ARM)    \
+                                 || arm_arch7                  \
+                                 || (arm_arch8 && !arm_arch_notm))
 
 /* Nonzero if this chip supports LPAE.  */
 #define TARGET_HAVE_LPAE                                               \
   (arm_arch7 && ARM_FSET_HAS_CPU1 (insn_flags, FL_FOR_ARCH7VE))
 
 /* Nonzero if this chip supports ldrex{bh} and strex{bh}.  */
-#define TARGET_HAVE_LDREXBH ((arm_arch6k && TARGET_ARM) || arm_arch7)
+#define TARGET_HAVE_LDREXBH ((arm_arch6k && TARGET_ARM)                \
+                            || arm_arch7                       \
+                            || (arm_arch8 && !arm_arch_notm))
 
 /* Nonzero if this chip supports ldrexd and strexd.  */
 #define TARGET_HAVE_LDREXD (((arm_arch6k && TARGET_ARM) \
                             || arm_arch7) && arm_arch_notm)
 
 /* Nonzero if this chip supports load-acquire and store-release.  */
-#define TARGET_HAVE_LDACQ      (TARGET_ARM_ARCH >= 8 && TARGET_32BIT)
+#define TARGET_HAVE_LDACQ      (TARGET_ARM_ARCH >= 8)
 
 /* Nonzero if this chip supports LDAEXD and STLEXD.  */
 #define TARGET_HAVE_LDACQEXD   (TARGET_ARM_ARCH >= 8   \
index 512e9a63a96dee2417eb23945d3bb51fb311aca3..9e37729f4b7e8adc94110dab6014fb6597248ae0 100644 (file)
@@ -1,3 +1,16 @@
+2016-10-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * gcc.target/arm/atomic-comp-swap-release-acquire-3.c: New test.
+       * gcc.target/arm/atomic-op-acq_rel-3.c: Likewise.
+       * gcc.target/arm/atomic-op-acquire-3.c: Likewise.
+       * gcc.target/arm/atomic-op-char-3.c: Likewise.
+       * gcc.target/arm/atomic-op-consume-3.c: Likewise.
+       * gcc.target/arm/atomic-op-int-3.c: Likewise.
+       * gcc.target/arm/atomic-op-relaxed-3.c: Likewise.
+       * gcc.target/arm/atomic-op-release-3.c: Likewise.
+       * gcc.target/arm/atomic-op-seq_cst-3.c: Likewise.
+       * gcc.target/arm/atomic-op-short-3.c: Likewise.
+
 2016-10-27  Bin Cheng  <bin.cheng@arm.com>
 
        * gcc.dg/fold-convmaxconv-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire-3.c b/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire-3.c
new file mode 100644 (file)
index 0000000..0191f7a
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2 -fno-ipa-icf" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-comp-swap-release-acquire.x"
+
+/* { dg-final { scan-assembler-times "ldaex" 4 } } */
+/* { dg-final { scan-assembler-times "stlex" 4 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-acq_rel-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-acq_rel-3.c
new file mode 100644 (file)
index 0000000..f2ed32d
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-acq_rel.x"
+
+/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "stlex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-acquire-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-acquire-3.c
new file mode 100644 (file)
index 0000000..bba1c27
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-acquire.x"
+
+/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-char-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-char-3.c
new file mode 100644 (file)
index 0000000..17117ee
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-char.x"
+
+/* { dg-final { scan-assembler-times "ldrexb\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strexb\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-consume-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-consume-3.c
new file mode 100644 (file)
index 0000000..8352f0c
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-consume.x"
+
+/* Scan for ldaex is a PR59448 consume workaround.  */
+/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-int-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-int-3.c
new file mode 100644 (file)
index 0000000..d4f1db3
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-int.x"
+
+/* { dg-final { scan-assembler-times "ldrex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-relaxed-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-relaxed-3.c
new file mode 100644 (file)
index 0000000..09b5ea9
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-relaxed.x"
+
+/* { dg-final { scan-assembler-times "ldrex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-release-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-release-3.c
new file mode 100644 (file)
index 0000000..2b136f5
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-release.x"
+
+/* { dg-final { scan-assembler-times "ldrex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "stlex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-seq_cst-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-seq_cst-3.c
new file mode 100644 (file)
index 0000000..7f38d42
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-seq_cst.x"
+
+/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "stlex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-short-3.c b/gcc/testsuite/gcc.target/arm/atomic-op-short-3.c
new file mode 100644 (file)
index 0000000..60ae42e
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+
+#include "../aarch64/atomic-op-short.x"
+
+/* { dg-final { scan-assembler-times "ldrexh\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-times "strexh\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */
+/* { dg-final { scan-assembler-not "dmb" } } */