From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8F4C33857356; Tue, 16 May 2023 17:00:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F4C33857356 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684256414; bh=q+5JKfFqxxbLMMHm3Op6zi+IVrZ1WB0JRXlogdNo2QM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=J4VgEz1sLXrAf8D5FAW/OJkG8iz2amI1kuGLWSvi0PXAg3cwVbi+bKl+6NdaDm4CS xfYHBao0u+8JBwQvicGfNQ0PTdG8uHoiCCKXxnHYXwMcn3Qje+J+vw7u67/AL7Wu2K +E6P2xZ54YXbCBUouLMGUSauj2Nf49+IZYqTmNSY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104338] RISC-V: Subword atomics result in library calls Date: Tue, 16 May 2023 17:00:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: patrick at rivosinc dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104338 --- Comment #16 from CVS Commits --- The releases/gcc-13 branch has been updated by Patrick O'Neill : https://gcc.gnu.org/g:55088cf384d4c43e280ec794217e32fab64070ba commit r13-7336-g55088cf384d4c43e280ec794217e32fab64070ba Author: Patrick O'Neill Date: Tue Apr 18 14:33:13 2023 -0700 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 gcc/ChangeLog: PR target/104338 * config/riscv/riscv-protos.h: Add helper function stubs. * config/riscv/riscv.cc: Add helper functions for subword maski= ng. * 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 Signed-off-by: Palmer Dabbelt =