From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DBDAB384AB43; Thu, 11 Apr 2024 01:21:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBDAB384AB43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712798483; bh=KvQLaNWDqh1qp8L5hQ4BHJ4OqR8lhFRyGCevTXCVrJo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hursUf+7z6FfFtx2v9bzfdGeN0m/SlzdMG6Qna4K5ZyDtIvIzDsA8pTb4nB0ARJqC OrrliNu2JvKIY6GDVOnJksBLftSnuyd3ZtYFPBV50lrF9EBMf6K7gW8ihIuZ9o66ZL hsHK+F0C2ks697ultZgdZbleG9KZQEl/s9yQDBMY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114130] [11/12/13 Regression] RISC-V: `__atomic_compare_exchange` does not use sign-extended value for RV64 Date: Thu, 11 Apr 2024 01:21:22 +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: 13.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal 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: kito at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 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=3D114130 --- Comment #3 from GCC Commits --- The releases/gcc-13 branch has been updated by Kito Cheng : https://gcc.gnu.org/g:fb6ec6df54317ed3f6e6f878b6ea29dbef6bfe2d commit r13-8598-gfb6ec6df54317ed3f6e6f878b6ea29dbef6bfe2d Author: Kito Cheng Date: Wed Feb 28 16:01:52 2024 +0800 RISC-V: Fix __atomic_compare_exchange with 32 bit value on RV64 atomic_compare_and_swapsi will use lr.w to do obtain the original value, which sign extends to DI. RV64 only has DI comparisons, so we also need to sign extend the expected value to DI as otherwise the comparison will fail when the expected value has the 32nd bit set. gcc/ChangeLog: PR target/114130 * config/riscv/sync.md (atomic_compare_and_swap): Sign extend the expected value if needed. gcc/testsuite/ChangeLog: * gcc.target/riscv/pr114130.c: New. Reviewed-by: Palmer Dabbelt (cherry picked from commit fd07a29e39f5347d6cef3e7042a32306f97a1719)=