[gcc r15-1660] RISC-V: Consolidate amo testcase variants

Patrick O'Neill poneill@gcc.gnu.org
Wed Jun 26 16:42:02 GMT 2024


https://gcc.gnu.org/g:aa89e86f70ac65e2d51f33ac45849d05a4f30524

commit r15-1660-gaa89e86f70ac65e2d51f33ac45849d05a4f30524
Author: Patrick O'Neill <patrick@rivosinc.com>
Date:   Tue Jun 25 14:14:17 2024 -0700

    RISC-V: Consolidate amo testcase variants
    
    Many riscv/amo/ testcases use check-function-bodies. These testcases can be
    consolidated with related testcases (memory ordering variants) without affecting
    the assertions.
    
    Give functions descriptive names so testsuite failures are obvious from the
    'FAIL:' line.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-fence-1.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-fence-2.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-fence-3.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-fence-4.c: Removed.
            * gcc.target/riscv/amo/amo-table-a-6-fence-5.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-fence-1.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-fence-2.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-fence-3.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-fence-4.c: Removed.
            * gcc.target/riscv/amo/amo-table-ztso-fence-5.c: Removed.
            * gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c: Removed.
            * gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c: Removed.
            * gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c: Removed.
            * gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c: Removed.
            * gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c: Removed.
            * gcc.target/riscv/amo/a-rvwmo-fence.c: New test.
            * gcc.target/riscv/amo/a-ztso-fence.c: New test.
            * gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c: New test.
            * gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c: New test.
            * gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c: New test.
            * gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c: New test.
    
    Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>

Diff:
---
 gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c | 56 ++++++++++++++++
 gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c  | 52 +++++++++++++++
 .../gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c | 17 -----
 .../gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c | 17 -----
 .../gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c | 17 -----
 .../gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c | 17 -----
 .../gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c | 17 -----
 .../gcc.target/riscv/amo/amo-table-a-6-fence-1.c   | 15 -----
 .../gcc.target/riscv/amo/amo-table-a-6-fence-2.c   | 16 -----
 .../gcc.target/riscv/amo/amo-table-a-6-fence-3.c   | 16 -----
 .../gcc.target/riscv/amo/amo-table-a-6-fence-4.c   | 16 -----
 .../gcc.target/riscv/amo/amo-table-a-6-fence-5.c   | 16 -----
 .../riscv/amo/amo-table-ztso-amo-add-1.c           | 17 -----
 .../riscv/amo/amo-table-ztso-amo-add-2.c           | 17 -----
 .../riscv/amo/amo-table-ztso-amo-add-3.c           | 17 -----
 .../riscv/amo/amo-table-ztso-amo-add-4.c           | 17 -----
 .../riscv/amo/amo-table-ztso-amo-add-5.c           | 17 -----
 .../gcc.target/riscv/amo/amo-table-ztso-fence-1.c  | 15 -----
 .../gcc.target/riscv/amo/amo-table-ztso-fence-2.c  | 15 -----
 .../gcc.target/riscv/amo/amo-table-ztso-fence-3.c  | 15 -----
 .../gcc.target/riscv/amo/amo-table-ztso-fence-4.c  | 15 -----
 .../gcc.target/riscv/amo/amo-table-ztso-fence-5.c  | 16 -----
 .../gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c    | 22 ------
 .../gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c    | 22 ------
 .../gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c    | 22 ------
 .../gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c    | 22 ------
 .../gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c    | 22 ------
 .../gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c | 57 ++++++++++++++++
 .../gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c  | 57 ++++++++++++++++
 .../riscv/amo/zalrsc-rvwmo-amo-add-int.c           | 78 ++++++++++++++++++++++
 .../gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c | 78 ++++++++++++++++++++++
 31 files changed, 378 insertions(+), 435 deletions(-)

