-
- Downloads
RISCV: Inline subword atomic ops
RISC-V has no support for subword atomic operations; code currently generates libatomic library calls. This patch changes the default behavior to inline subword atomic calls (using the same logic as the existing library call). Behavior can be specified using the -minline-atomics and -mno-inline-atomics command line flags. gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. This will need to stay for backwards compatibility and the -mno-inline-atomics flag. 2023-05-03 Patrick O'Neill <patrick@rivosinc.com> gcc/ChangeLog: PR target/104338 * config/riscv/riscv-protos.h: Add helper function stubs. * config/riscv/riscv.cc: Add helper functions for subword masking. * config/riscv/riscv.opt: Add command-line flags -minline-atomics and -mno-inline-atomics. * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op, fetch_and_nand, CAS, and exchange ops. * doc/invoke.texi: Add blurb regarding new command-line flags -minline-atomics and -mno-inline-atomics. libgcc/ChangeLog: PR target/104338 * config/riscv/atomic.c: Add reference to duplicate logic. gcc/testsuite/ChangeLog: PR target/104338 * gcc.target/riscv/inline-atomics-1.c: New test. * gcc.target/riscv/inline-atomics-2.c: New test. * gcc.target/riscv/inline-atomics-3.c: New test. * gcc.target/riscv/inline-atomics-4.c: New test. * gcc.target/riscv/inline-atomics-5.c: New test. * gcc.target/riscv/inline-atomics-6.c: New test. * gcc.target/riscv/inline-atomics-7.c: New test. * gcc.target/riscv/inline-atomics-8.c: New test. Signed-off-by:Patrick O'Neill <patrick@rivosinc.com> Signed-off-by:
Palmer Dabbelt <palmer@rivosinc.com>
Showing
- gcc/config/riscv/riscv-protos.h 2 additions, 0 deletionsgcc/config/riscv/riscv-protos.h
- gcc/config/riscv/riscv.cc 49 additions, 0 deletionsgcc/config/riscv/riscv.cc
- gcc/config/riscv/riscv.opt 4 additions, 0 deletionsgcc/config/riscv/riscv.opt
- gcc/config/riscv/sync.md 302 additions, 1 deletiongcc/config/riscv/sync.md
- gcc/doc/invoke.texi 9 additions, 1 deletiongcc/doc/invoke.texi
- gcc/testsuite/gcc.target/riscv/inline-atomics-1.c 18 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-1.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-2.c 9 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-2.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-3.c 569 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-3.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-4.c 566 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-4.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-5.c 87 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-5.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-6.c 87 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-6.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-7.c 69 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-7.c
- gcc/testsuite/gcc.target/riscv/inline-atomics-8.c 69 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/inline-atomics-8.c
- libgcc/config/riscv/atomic.c 2 additions, 0 deletionslibgcc/config/riscv/atomic.c
Loading
Please register or sign in to comment