From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F3EFE3861013; Fri, 12 Apr 2024 08:06:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3EFE3861013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712909164; bh=VCpGw03O6Zl+sT5XbLFQERwqto4Jlg+MdFDe1teza+o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qZJN2lma/CkBP6+j0QINjW25NycyjhM5IGrioBG6OenCoReZAyMKi0rM67GN0Ll1M O/bUzNYZ0Q3AuKcHhkTS8y+taFeLDfF4w4fALoAdSgF6vch5gsLIzQdFl5g9shBJtd FUotiSDcsKSuNENcxQPYsjEqn0DrUh9TQ/HIHzVM= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114130] [11 Regression] RISC-V: `__atomic_compare_exchange` does not use sign-extended value for RV64 Date: Fri, 12 Apr 2024 08:06:02 +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 #5 from GCC Commits --- The releases/gcc-11 branch has been updated by Kito Cheng : https://gcc.gnu.org/g:cb68221c59e8f98e107bb5842d319bee3a66b8dc commit r11-11317-gcb68221c59e8f98e107bb5842d319bee3a66b8dc 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)=