diff --git a/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c b/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c
new file mode 100644
index 00000000000..5b9400f7da8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* Verify that fence mappings match Table A.6's recommended mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-remove-options riscv_ztso } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** fence_relaxed:
+**	ret
+*/
+void fence_relaxed()
+{
+  __atomic_thread_fence(__ATOMIC_RELAXED);
+}
+
+/*
+** fence_acquire:
+**	fence\tr,rw
+**	ret
+*/
+void fence_acquire()
+{
+  __atomic_thread_fence(__ATOMIC_ACQUIRE);
+}
+
+/*
+** fence_release:
+**	fence\trw,w
+**	ret
+*/
+void fence_release()
+{
+  __atomic_thread_fence(__ATOMIC_RELEASE);
+}
+
+/*
+** fence_acq_rel:
+**	fence\.tso
+**	ret
+*/
+void fence_acq_rel()
+{
+  __atomic_thread_fence(__ATOMIC_ACQ_REL);
+}
+
+/*
+** fence_seq_cst:
+**	fence\trw,rw
+**	ret
+*/
+void fence_seq_cst()
+{
+  __atomic_thread_fence(__ATOMIC_SEQ_CST);
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c b/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c
new file mode 100644
index 00000000000..37daeda8354
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* Verify that fence mappings match the Ztso suggested mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-add-options riscv_ztso } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** fence_relaxed:
+**	ret
+*/
+void fence_relaxed()
+{
+  __atomic_thread_fence(__ATOMIC_RELAXED);
+}
+
+/*
+** fence_acquire:
+**	ret
+*/
+void fence_acquire()
+{
+  __atomic_thread_fence(__ATOMIC_ACQUIRE);
+}
+
+/*
+** fence_release:
+**	ret
+*/
+void fence_release()
+{
+  __atomic_thread_fence(__ATOMIC_RELEASE);
+}
+
+/*
+** fence_acq_rel:
+**	ret
+*/
+void fence_acq_rel()
+{
+  __atomic_thread_fence(__ATOMIC_ACQ_REL);
+}
+
+/*
+** fence_seq_cst:
+**	fence\trw,rw
+**	ret
+*/
+void fence_seq_cst()
+{
+  __atomic_thread_fence(__ATOMIC_SEQ_CST);
+}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c
deleted file mode 100644
index 2acad7d44bf..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c
deleted file mode 100644
index ab21f079eaa..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\.aq\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c
deleted file mode 100644
index 919ff37d096..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\.rl\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c
deleted file mode 100644
index 1531d3763b7..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\.aqrl\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c
deleted file mode 100644
index 03b70111a74..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\.aqrl\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c
deleted file mode 100644
index 202479a005e..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_RELAXED);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c
deleted file mode 100644
index 7d6c73a6b50..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	fence\tr,rw
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_ACQUIRE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c
deleted file mode 100644
index a53889a4fa1..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	fence\trw,w
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_RELEASE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c
deleted file mode 100644
index 63a3a234d43..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	fence\.tso
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_ACQ_REL);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c
deleted file mode 100644
index 78040bd11e9..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	fence\trw,rw
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_SEQ_CST);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c
deleted file mode 100644
index 000407a2583..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c
deleted file mode 100644
index 3e441cadbf3..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c
deleted file mode 100644
index 8af1a2f79a4..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c
deleted file mode 100644
index 0b3a7e59689..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c
deleted file mode 100644
index f189827d6cf..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */
-/* Verify that atomic op mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zaamo } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	amoadd\.w\tzero,a1,0\(a0\)
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c
deleted file mode 100644
index ec008d25794..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_RELAXED);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c
deleted file mode 100644
index acef911573f..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_ACQUIRE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c
deleted file mode 100644
index 6931ba0a799..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_RELEASE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c
deleted file mode 100644
index b5a04294ad0..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_ACQ_REL);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c
deleted file mode 100644
index 860fb978cbc..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* Verify that fence mappings match the Ztso suggested mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	fence\trw,rw
-**	ret
-*/
-void foo()
-{
-  __atomic_thread_fence(__ATOMIC_SEQ_CST);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c
deleted file mode 100644
index 582e96534de..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zalrsc } */
-/* { dg-remove-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	1:
-**	lr.w\t[atx][0-9]+, 0\(a0\)
-**	add\t[atx][0-9]+, [atx][0-9]+, a1
-**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
-**      bnez\t[atx][0-9]+, 1b
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c
deleted file mode 100644
index 987429640de..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zalrsc } */
-/* { dg-remove-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	1:
-**	lr.w.aq\t[atx][0-9]+, 0\(a0\)
-**	add\t[atx][0-9]+, [atx][0-9]+, a1
-**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
-**      bnez\t[atx][0-9]+, 1b
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c
deleted file mode 100644
index b29966ce7d7..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zalrsc } */
-/* { dg-remove-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	1:
-**	lr.w\t[atx][0-9]+, 0\(a0\)
-**	add\t[atx][0-9]+, [atx][0-9]+, a1
-**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
-**      bnez\t[atx][0-9]+, 1b
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c
deleted file mode 100644
index 5dfb7ac2bac..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zalrsc } */
-/* { dg-remove-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	1:
-**	lr.w.aq\t[atx][0-9]+, 0\(a0\)
-**	add\t[atx][0-9]+, [atx][0-9]+, a1
-**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
-**      bnez\t[atx][0-9]+, 1b
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c
deleted file mode 100644
index fcc64131fec..00000000000
--- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping.  */
-/* { dg-options "-O3" } */
-/* { dg-add-options riscv_zalrsc } */
-/* { dg-remove-options riscv_zaamo } */
-/* { dg-remove-options riscv_ztso } */
-/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
-/* { dg-final { check-function-bodies "**" "" } } */
-
-/*
-** foo:
-**	1:
-**	lr.w.aqrl\t[atx][0-9]+, 0\(a0\)
-**	add\t[atx][0-9]+, [atx][0-9]+, a1
-**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
-**      bnez\t[atx][0-9]+, 1b
-**	ret
-*/
-void foo (int* bar, int baz)
-{
-  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
-}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c
new file mode 100644
index 00000000000..22187243314
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-add-options riscv_zaamo } */
+/* { dg-remove-options riscv_ztso } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** atomic_add_fetch_int_relaxed:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_relaxed (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
+}
+
+/*
+** atomic_add_fetch_int_acquire:
+**	amoadd\.w\.aq\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_acquire (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
+}
+
+/*
+** atomic_add_fetch_int_release:
+**	amoadd\.w\.rl\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_release (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
+}
+
+/*
+** atomic_add_fetch_int_acq_rel:
+**	amoadd\.w\.aqrl\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_acq_rel (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
+}
+
+/*
+** atomic_add_fetch_int_seq_cst:
+**	amoadd\.w\.aqrl\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_seq_cst (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
+}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c
new file mode 100644
index 00000000000..8cfd601f12a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+/* Verify that atomic op mappings match Table A.6's recommended mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-add-options riscv_zaamo } */
+/* { dg-add-options riscv_ztso } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** atomic_add_fetch_int_relaxed:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_relaxed (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
+}
+
+/*
+** atomic_add_fetch_int_acquire:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_acquire (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
+}
+
+/*
+** atomic_add_fetch_int_release:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_release (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
+}
+
+/*
+** atomic_add_fetch_int_acq_rel:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_acq_rel (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
+}
+
+/*
+** atomic_add_fetch_int_seq_cst:
+**	amoadd\.w\tzero,a1,0\(a0\)
+**	ret
+*/
+void atomic_add_fetch_int_seq_cst (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
+}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c
new file mode 100644
index 00000000000..4cf617d6035
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c
@@ -0,0 +1,78 @@
+/* { dg-do compile } */
+/* Verify that lrsc atomic op mappings match the PSABI doc's recommended mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-add-options riscv_zalrsc } */
+/* { dg-remove-options riscv_zaamo } */
+/* { dg-remove-options riscv_ztso } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** atomic_add_fetch_int_relaxed:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_relaxed (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
+}
+
+/*
+** atomic_add_fetch_int_acquire:
+**	1:
+**	lr.w.aq\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_acquire (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
+}
+
+/*
+** atomic_add_fetch_int_release:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_release (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
+}
+
+/*
+** atomic_add_fetch_int_acq_rel:
+**	1:
+**	lr.w.aq\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_acq_rel (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
+}
+
+/*
+** atomic_add_fetch_int_seq_cst:
+**	1:
+**	lr.w.aqrl\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_seq_cst (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
+}
diff --git a/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c
new file mode 100644
index 00000000000..3fb16c01191
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c
@@ -0,0 +1,78 @@
+/* { dg-do compile } */
+/* Verify that lrsc atomic op mappings match the PSABI doc's recommended mapping.  */
+/* { dg-options "-O3" } */
+/* { dg-add-options riscv_zalrsc } */
+/* { dg-add-options riscv_ztso } */
+/* { dg-remove-options riscv_zaamo } */
+/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** atomic_add_fetch_int_relaxed:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_relaxed (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED);
+}
+
+/*
+** atomic_add_fetch_int_acquire:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_acquire (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE);
+}
+
+/*
+** atomic_add_fetch_int_release:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_release (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE);
+}
+
+/*
+** atomic_add_fetch_int_acq_rel:
+**	1:
+**	lr.w\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_acq_rel (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL);
+}
+
+/*
+** atomic_add_fetch_int_seq_cst:
+**	1:
+**	lr.w.aqrl\t[atx][0-9]+, 0\(a0\)
+**	add\t[atx][0-9]+, [atx][0-9]+, a1
+**	sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\)
+**      bnez\t[atx][0-9]+, 1b
+**	ret
+*/
+void atomic_add_fetch_int_seq_cst (int* bar, int baz)
+{
+  __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST);
+}


More information about the Gcc-cvs mailing list