Committed w/changelog fixup/sign-off and sent final version to the lists here:
https://inbox.sourceware.org/gcc-patches/20240730152448.4089002-1-patr...@rivosinc.com/T/#u

Approved during risc-v patchworks meeting by Jeff Law.

Patrick

On 7/29/24 15:13, Patrick O'Neill wrote:
From: Gianluca Guida <gianl...@rivosinc.com>

This patch adds support for amocas.{b|h|w|d}. Support for amocas.q
(64/128 bit cas for rv32/64) will be added in a future patch.

Extension: https://github.com/riscv/riscv-zacas
Ratification: https://jira.riscv.org/browse/RVS-680

gcc/ChangeLog:

        * config/riscv/arch-canonicalize: Make zacas imply zaamo.
        * config/riscv/riscv.opt: Add zacas.
        * config/riscv/sync.md (zacas_atomic_cas_value<mode>): New pattern.
        (atomic_compare_and_swap<mode>): Use new pattern for compare-and-swap 
ops.
        (zalrsc_atomic_cas_value_strong<mode>): Rename atomic_cas_value_strong.
        * doc/sourcebuild.texi: Add Zacas documentation.

gcc/testsuite/ChangeLog:

        * lib/target-supports.exp: Add zacas testsuite infra support.
        * 
gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-acquire-release.c:
        Remove zacas to continue to test the lr/sc pairs.
        * gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-acquire.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-consume.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-relaxed.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-release.c: 
Ditto.
        * 
gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-seq-cst-relaxed.c: Ditto.
        * gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-seq-cst.c: 
Ditto.
        * 
gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-acquire-release.c: Ditto.
        * gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-acquire.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-consume.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-relaxed.c: 
Ditto.
        * gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-release.c: 
Ditto.
        * 
gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-seq-cst-relaxed.c: Ditto.
        * gcc.target/riscv/amo/zalrsc-ztso-compare-exchange-int-seq-cst.c: 
Ditto.
        * gcc.target/riscv/amo/zabha-zacas-preferred-over-zalrsc.c: New test.
        * gcc.target/riscv/amo/zacas-char-requires-zabha.c: New test.
        * gcc.target/riscv/amo/zacas-char-requires-zacas.c: New test.
        * gcc.target/riscv/amo/zacas-preferred-over-zalrsc.c: New test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-char-acq-rel.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-char-acquire.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-char-relaxed.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-char-release.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-char-seq-cst.c: New 
test.
        * 
gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-compatability-mapping-no-fence.c:
        New test.
        * 
gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-compatability-mapping.cc: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-int-acq-rel.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-int-acquire.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-int-relaxed.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-int-release.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-int-seq-cst.c: New 
test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-short-acq-rel.c: 
New test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-short-acquire.c: 
New test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-short-relaxed.c: 
New test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-short-release.c: 
New test.
        * gcc.target/riscv/amo/zacas-rvwmo-compare-exchange-short-seq-cst.c: 
New test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-char-seq-cst.c: New 
test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-char.c: New test.
        * 
gcc.target/riscv/amo/zacas-ztso-compare-exchange-compatability-mapping-no-fence.c:
        New test.
        * 
gcc.target/riscv/amo/zacas-ztso-compare-exchange-compatability-mapping.cc: New 
test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-int-seq-cst.c: New 
test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-int.c: New test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-short-seq-cst.c: New 
test.
        * gcc.target/riscv/amo/zacas-ztso-compare-exchange-short.c: New test.

Co-authored-by: Patrick O'Neill <patr...@rivosinc.com>
Tested-by: Andrea Parri <and...@rivosinc.com>
---
V3 Changelog:
* Make insn lengths dynamic to account for leading fence.
* Remove config-check for old binutils versions.

Tested locally with zaamo, zalrsc, ztso, and zacas with amo.exp.
---
V2 Changelog
* Fix functional bug where expected amocas value wasn't initialized.
* Add leading fence to zacas with seq_cst failure mode for PSABI
compatability (and corresponding testcases).
* Rename atomic_cas_value_strong to zalrsc_atomic_cas_value_strong.
* Remove unneeded zabha from int testcases.
* Add testcase functions that test weak compxchng.
* Add testcase for non-zabha zacas preferred over lrsc.

Tested locally with zaamo, zalrsc, ztso, and zacas with amo.exp.
---

Reply via email to