This series contains some minor big-endian RISC-V changes.

The common theme for most of these patches is selecting
the correct subword element on big-endian targets.

The second and the third patches are fixes pertaining to
atomic instructions on big-endian builds. The second patch
fixes issues with inline-atomics. The third should fix
libatomic for big-endian builds.

[1] made our big-endian builds fail,
since self-tests rely on RVV support. We simply disabled
self-tests for big-endian builds.

The patches were tested using QEMU modified
to support big-endian RISC-V targets [2]. We will be upstreaming this in the 
future.

We did begin the gdb-sim upstreaming process for big-endian RISC-V, but had no 
luck making 
inline-atomics work even on little-endian builds. The necessary changes can be 
found at [3], 
in case someone else finds them useful for testing the series. 

Testing instructions can be found in individual patch descriptions.

[1] https://gcc.gnu.org/pipermail/gcc-cvs/2024-January/396539.html
[2] https://github.com/djtodoro/qemu/tree/riscvbe/current#
[3] https://sourceware.org/pipermail/gdb-patches/2025-December/223463.html

Aleksa Paunovic (1):
  RISC-V: Fix big-endian build by disabling self-tests

Chao-ying Fu (3):
  RISC-V: Fix riscv_subword_address for big-endian targets.
  RISC-V: Use correct subreg in atomic_compare_and_swap
  RISC-V: libatomic: Fix the calculation of shift for the big-endian target.

 gcc/config/riscv/riscv-selftests.cc                  |  3 +++
 gcc/config/riscv/riscv.cc                            |  5 +++++
 gcc/config/riscv/sync.md                             |  3 ++-
 .../gcc.target/riscv/amo/big-endian-subword-amo-hi.c |  9 +++++++++
 .../gcc.target/riscv/amo/big-endian-subword-amo-qi.c |  9 +++++++++
 libatomic/cas_n.c                                    |  6 +++++-
 libatomic/exch_n.c                                   |  6 +++++-
 libatomic/fop_n.c                                    | 12 ++++++++++--
 libatomic/load_n.c                                   |  6 +++++-
 libatomic/store_n.c                                  |  6 +++++-
 libatomic/tas_n.c                                    |  6 +++++-
 11 files changed, 63 insertions(+), 8 deletions(-)
 create mode 100644 
gcc/testsuite/gcc.target/riscv/amo/big-endian-subword-amo-hi.c
 create mode 100644 
gcc/testsuite/gcc.target/riscv/amo/big-endian-subword-amo-qi.c

-- 
2.43.0

Reply via email to