aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick O'Neill <patrick@rivosinc.com>2024-06-25 14:14:17 -0700
committerPatrick O'Neill <patrick@rivosinc.com>2024-06-26 09:41:34 -0700
commitaa89e86f70ac65e2d51f33ac45849d05a4f30524 (patch)
treeda1d7a7668178c8e5bce8f87437353fa160c1546 /gcc
parent08498f81f0595eb8a90ea33afd7dab44bb76b293 (diff)
downloadgcc-aa89e86f70ac65e2d51f33ac45849d05a4f30524.zip
gcc-aa89e86f70ac65e2d51f33ac45849d05a4f30524.tar.gz
gcc-aa89e86f70ac65e2d51f33ac45849d05a4f30524.tar.bz2
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c56
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c52
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c57
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c57
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c78
-rw-r--r--gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c78
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 0000000..5b9400f
--- /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 0000000..37daeda
--- /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 2acad7d..0000000
--- 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 ab21f07..0000000
--- 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 919ff37..0000000
--- 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 1531d37..0000000
--- 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 03b7011..0000000
--- 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 202479a..0000000
--- 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 7d6c73a..0000000
--- 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 a53889a..0000000
--- 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 63a3a23..0000000
--- 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 78040bd..0000000
--- 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 000407a..0000000
--- 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 3e441ca..0000000
--- 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 8af1a2f..0000000
--- 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 0b3a7e5..0000000
--- 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 f189827..0000000
--- 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 ec008d2..0000000
--- 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 acef911..0000000
--- 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 6931ba0..0000000
--- 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 b5a0429..0000000
--- 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 860fb97..0000000
--- 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 582e965..0000000
--- 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 9874296..0000000
--- 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 b29966c..0000000
--- 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 5dfb7ac..0000000
--- 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 fcc6413..0000000
--- 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 0000000..2218724
--- /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 0000000..8cfd601
--- /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 0000000..4cf617d
--- /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 0000000..3fb16c0
--- /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);
+}