forked from ruyisdk/riscv-gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These tests cover basic cases to ensure the atomic mappings follow the strengthened Table A.6 mappings that are compatible with Table A.7. 2023-04-27 Patrick O'Neill <patrick@rivosinc.com> gcc/testsuite/ChangeLog: * gcc.target/riscv/amo-table-a-6-amo-add-1.c: New test. * gcc.target/riscv/amo-table-a-6-amo-add-2.c: New test. * gcc.target/riscv/amo-table-a-6-amo-add-3.c: New test. * gcc.target/riscv/amo-table-a-6-amo-add-4.c: New test. * gcc.target/riscv/amo-table-a-6-amo-add-5.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-1.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-2.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-3.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-4.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-5.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-6.c: New test. * gcc.target/riscv/amo-table-a-6-compare-exchange-7.c: New test. * gcc.target/riscv/amo-table-a-6-fence-1.c: New test. * gcc.target/riscv/amo-table-a-6-fence-2.c: New test. * gcc.target/riscv/amo-table-a-6-fence-3.c: New test. * gcc.target/riscv/amo-table-a-6-fence-4.c: New test. * gcc.target/riscv/amo-table-a-6-fence-5.c: New test. * gcc.target/riscv/amo-table-a-6-load-1.c: New test. * gcc.target/riscv/amo-table-a-6-load-2.c: New test. * gcc.target/riscv/amo-table-a-6-load-3.c: New test. * gcc.target/riscv/amo-table-a-6-store-1.c: New test. * gcc.target/riscv/amo-table-a-6-store-2.c: New test. * gcc.target/riscv/amo-table-a-6-store-compat-3.c: New test. * gcc.target/riscv/amo-table-a-6-subword-amo-add-1.c: New test. * gcc.target/riscv/amo-table-a-6-subword-amo-add-2.c: New test. * gcc.target/riscv/amo-table-a-6-subword-amo-add-3.c: New test. * gcc.target/riscv/amo-table-a-6-subword-amo-add-4.c: New test. * gcc.target/riscv/amo-table-a-6-subword-amo-add-5.c: New test. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
- Loading branch information
1 parent
ea287b5
commit a9cd998
Showing
28 changed files
with
360 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { 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); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-2.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aq\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_CONSUME, __ATOMIC_CONSUME); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-3.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aq\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-4.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_RELAXED); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-5.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); | ||
} |
10 changes: 10 additions & 0 deletions
10
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-6.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* Mixed mappings need to be unioned. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aq\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_ACQUIRE); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-compare-exchange-7.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that compare exchange mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (int bar, int baz, int qux) | ||
{ | ||
__atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that fence mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** ret | ||
*/ | ||
void foo() | ||
{ | ||
__atomic_thread_fence(__ATOMIC_RELAXED); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that fence mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** fence\tr,rw | ||
** ret | ||
*/ | ||
void foo() | ||
{ | ||
__atomic_thread_fence(__ATOMIC_ACQUIRE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that fence mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** fence\trw,w | ||
** ret | ||
*/ | ||
void foo() | ||
{ | ||
__atomic_thread_fence(__ATOMIC_RELEASE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that fence mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** fence\.tso | ||
** ret | ||
*/ | ||
void foo() | ||
{ | ||
__atomic_thread_fence(__ATOMIC_ACQ_REL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that fence mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** fence\trw,rw | ||
** ret | ||
*/ | ||
void foo() | ||
{ | ||
__atomic_thread_fence(__ATOMIC_SEQ_CST); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that load mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** lw\ta[0-9]+,0\(a0\) | ||
** sw\ta[0-9]+,0\(a1\) | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_load(bar, baz, __ATOMIC_RELAXED); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that load mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** lw\ta[0-9]+,0\(a0\) | ||
** fence\tr,rw | ||
** sw\ta[0-9]+,0\(a1\) | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_load(bar, baz, __ATOMIC_ACQUIRE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that load mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** fence\trw,rw | ||
** lw\ta[0-9]+,0\(a0\) | ||
** fence\tr,rw | ||
** sw\ta[0-9]+,0\(a1\) | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_load(bar, baz, __ATOMIC_SEQ_CST); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that store mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** lw\ta[0-9]+,0\(a1\) | ||
** sw\ta[0-9]+,0\(a0\) | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_store(bar, baz, __ATOMIC_RELAXED); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that store mappings match Table A.6's recommended mapping. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** lw\ta[0-9]+,0\(a1\) | ||
** fence\trw,w | ||
** sw\ta[0-9]+,0\(a0\) | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_store(bar, baz, __ATOMIC_RELEASE); | ||
} |
18 changes: 18 additions & 0 deletions
18
gcc/testsuite/gcc.target/riscv/amo-table-a-6-store-compat-3.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that store mapping are compatible with Table A.6 & A.7. */ | ||
/* { dg-options "-O3" } */ | ||
/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ | ||
/* { dg-final { check-function-bodies "**" "" } } */ | ||
|
||
/* | ||
** foo: | ||
** lw\ta[0-9]+,0\(a1\) | ||
** fence\trw,w | ||
** sw\ta[0-9]+,0\(a0\) | ||
** fence\trw,rw | ||
** ret | ||
*/ | ||
void foo (int* bar, int* baz) | ||
{ | ||
__atomic_store(bar, baz, __ATOMIC_SEQ_CST); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-subword-amo-add-1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that subword atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ | ||
|
||
void foo (short* bar, short* baz) | ||
{ | ||
__atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-subword-amo-add-2.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that subword atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aq\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ | ||
|
||
void foo (short* bar, short* baz) | ||
{ | ||
__atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-subword-amo-add-3.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that subword atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (short* bar, short* baz) | ||
{ | ||
__atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-subword-amo-add-4.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that subword atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aq\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (short* bar, short* baz) | ||
{ | ||
__atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); | ||
} |
9 changes: 9 additions & 0 deletions
9
gcc/testsuite/gcc.target/riscv/amo-table-a-6-subword-amo-add-5.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { dg-do compile } */ | ||
/* Verify that subword atomic op mappings match Table A.6's recommended mapping. */ | ||
/* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ | ||
/* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ | ||
|
||
void foo (short* bar, short* baz) | ||
{ | ||
__atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); | ||
} |